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-2005 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #ifndef _SceneNode_H__ 00026 #define _SceneNode_H__ 00027 00028 #include "OgrePrerequisites.h" 00029 00030 #include "OgreNode.h" 00031 #include "OgreIteratorWrappers.h" 00032 #include "OgreAxisAlignedBox.h" 00033 00034 namespace Ogre { 00035 00045 class _OgreExport SceneNode : public Node 00046 { 00047 public: 00048 typedef HashMap<String, MovableObject*> ObjectMap; 00049 typedef MapIterator<ObjectMap> ObjectIterator; 00050 typedef ConstMapIterator<ObjectMap> ConstObjectIterator; 00051 00052 protected: 00053 ObjectMap mObjectsByName; 00054 mutable LightList mLightList; 00055 mutable bool mLightListDirty; 00056 00058 WireBoundingBox *mWireBoundingBox; 00060 bool mShowBoundingBox; 00061 00063 SceneManager* mCreator; 00064 00066 AxisAlignedBox mWorldAABB; 00067 00069 Node* createChildImpl(void); 00070 00072 Node* createChildImpl(const String& name); 00073 00075 void setParent(Node* parent); 00076 00080 void setInSceneGraph(bool inGraph); 00081 00083 bool mYawFixed; 00085 Vector3 mYawFixedAxis; 00086 00088 SceneNode* mAutoTrackTarget; 00090 Vector3 mAutoTrackOffset; 00092 Vector3 mAutoTrackLocalDirection; 00094 bool mIsInSceneGraph; 00095 public: 00100 SceneNode(SceneManager* creator); 00105 SceneNode(SceneManager* creator, const String& name); 00106 ~SceneNode(); 00107 00113 virtual void attachObject(MovableObject* obj); 00114 00117 virtual unsigned short numAttachedObjects(void) const; 00118 00123 virtual MovableObject* getAttachedObject(unsigned short index); 00124 00128 virtual MovableObject* getAttachedObject(const String& name); 00129 00135 virtual MovableObject* detachObject(unsigned short index); 00137 virtual void detachObject(MovableObject* obj); 00138 00140 virtual MovableObject* detachObject(const String& name); 00141 00144 virtual void detachAllObjects(void); 00145 00149 virtual bool isInSceneGraph(void) const { return mIsInSceneGraph; } 00150 00155 virtual void _notifyRootNode(void) { mIsInSceneGraph = true; } 00156 00157 00170 virtual void _update(bool updateChildren, bool parentHasChanged); 00171 00174 virtual void _updateBounds(void); 00175 00192 virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue, 00193 bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false); 00194 00200 virtual AxisAlignedBox _getWorldAABB(void) const; 00201 00212 virtual ObjectIterator getAttachedObjectIterator(void); 00223 virtual ConstObjectIterator getAttachedObjectIterator(void) const; 00224 00230 SceneManager* getCreator(void) const; 00231 00242 virtual void removeAndDestroyChild(const String& name); 00243 00254 virtual void removeAndDestroyChild(unsigned short index); 00255 00262 virtual void removeAndDestroyAllChildren(void); 00263 00268 virtual void showBoundingBox(bool bShow); 00269 00272 virtual void _addBoundingBoxToQueue(RenderQueue* queue); 00273 00281 virtual bool getShowBoundingBox() const; 00282 00289 virtual SceneNode* createChildSceneNode( 00290 const Vector3& translate = Vector3::ZERO, 00291 const Quaternion& rotate = Quaternion::IDENTITY ); 00292 00302 virtual SceneNode* createChildSceneNode(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY); 00303 00313 const LightList& findLights(Real radius) const; 00314 00329 void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y ); 00330 00333 virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL); 00334 #ifndef OGRE_FORCE_ANGLE_TYPES 00335 inline void yaw(Real degrees, TransformSpace relativeTo = TS_LOCAL) { 00336 yaw ( Angle(degrees), relativeTo ); 00337 } 00338 #endif//OGRE_FORCE_ANGLE_TYPES 00339 00349 void setDirection(Real x, Real y, Real z, 00350 TransformSpace relativeTo = TS_LOCAL, 00351 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 00352 00363 void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL, 00364 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 00371 void lookAt( const Vector3& targetPoint, TransformSpace relativeTo, 00372 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 00391 void setAutoTracking(bool enabled, SceneNode* target = 0, 00392 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z, 00393 const Vector3& offset = Vector3::ZERO); 00395 SceneNode* getAutoTrackTarget(void) { return mAutoTrackTarget; } 00397 const Vector3& getAutoTrackOffset(void) { return mAutoTrackOffset; } 00399 const Vector3& getAutoTrackLocalDirection(void) { return mAutoTrackLocalDirection; } 00401 void _autoTrack(void); 00403 SceneNode* getParentSceneNode(void) const; 00412 void setVisible(bool visible, bool cascade = true); 00420 void flipVisibility(bool cascade = true); 00421 00422 00423 00424 00425 00426 }; 00427 00428 00429 }// namespace 00430 00431 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:49 2006