# 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-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef _SceneNode_H__
    00030 #define _SceneNode_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033
    00034 #include "OgreNode.h"
    00035 #include "OgreIteratorWrappers.h"
    00036 #include "OgreAxisAlignedBox.h"
    00037
    00038 namespace Ogre {
    00039
    00040     // forward decl
    00041     struct VisibleObjectsBoundsInfo;
    00042
    00052     class _OgreExport SceneNode : public Node
    00053     {
    00054     public:
    00055         typedef HashMap<String, MovableObject*> ObjectMap;
    00056         typedef MapIterator<ObjectMap> ObjectIterator;
    00057         typedef ConstMapIterator<ObjectMap> ConstObjectIterator;
    00058
    00059     protected:
    00060         ObjectMap mObjectsByName;
    00061
    00063         WireBoundingBox *mWireBoundingBox;
    00065         bool mShowBoundingBox;
    00066
    00068         SceneManager* mCreator;
    00069
    00071         AxisAlignedBox mWorldAABB;
    00072
    00074         void updateFromParentImpl(void) const;
    00075
    00077         Node* createChildImpl(void);
    00078
    00080         Node* createChildImpl(const String& name);
    00081
    00083         void setParent(Node* parent);
    00084
    00088         virtual void setInSceneGraph(bool inGraph);
    00089
    00091         bool mYawFixed;
    00093         Vector3 mYawFixedAxis;
    00094
    00096         SceneNode* mAutoTrackTarget;
    00098         Vector3 mAutoTrackOffset;
    00100         Vector3 mAutoTrackLocalDirection;
    00102         bool mIsInSceneGraph;
    00103     public:
    00108         SceneNode(SceneManager* creator);
    00113         SceneNode(SceneManager* creator, const String& name);
    00114         ~SceneNode();
    00115
    00121         virtual void attachObject(MovableObject* obj);
    00122
    00125         virtual unsigned short numAttachedObjects(void) const;
    00126
    00131         virtual MovableObject* getAttachedObject(unsigned short index);
    00132
    00136         virtual MovableObject* getAttachedObject(const String& name);
    00137
    00143         virtual MovableObject* detachObject(unsigned short index);
    00145         virtual void detachObject(MovableObject* obj);
    00146
    00148         virtual MovableObject* detachObject(const String& name);
    00149
    00152         virtual void detachAllObjects(void);
    00153
    00157         virtual bool isInSceneGraph(void) const { return mIsInSceneGraph; }
    00158
    00163         virtual void _notifyRootNode(void) { mIsInSceneGraph = true; }
    00164
    00165
    00178         virtual void _update(bool updateChildren, bool parentHasChanged);
    00179
    00182         virtual void _updateBounds(void);
    00183
    00202         virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue,
    00203             VisibleObjectsBoundsInfo* visibleBounds,
    00204             bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false);
    00205
    00211         virtual const AxisAlignedBox& _getWorldAABB(void) const;
    00212
    00223         virtual ObjectIterator getAttachedObjectIterator(void);
    00234         virtual ConstObjectIterator getAttachedObjectIterator(void) const;
    00235
    00241         SceneManager* getCreator(void) const { return mCreator; }
    00242
    00253         virtual void removeAndDestroyChild(const String& name);
    00254
    00265         virtual void removeAndDestroyChild(unsigned short index);
    00266
    00273         virtual void removeAndDestroyAllChildren(void);
    00274
    00279         virtual void showBoundingBox(bool bShow);
    00280
    00283         virtual void _addBoundingBoxToQueue(RenderQueue* queue);
    00284
    00292         virtual bool getShowBoundingBox() const;
    00293
    00300         virtual SceneNode* createChildSceneNode(
    00301             const Vector3& translate = Vector3::ZERO,
    00302             const Quaternion& rotate = Quaternion::IDENTITY );
    00303
    00313         virtual SceneNode* createChildSceneNode(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
    00314
    00330         virtual void findLights(LightList& destList, Real radius) const;
    00331
    00346         virtual void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y );
    00347
    00350         virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
    00361         virtual void setDirection(Real x, Real y, Real z,
    00362             TransformSpace relativeTo = TS_LOCAL,
    00363             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    00364
    00375         virtual void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL,
    00376             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    00383         virtual void lookAt( const Vector3& targetPoint, TransformSpace relativeTo,
    00384             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    00403         virtual void setAutoTracking(bool enabled, SceneNode* target = 0,
    00404             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z,
    00405             const Vector3& offset = Vector3::ZERO);
    00407         virtual SceneNode* getAutoTrackTarget(void) { return mAutoTrackTarget; }
    00409         virtual const Vector3& getAutoTrackOffset(void) { return mAutoTrackOffset; }
    00411         virtual const Vector3& getAutoTrackLocalDirection(void) { return mAutoTrackLocalDirection; }
    00413         void _autoTrack(void);
    00415         SceneNode* getParentSceneNode(void) const;
    00424         virtual void setVisible(bool visible, bool cascade = true);
    00432         virtual void flipVisibility(bool cascade = true);
    00433
    00443         virtual void setDebugDisplayEnabled(bool enabled, bool cascade = true);
    00444
    00445
    00446
    00447
    00448     };
    00449
    00450
    00451 }// namespace
    00452
    00453 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jul 26 11:32:20 2009