OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreSceneNode.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef _SceneNode_H__
29 #define _SceneNode_H__
30 
31 #include "OgrePrerequisites.h"
32 
33 #include "OgreNode.h"
34 #include "OgreIteratorWrappers.h"
35 #include "OgreAxisAlignedBox.h"
36 
37 namespace Ogre {
38 
39  // forward decl
40  struct VisibleObjectsBoundsInfo;
41 
57  class _OgreExport SceneNode : public Node
58  {
59  public:
60  typedef HashMap<String, MovableObject*> ObjectMap;
63 
64  protected:
66 
72 
75 
78 
80  void updateFromParentImpl(void) const;
81 
83  Node* createChildImpl(void);
84 
86  Node* createChildImpl(const String& name);
87 
89  void setParent(Node* parent);
90 
94  virtual void setInSceneGraph(bool inGraph);
95 
97  bool mYawFixed;
100 
109  public:
114  SceneNode(SceneManager* creator);
119  SceneNode(SceneManager* creator, const String& name);
120  ~SceneNode();
121 
127  virtual void attachObject(MovableObject* obj);
128 
131  virtual unsigned short numAttachedObjects(void) const;
132 
137  virtual MovableObject* getAttachedObject(unsigned short index);
138 
142  virtual MovableObject* getAttachedObject(const String& name);
143 
149  virtual MovableObject* detachObject(unsigned short index);
151  virtual void detachObject(MovableObject* obj);
152 
154  virtual MovableObject* detachObject(const String& name);
155 
158  virtual void detachAllObjects(void);
159 
163  virtual bool isInSceneGraph(void) const { return mIsInSceneGraph; }
164 
169  virtual void _notifyRootNode(void) { mIsInSceneGraph = true; }
170 
171 
184  virtual void _update(bool updateChildren, bool parentHasChanged);
185 
188  virtual void _updateBounds(void);
189 
208  virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue,
209  VisibleObjectsBoundsInfo* visibleBounds,
210  bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false);
211 
217  virtual const AxisAlignedBox& _getWorldAABB(void) const;
218 
229  virtual ObjectIterator getAttachedObjectIterator(void);
240  virtual ConstObjectIterator getAttachedObjectIterator(void) const;
241 
247  SceneManager* getCreator(void) const { return mCreator; }
248 
259  virtual void removeAndDestroyChild(const String& name);
260 
271  virtual void removeAndDestroyChild(unsigned short index);
272 
279  virtual void removeAndDestroyAllChildren(void);
280 
285  virtual void showBoundingBox(bool bShow);
286 
292  virtual void hideBoundingBox(bool bHide);
293 
296  virtual void _addBoundingBoxToQueue(RenderQueue* queue);
297 
305  virtual bool getShowBoundingBox() const;
306 
313  virtual SceneNode* createChildSceneNode(
314  const Vector3& translate = Vector3::ZERO,
315  const Quaternion& rotate = Quaternion::IDENTITY );
316 
326  virtual SceneNode* createChildSceneNode(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
327 
344  virtual void findLights(LightList& destList, Real radius, uint32 lightMask = 0xFFFFFFFF) const;
345 
360  virtual void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y );
361 
364  virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
375  virtual void setDirection(Real x, Real y, Real z,
376  TransformSpace relativeTo = TS_LOCAL,
377  const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
378 
389  virtual void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL,
390  const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
397  virtual void lookAt( const Vector3& targetPoint, TransformSpace relativeTo,
398  const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
417  virtual void setAutoTracking(bool enabled, SceneNode* target = 0,
418  const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z,
419  const Vector3& offset = Vector3::ZERO);
421  virtual SceneNode* getAutoTrackTarget(void) { return mAutoTrackTarget; }
423  virtual const Vector3& getAutoTrackOffset(void) { return mAutoTrackOffset; }
425  virtual const Vector3& getAutoTrackLocalDirection(void) { return mAutoTrackLocalDirection; }
427  void _autoTrack(void);
429  SceneNode* getParentSceneNode(void) const;
438  virtual void setVisible(bool visible, bool cascade = true);
446  virtual void flipVisibility(bool cascade = true);
447 
457  virtual void setDebugDisplayEnabled(bool enabled, bool cascade = true);
458 
460  virtual DebugRenderable* getDebugRenderable();
461 
462 
463 
464 
465  };
470 }// namespace
471 
472 #endif
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:85
virtual const Vector3 & getAutoTrackOffset(void)
Get the auto tracking offset for this node, if the node is auto tracking.
float Real
Software floating point type.
unsigned int uint32
Definition: OgrePlatform.h:246
WireBoundingBox * mWireBoundingBox
Pointer to a Wire Bounding Box for this Node.
Definition: OgreSceneNode.h:68
#define _OgreExport
Definition: OgrePlatform.h:203
ObjectMap mObjectsByName
Definition: OgreSceneNode.h:65
MapIterator< ObjectMap > ObjectIterator
Definition: OgreSceneNode.h:61
Manages the organisation and rendering of a 'scene' i.e.
virtual bool isInSceneGraph(void) const
Determines whether this node is in the scene graph, i.e.
static const Vector3 ZERO
Definition: OgreVector3.h:774
A 3D box aligned with the x/y/z axes.
Vector3 mAutoTrackLocalDirection
Local 'normal' direction vector.
Abstract class defining a movable object in a scene.
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:57
Implementation of a Quaternion, i.e.
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
static const Quaternion IDENTITY
static const Vector3 NEGATIVE_UNIT_Z
Definition: OgreVector3.h:780
bool mShowBoundingBox
Flag that determines if the bounding box of the node should be displayed.
Definition: OgreSceneNode.h:70
virtual const Vector3 & getAutoTrackLocalDirection(void)
Get the auto tracking local direction for this node, if it is auto tracking.
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
Allows the rendering of a wireframe bounding box.
HashMap< String, MovableObject * > ObjectMap
Definition: OgreSceneNode.h:60
SceneNode * mAutoTrackTarget
Auto tracking target.
virtual void _notifyRootNode(void)
Notifies this SceneNode that it is the root scene node.
AxisAlignedBox mWorldAABB
World-Axis aligned bounding box, updated only through _update.
Definition: OgreSceneNode.h:77
ConstMapIterator< ObjectMap > ConstObjectIterator
Definition: OgreSceneNode.h:62
Vector3 mAutoTrackOffset
Tracking offset for fine tuning.
bool mIsInSceneGraph
Is this node a current part of the scene graph?
Wrapper class which indicates a given angle value is in Radians.
Definition: OgreMath.h:46
virtual SceneNode * getAutoTrackTarget(void)
Get the auto tracking target for this node, if any.
Class to manage the scene object rendering queue.
Concrete IteratorWrapper for const access to the underlying key-value container.
static const Vector3 UNIT_Y
Definition: OgreVector3.h:776
_StringBase String
bool mYawFixed
Whether to yaw around a fixed axis.
Definition: OgreSceneNode.h:97
SceneManager * mCreator
SceneManager which created this node.
Definition: OgreSceneNode.h:74
Vector3 mYawFixedAxis
Fixed axis to yaw around.
Definition: OgreSceneNode.h:99
Structure collecting together information about the visible objects that have been discovered in a sc...
Class representing a general-purpose node an articulated scene graph.
Definition: OgreNode.h:62
SceneManager * getCreator(void) const
Gets the creator of this scene node.