# 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-2009 Torus Knot Software Ltd
    00008
    00009 Permission is hereby granted, free of charge, to any person obtaining a copy
    00010 of this software and associated documentation files (the "Software"), to deal
    00011 in the Software without restriction, including without limitation the rights
    00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00013 copies of the Software, and to permit persons to whom the Software is
    00014 furnished to do so, subject to the following conditions:
    00015
    00016 The above copyright notice and this permission notice shall be included in
    00017 all copies or substantial portions of the Software.
    00018
    00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    00025 THE SOFTWARE.
    00026 -----------------------------------------------------------------------------
    00027 */
    00028 #ifndef _SceneNode_H__
    00029 #define _SceneNode_H__
    00030
    00031 #include "OgrePrerequisites.h"
    00032
    00033 #include "OgreNode.h"
    00034 #include "OgreIteratorWrappers.h"
    00035 #include "OgreAxisAlignedBox.h"
    00036
    00037 namespace Ogre {
    00038
    00039     // forward decl
    00040     struct VisibleObjectsBoundsInfo;
    00041
    00057     class _OgreExport SceneNode : public Node
    00058     {
    00059     public:
    00060         typedef HashMap<String, MovableObject*> ObjectMap;
    00061         typedef MapIterator<ObjectMap> ObjectIterator;
    00062         typedef ConstMapIterator<ObjectMap> ConstObjectIterator;
    00063
    00064     protected:
    00065         ObjectMap mObjectsByName;
    00066
    00068         WireBoundingBox *mWireBoundingBox;
    00070         bool mShowBoundingBox;
    00071         bool mHideBoundingBox;
    00072
    00074         SceneManager* mCreator;
    00075
    00077         AxisAlignedBox mWorldAABB;
    00078
    00080         void updateFromParentImpl(void) const;
    00081
    00083         Node* createChildImpl(void);
    00084
    00086         Node* createChildImpl(const String& name);
    00087
    00089         void setParent(Node* parent);
    00090
    00094         virtual void setInSceneGraph(bool inGraph);
    00095
    00097         bool mYawFixed;
    00099         Vector3 mYawFixedAxis;
    00100
    00102         SceneNode* mAutoTrackTarget;
    00104         Vector3 mAutoTrackOffset;
    00106         Vector3 mAutoTrackLocalDirection;
    00108         bool mIsInSceneGraph;
    00109     public:
    00114         SceneNode(SceneManager* creator);
    00119         SceneNode(SceneManager* creator, const String& name);
    00120         ~SceneNode();
    00121
    00127         virtual void attachObject(MovableObject* obj);
    00128
    00131         virtual unsigned short numAttachedObjects(void) const;
    00132
    00137         virtual MovableObject* getAttachedObject(unsigned short index);
    00138
    00142         virtual MovableObject* getAttachedObject(const String& name);
    00143
    00149         virtual MovableObject* detachObject(unsigned short index);
    00151         virtual void detachObject(MovableObject* obj);
    00152
    00154         virtual MovableObject* detachObject(const String& name);
    00155
    00158         virtual void detachAllObjects(void);
    00159
    00163         virtual bool isInSceneGraph(void) const { return mIsInSceneGraph; }
    00164
    00169         virtual void _notifyRootNode(void) { mIsInSceneGraph = true; }
    00170
    00171
    00184         virtual void _update(bool updateChildren, bool parentHasChanged);
    00185
    00188         virtual void _updateBounds(void);
    00189
    00208         virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue,
    00209             VisibleObjectsBoundsInfo* visibleBounds,
    00210             bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false);
    00211
    00217         virtual const AxisAlignedBox& _getWorldAABB(void) const;
    00218
    00229         virtual ObjectIterator getAttachedObjectIterator(void);
    00240         virtual ConstObjectIterator getAttachedObjectIterator(void) const;
    00241
    00247         SceneManager* getCreator(void) const { return mCreator; }
    00248
    00259         virtual void removeAndDestroyChild(const String& name);
    00260
    00271         virtual void removeAndDestroyChild(unsigned short index);
    00272
    00279         virtual void removeAndDestroyAllChildren(void);
    00280
    00285         virtual void showBoundingBox(bool bShow);
    00286
    00292         virtual void hideBoundingBox(bool bHide);
    00293
    00296         virtual void _addBoundingBoxToQueue(RenderQueue* queue);
    00297
    00305         virtual bool getShowBoundingBox() const;
    00306
    00313         virtual SceneNode* createChildSceneNode(
    00314             const Vector3& translate = Vector3::ZERO,
    00315             const Quaternion& rotate = Quaternion::IDENTITY );
    00316
    00326         virtual SceneNode* createChildSceneNode(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
    00327
    00344         virtual void findLights(LightList& destList, Real radius, uint32 lightMask = 0xFFFFFFFF) const;
    00345
    00360         virtual void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y );
    00361
    00364         virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
    00375         virtual void setDirection(Real x, Real y, Real z,
    00376             TransformSpace relativeTo = TS_LOCAL,
    00377             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    00378
    00389         virtual void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL,
    00390             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    00397         virtual void lookAt( const Vector3& targetPoint, TransformSpace relativeTo,
    00398             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    00417         virtual void setAutoTracking(bool enabled, SceneNode* target = 0,
    00418             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z,
    00419             const Vector3& offset = Vector3::ZERO);
    00421         virtual SceneNode* getAutoTrackTarget(void) { return mAutoTrackTarget; }
    00423         virtual const Vector3& getAutoTrackOffset(void) { return mAutoTrackOffset; }
    00425         virtual const Vector3& getAutoTrackLocalDirection(void) { return mAutoTrackLocalDirection; }
    00427         void _autoTrack(void);
    00429         SceneNode* getParentSceneNode(void) const;
    00438         virtual void setVisible(bool visible, bool cascade = true);
    00446         virtual void flipVisibility(bool cascade = true);
    00447
    00457         virtual void setDebugDisplayEnabled(bool enabled, bool cascade = true);
    00458
    00460         virtual DebugRenderable* getDebugRenderable();
    00461
    00462
    00463
    00464
    00465     };
    00470 }// namespace
    00471
    00472 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun May 8 2011 20:28:09