OGRE  1.9.0
OgreSceneNode.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef _SceneNode_H__
29#define _SceneNode_H__
30
31#include "OgrePrerequisites.h"
32
33#include "OgreNode.h"
35#include "OgreAxisAlignedBox.h"
36#include "OgreHeaderPrefix.h"
37
38namespace Ogre {
39
40 // forward decl
41 struct VisibleObjectsBoundsInfo;
42
58 class _OgreExport SceneNode : public Node
59 {
60 public:
64
65 protected:
67
73
76
79
81 void updateFromParentImpl(void) const;
82
85
88
90 void setParent(Node* parent);
91
95 virtual void setInSceneGraph(bool inGraph);
96
101
110 public:
122
129
132 virtual unsigned short numAttachedObjects(void) const;
133
138 virtual MovableObject* getAttachedObject(unsigned short index);
139
144
150 virtual MovableObject* detachObject(unsigned short index);
153
155 virtual MovableObject* detachObject(const String& name);
156
159 virtual void detachAllObjects(void);
160
164 virtual bool isInSceneGraph(void) const { return mIsInSceneGraph; }
165
170 virtual void _notifyRootNode(void) { mIsInSceneGraph = true; }
171
172
185 virtual void _update(bool updateChildren, bool parentHasChanged);
186
189 virtual void _updateBounds(void);
190
211 bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false);
212
218 virtual const AxisAlignedBox& _getWorldAABB(void) const;
219
242
248 SceneManager* getCreator(void) const { return mCreator; }
249
260 virtual void removeAndDestroyChild(const String& name);
261
272 virtual void removeAndDestroyChild(unsigned short index);
273
280 virtual void removeAndDestroyAllChildren(void);
281
286 virtual void showBoundingBox(bool bShow);
287
293 virtual void hideBoundingBox(bool bHide);
294
298
306 virtual bool getShowBoundingBox() const;
307
315 const Vector3& translate = Vector3::ZERO,
316 const Quaternion& rotate = Quaternion::IDENTITY );
317
327 virtual SceneNode* createChildSceneNode(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
328
345 virtual void findLights(LightList& destList, Real radius, uint32 lightMask = 0xFFFFFFFF) const;
346
361 virtual void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y );
362
365 virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
376 virtual void setDirection(Real x, Real y, Real z,
377 TransformSpace relativeTo = TS_LOCAL,
378 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
379
390 virtual void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL,
391 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
399 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
418 virtual void setAutoTracking(bool enabled, SceneNode* const target = 0,
419 const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z,
420 const Vector3& offset = Vector3::ZERO);
422 virtual SceneNode* getAutoTrackTarget(void) { return mAutoTrackTarget; }
424 virtual const Vector3& getAutoTrackOffset(void) { return mAutoTrackOffset; }
426 virtual const Vector3& getAutoTrackLocalDirection(void) { return mAutoTrackLocalDirection; }
428 void _autoTrack(void);
439 virtual void setVisible(bool visible, bool cascade = true);
447 virtual void flipVisibility(bool cascade = true);
448
458 virtual void setDebugDisplayEnabled(bool enabled, bool cascade = true);
459
462
463
464
465
466 };
471}// namespace
472
473#include "OgreHeaderSuffix.h"
474
475#endif
#define _OgreExport
A 3D box aligned with the x/y/z axes.
A viewpoint from which the scene will be rendered.
Definition OgreCamera.h:87
Abstract class defining a movable object in a scene.
Inner class for displaying debug renderable for Node.
Definition OgreNode.h:107
Class representing a general-purpose node an articulated scene graph.
Definition OgreNode.h:65
TransformSpace
Enumeration denoting the spaces which a transform can be relative to.
Definition OgreNode.h:70
Implementation of a Quaternion, i.e.
Wrapper class which indicates a given angle value is in Radians.
Definition OgreMath.h:48
Class to manage the scene object rendering queue.
Manages the organisation and rendering of a 'scene' i.e.
Class representing a node in the scene graph.
virtual const Vector3 & getAutoTrackOffset(void)
Get the auto tracking offset for this node, if the node is auto tracking.
virtual MovableObject * detachObject(const String &name)
Detaches the named object from this node and returns a pointer to it.
virtual void detachAllObjects(void)
Detaches all objects attached to this node.
virtual void yaw(const Radian &angle, TransformSpace relativeTo=TS_LOCAL)
Rotate the node around the Y-axis.
MapIterator< ObjectMap > ObjectIterator
virtual void showBoundingBox(bool bShow)
Allows the showing of the node's bounding box.
SceneNode * getParentSceneNode(void) const
Gets the parent of this SceneNode.
virtual SceneNode * getAutoTrackTarget(void)
Get the auto tracking target for this node, if any.
virtual SceneNode * createChildSceneNode(const Vector3 &translate=Vector3::ZERO, const Quaternion &rotate=Quaternion::IDENTITY)
Creates an unnamed new SceneNode as a child of this node.
virtual void _findVisibleObjects(Camera *cam, RenderQueue *queue, VisibleObjectsBoundsInfo *visibleBounds, bool includeChildren=true, bool displayNodes=false, bool onlyShadowCasters=false)
Internal method which locates any visible objects attached to this node and adds them to the passed i...
virtual unsigned short numAttachedObjects(void) const
Reports the number of objects attached to this node.
SceneManager * getCreator(void) const
Gets the creator of this scene node.
virtual void removeAndDestroyAllChildren(void)
Removes and destroys all children of this node.
Node * createChildImpl(void)
See Node.
bool mShowBoundingBox
Flag that determines if the bounding box of the node should be displayed.
virtual void _update(bool updateChildren, bool parentHasChanged)
Internal method to update the Node.
Vector3 mAutoTrackLocalDirection
Local 'normal' direction vector.
Vector3 mYawFixedAxis
Fixed axis to yaw around.
SceneManager * mCreator
SceneManager which created this node.
virtual ConstObjectIterator getAttachedObjectIterator(void) const
Retrieves an iterator which can be used to efficiently step through the objects attached to this node...
virtual void setDirection(Real x, Real y, Real z, TransformSpace relativeTo=TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
Sets the node's direction vector ie it's local -z.
virtual void setFixedYawAxis(bool useFixed, const Vector3 &fixedAxis=Vector3::UNIT_Y)
Tells the node whether to yaw around it's own local Y axis or a fixed axis of choice.
HashMap< String, MovableObject * > ObjectMap
virtual void lookAt(const Vector3 &targetPoint, TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
Points the local -Z direction of this node at a point in space.
virtual void removeAndDestroyChild(unsigned short index)
This method removes and destroys the child and all of its children.
virtual void attachObject(MovableObject *obj)
Adds an instance of a scene object to this node.
virtual void setInSceneGraph(bool inGraph)
Internal method for setting whether the node is in the scene graph.
virtual ObjectIterator getAttachedObjectIterator(void)
Retrieves an iterator which can be used to efficiently step through the objects attached to this node...
virtual bool getShowBoundingBox() const
This allows scene managers to determine if the node's bounding box should be added to the rendering q...
virtual const AxisAlignedBox & _getWorldAABB(void) const
Gets the axis-aligned bounding box of this node (and hence all subnodes).
virtual bool isInSceneGraph(void) const
Determines whether this node is in the scene graph, i.e.
Vector3 mAutoTrackOffset
Tracking offset for fine tuning.
bool mYawFixed
Whether to yaw around a fixed axis.
virtual void _addBoundingBoxToQueue(RenderQueue *queue)
Add the bounding box to the rendering queue.
virtual void setAutoTracking(bool enabled, SceneNode *const target=0, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z, const Vector3 &offset=Vector3::ZERO)
Enables / disables automatic tracking of another SceneNode.
virtual MovableObject * getAttachedObject(unsigned short index)
Retrieves a pointer to an attached object.
virtual void _updateBounds(void)
Tells the SceneNode to update the world bound info it stores.
virtual void setDebugDisplayEnabled(bool enabled, bool cascade=true)
Tells all objects attached to this node whether to display their debug information or not.
ConstMapIterator< ObjectMap > ConstObjectIterator
ObjectMap mObjectsByName
virtual MovableObject * getAttachedObject(const String &name)
Retrieves a pointer to an attached object.
SceneNode(SceneManager *creator, const String &name)
Constructor, only to be called by the creator SceneManager.
void setParent(Node *parent)
See Node.
virtual DebugRenderable * getDebugRenderable()
As Node::getDebugRenderable, except scaling is automatically determined.
Node * createChildImpl(const String &name)
See Node.
AxisAlignedBox mWorldAABB
World-Axis aligned bounding box, updated only through _update.
virtual void flipVisibility(bool cascade=true)
Inverts the visibility of all objects attached to this node.
WireBoundingBox * mWireBoundingBox
Pointer to a Wire Bounding Box for this Node.
virtual void detachObject(MovableObject *obj)
Detaches an object by pointer.
bool mIsInSceneGraph
Is this node a current part of the scene graph?
virtual void hideBoundingBox(bool bHide)
Allows the overriding of the node's bounding box over the SceneManager's bounding box setting.
virtual void removeAndDestroyChild(const String &name)
This method removes and destroys the named child and all of its children.
SceneNode * mAutoTrackTarget
Auto tracking target.
virtual void findLights(LightList &destList, Real radius, uint32 lightMask=0xFFFFFFFF) const
Allows retrieval of the nearest lights to the centre of this SceneNode.
virtual void setVisible(bool visible, bool cascade=true)
Makes all objects attached to this node become visible / invisible.
virtual const Vector3 & getAutoTrackLocalDirection(void)
Get the auto tracking local direction for this node, if it is auto tracking.
virtual void setDirection(const Vector3 &vec, TransformSpace relativeTo=TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
Sets the node's direction vector ie it's local -z.
void _autoTrack(void)
Internal method used by OGRE to update auto-tracking cameras.
virtual SceneNode * createChildSceneNode(const String &name, const Vector3 &translate=Vector3::ZERO, const Quaternion &rotate=Quaternion::IDENTITY)
Creates a new named SceneNode as a child of this node.
virtual void _notifyRootNode(void)
Notifies this SceneNode that it is the root scene node.
SceneNode(SceneManager *creator)
Constructor, only to be called by the creator SceneManager.
void updateFromParentImpl(void) const
Class-specific implementation of _updateFromParent.
virtual MovableObject * detachObject(unsigned short index)
Detaches the indexed object from this scene node.
Reference-counted shared pointer, used for objects where implicit destruction is required.
Standard 3-dimensional vector.
Definition OgreVector3.h:52
Allows the rendering of a wireframe bounding box.
_StringBase String
Structure collecting together information about the visible objects that have been discovered in a sc...