Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OgreSceneNode.h

Go to the documentation of this file.
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 
00070         virtual void _updateBounds(void);
00071 
00073         Node* createChildImpl(void);
00074 
00076         Node* createChildImpl(const String& name);
00077 
00079         void setParent(Node* parent);
00080 
00084         void setInSceneGraph(bool inGraph);
00085 
00087         bool mYawFixed;
00089         Vector3 mYawFixedAxis;
00090 
00092         SceneNode* mAutoTrackTarget;
00094         Vector3 mAutoTrackOffset;
00096         Vector3 mAutoTrackLocalDirection;
00098         bool mIsInSceneGraph;
00099     public:
00104         SceneNode(SceneManager* creator);
00109         SceneNode(SceneManager* creator, const String& name);
00110         ~SceneNode();
00111 
00117         virtual void attachObject(MovableObject* obj);
00118 
00121         virtual unsigned short numAttachedObjects(void) const;
00122 
00127         virtual MovableObject* getAttachedObject(unsigned short index);
00128 
00132         virtual MovableObject* getAttachedObject(const String& name);
00133 
00139         virtual MovableObject* detachObject(unsigned short index);
00141         virtual void detachObject(MovableObject* obj);
00142 
00144         virtual MovableObject* detachObject(const String& name);
00145 
00148         virtual void detachAllObjects(void);
00149 
00153         virtual bool isInSceneGraph(void) const { return mIsInSceneGraph; }
00154 
00159         virtual void _notifyRootNode(void) { mIsInSceneGraph = true; }
00160             
00161 
00174         virtual void _update(bool updateChildren, bool parentHasChanged);
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
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 12:59:52 2006