00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2013 Torus Knot Software Ltd 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 THE SOFTWARE. 00026 ----------------------------------------------------------------------------- 00027 */ 00028 #ifndef _SceneNode_H__ 00029 #define _SceneNode_H__ 00030 00031 #include "OgrePrerequisites.h" 00032 00033 #include "OgreNode.h" 00034 #include "OgreIteratorWrappers.h" 00035 #include "OgreAxisAlignedBox.h" 00036 #include "OgreHeaderPrefix.h" 00037 00038 namespace Ogre { 00039 00040 // forward decl 00041 struct VisibleObjectsBoundsInfo; 00042 00058 class _OgreExport SceneNode : public Node 00059 { 00060 public: 00061 typedef HashMap<String, MovableObject*> ObjectMap; 00062 typedef MapIterator<ObjectMap> ObjectIterator; 00063 typedef ConstMapIterator<ObjectMap> ConstObjectIterator; 00064 00065 protected: 00066 ObjectMap mObjectsByName; 00067 00069 WireBoundingBox *mWireBoundingBox; 00071 bool mShowBoundingBox; 00072 bool mHideBoundingBox; 00073 00075 SceneManager* mCreator; 00076 00078 AxisAlignedBox mWorldAABB; 00079 00081 void updateFromParentImpl(void) const; 00082 00084 Node* createChildImpl(void); 00085 00087 Node* createChildImpl(const String& name); 00088 00090 void setParent(Node* parent); 00091 00095 virtual void setInSceneGraph(bool inGraph); 00096 00098 bool mYawFixed; 00100 Vector3 mYawFixedAxis; 00101 00103 SceneNode* mAutoTrackTarget; 00105 Vector3 mAutoTrackOffset; 00107 Vector3 mAutoTrackLocalDirection; 00109 bool mIsInSceneGraph; 00110 public: 00115 SceneNode(SceneManager* creator); 00120 SceneNode(SceneManager* creator, const String& name); 00121 ~SceneNode(); 00122 00128 virtual void attachObject(MovableObject* obj); 00129 00132 virtual unsigned short numAttachedObjects(void) const; 00133 00138 virtual MovableObject* getAttachedObject(unsigned short index); 00139 00143 virtual MovableObject* getAttachedObject(const String& name); 00144 00150 virtual MovableObject* detachObject(unsigned short index); 00152 virtual void detachObject(MovableObject* obj); 00153 00155 virtual MovableObject* detachObject(const String& name); 00156 00159 virtual void detachAllObjects(void); 00160 00164 virtual bool isInSceneGraph(void) const { return mIsInSceneGraph; } 00165 00170 virtual void _notifyRootNode(void) { mIsInSceneGraph = true; } 00171 00172 00185 virtual void _update(bool updateChildren, bool parentHasChanged); 00186 00189 virtual void _updateBounds(void); 00190 00209 virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue, 00210 VisibleObjectsBoundsInfo* visibleBounds, 00211 bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false); 00212 00218 virtual const AxisAlignedBox& _getWorldAABB(void) const; 00219 00230 virtual ObjectIterator getAttachedObjectIterator(void); 00241 virtual ConstObjectIterator getAttachedObjectIterator(void) const; 00242 00248 SceneManager* getCreator(void) const { return mCreator; } 00249 00260 virtual void removeAndDestroyChild(const String& name); 00261 00272 virtual void removeAndDestroyChild(unsigned short index); 00273 00280 virtual void removeAndDestroyAllChildren(void); 00281 00286 virtual void showBoundingBox(bool bShow); 00287 00293 virtual void hideBoundingBox(bool bHide); 00294 00297 virtual void _addBoundingBoxToQueue(RenderQueue* queue); 00298 00306 virtual bool getShowBoundingBox() const; 00307 00314 virtual SceneNode* createChildSceneNode( 00315 const Vector3& translate = Vector3::ZERO, 00316 const Quaternion& rotate = Quaternion::IDENTITY ); 00317 00327 virtual SceneNode* createChildSceneNode(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY); 00328 00345 virtual void findLights(LightList& destList, Real radius, uint32 lightMask = 0xFFFFFFFF) const; 00346 00361 virtual void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y ); 00362 00365 virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL); 00376 virtual void setDirection(Real x, Real y, Real z, 00377 TransformSpace relativeTo = TS_LOCAL, 00378 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 00379 00390 virtual void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL, 00391 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 00398 virtual void lookAt( const Vector3& targetPoint, TransformSpace relativeTo, 00399 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 00418 virtual void setAutoTracking(bool enabled, SceneNode* const target = 0, 00419 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z, 00420 const Vector3& offset = Vector3::ZERO); 00422 virtual SceneNode* getAutoTrackTarget(void) { return mAutoTrackTarget; } 00424 virtual const Vector3& getAutoTrackOffset(void) { return mAutoTrackOffset; } 00426 virtual const Vector3& getAutoTrackLocalDirection(void) { return mAutoTrackLocalDirection; } 00428 void _autoTrack(void); 00430 SceneNode* getParentSceneNode(void) const; 00439 virtual void setVisible(bool visible, bool cascade = true); 00447 virtual void flipVisibility(bool cascade = true); 00448 00458 virtual void setDebugDisplayEnabled(bool enabled, bool cascade = true); 00459 00461 virtual DebugRenderable* getDebugRenderable(); 00462 00463 00464 00465 00466 }; 00471 }// namespace 00472 00473 #include "OgreHeaderSuffix.h" 00474 00475 #endif
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:45