Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound 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 © 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 #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 
00051     protected:
00052         ObjectMap mObjectsByName;
00053         mutable LightList mLightList;
00054         mutable bool mLightListDirty;
00055 
00057         WireBoundingBox *mWireBoundingBox;
00059         bool mShowBoundingBox;
00060 
00062         SceneManager* mCreator;
00063 
00065         AxisAlignedBox mWorldAABB;
00066 
00069         virtual void _updateBounds(void);
00070 
00072         Node* createChildImpl(void);
00073 
00075         Node* createChildImpl(const String& name);
00076 
00078         bool mYawFixed;
00080         Vector3 mYawFixedAxis;
00081 
00083         SceneNode* mAutoTrackTarget;
00085         Vector3 mAutoTrackOffset;
00087         Vector3 mAutoTrackLocalDirection;
00088     public:
00093         SceneNode(SceneManager* creator);
00098         SceneNode(SceneManager* creator, const String& name);
00099         ~SceneNode();
00100 
00106         virtual void attachObject(MovableObject* obj);
00107 
00110         virtual unsigned short numAttachedObjects(void) const;
00111 
00116         virtual MovableObject* getAttachedObject(unsigned short index);
00117 
00121         virtual MovableObject* getAttachedObject(const String& name);
00122 
00128         virtual MovableObject* detachObject(unsigned short index);
00130         virtual void detachObject(MovableObject* obj);
00131 
00133         virtual MovableObject* detachObject(const String& name);
00134 
00137         virtual void detachAllObjects(void);
00138 
00151         virtual void _update(bool updateChildren, bool parentHasChanged);
00152 
00169         virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue, 
00170             bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false);
00171 
00177         virtual AxisAlignedBox _getWorldAABB(void) const;
00178 
00189         virtual ObjectIterator getAttachedObjectIterator(void);
00190 
00191 
00197         SceneManager* getCreator(void) const;
00198 
00209         virtual void removeAndDestroyChild(const String& name);
00210 
00221         virtual void removeAndDestroyChild(unsigned short index);
00222 
00229         virtual void removeAndDestroyAllChildren(void);
00230 
00235         virtual void showBoundingBox(bool bShow);
00236 
00239         virtual void _addBoundingBoxToQueue(RenderQueue* queue);
00240 
00248         virtual bool getShowBoundingBox() const;
00249 
00256         virtual SceneNode* createChildSceneNode(
00257             const Vector3& translate = Vector3::ZERO, 
00258             const Quaternion& rotate = Quaternion::IDENTITY );
00259 
00269         virtual SceneNode* createChildSceneNode(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
00270 
00280         const LightList& findLights(Real radius) const;
00281 
00296         void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y );
00297 
00300         virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
00301 #ifndef OGRE_FORCE_ANGLE_TYPES
00302         inline void yaw(Real degrees, TransformSpace relativeTo = TS_LOCAL) {
00303             yaw ( Angle(degrees), relativeTo );
00304         }
00305 #endif//OGRE_FORCE_ANGLE_TYPES
00306 
00316         void setDirection(Real x, Real y, Real z, 
00317             TransformSpace relativeTo = TS_LOCAL, 
00318             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
00319 
00330         void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL, 
00331             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
00338         void lookAt( const Vector3& targetPoint, TransformSpace relativeTo,
00339             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
00358         void setAutoTracking(bool enabled, SceneNode* target = 0, 
00359             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z,
00360             const Vector3& offset = Vector3::ZERO);
00362         SceneNode* getAutoTrackTarget(void) { return mAutoTrackTarget; }
00364         const Vector3& getAutoTrackOffset(void) { return mAutoTrackOffset; }
00366         const Vector3& getAutoTrackLocalDirection(void) { return mAutoTrackLocalDirection; }
00368         void _autoTrack(void);
00370         SceneNode* getParentSceneNode(void) const;
00379         void setVisible(bool visible, bool cascade = true);
00387         void flipVisibility(bool cascade = true);
00388 
00389 
00390 
00391 
00392 
00393     };
00394 
00395 
00396 }// namespace
00397 
00398 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:45 2004