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 © 2000-2002 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 00033 namespace Ogre { 00034 00044 class _OgreExport SceneNode : public Node 00045 { 00046 public: 00047 typedef HashMap<String, MovableObject*, _StringHash> ObjectMap; 00048 typedef MapIterator<ObjectMap> ObjectIterator; 00049 00050 protected: 00051 ObjectMap mObjectsByName; 00052 mutable LightList mLightList; 00053 mutable bool mLightListDirty; 00054 00056 WireBoundingBox *mWireBoundingBox; 00058 bool mShowBoundingBox; 00059 00061 SceneManager* mCreator; 00062 00064 AxisAlignedBox mWorldAABB; 00065 00068 virtual void _updateBounds(void); 00069 00071 Node* createChildImpl(void); 00072 00074 Node* createChildImpl(const String& name); 00075 00077 bool mYawFixed; 00079 Vector3 mYawFixedAxis; 00080 00082 SceneNode* mAutoTrackTarget; 00084 Vector3 mAutoTrackOffset; 00086 Vector3 mAutoTrackLocalDirection; 00087 public: 00092 SceneNode(SceneManager* creator); 00097 SceneNode(SceneManager* creator, const String& name); 00098 ~SceneNode(); 00099 00105 virtual void attachObject(MovableObject* obj); 00106 00109 virtual unsigned short numAttachedObjects(void) const; 00110 00115 virtual MovableObject* getAttachedObject(unsigned short index); 00116 00120 virtual MovableObject* getAttachedObject(const String& name); 00121 00127 virtual MovableObject* detachObject(unsigned short index); 00129 virtual void detachObject(MovableObject* obj); 00130 00132 virtual MovableObject* detachObject(const String& name); 00133 00136 virtual void detachAllObjects(void); 00137 00142 void attachLight(Light* l); 00143 00148 void attachCamera(Camera* ent); 00149 00162 virtual void _update(bool updateChildren, bool parentHasChanged); 00163 00180 virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue, 00181 bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false); 00182 00188 virtual AxisAlignedBox _getWorldAABB(void) const; 00189 00200 virtual ObjectIterator getAttachedObjectIterator(void); 00201 00202 00208 SceneManager* getCreator(void) const; 00209 00220 virtual void removeAndDestroyChild(const String& name); 00221 00232 virtual void removeAndDestroyChild(unsigned short index); 00233 00240 virtual void removeAndDestroyAllChildren(void); 00241 00246 virtual void showBoundingBox(bool bShow); 00247 00250 virtual void _addBoundingBoxToQueue(RenderQueue* queue); 00251 00259 virtual bool getShowBoundingBox() const; 00260 00267 virtual SceneNode* createChildSceneNode( 00268 const Vector3& translate = Vector3::ZERO, 00269 const Quaternion& rotate = Quaternion::IDENTITY ); 00270 00280 virtual SceneNode* createChildSceneNode(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY); 00281 00289 const LightList& getLights(void) const; 00290 00305 void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y ); 00306 00317 void setDirection(Real x, Real y, Real z, 00318 TransformSpace relativeTo = TS_LOCAL, 00319 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 00320 00331 void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL, 00332 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 00339 void lookAt( const Vector3& targetPoint, TransformSpace relativeTo, 00340 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 00359 void setAutoTracking(bool enabled, SceneNode* target = 0, 00360 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z, 00361 const Vector3& offset = Vector3::ZERO); 00363 SceneNode* getAutoTrackTarget(void) { return mAutoTrackTarget; } 00365 const Vector3& getAutoTrackOffset(void) { return mAutoTrackOffset; } 00367 const Vector3& getAutoTrackLocalDirection(void) { return mAutoTrackLocalDirection; } 00369 void _autoTrack(void); 00370 00371 00372 00373 }; 00374 00375 00376 }// namespace 00377 00378 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:44 2004