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-2013 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 #include "OgreHeaderPrefix.h"
37 
38 namespace Ogre {
39 
40  // forward decl
41  struct VisibleObjectsBoundsInfo;
42 
58  class _OgreExport SceneNode : public Node
59  {
60  public:
61  typedef HashMap<String, MovableObject*> ObjectMap;
64 
65  protected:
67 
73 
76 
79 
81  void updateFromParentImpl(void) const;
82 
84  Node* createChildImpl(void);
85 
87  Node* createChildImpl(const String& name);
88 
90  void setParent(Node* parent);
91 
95  virtual void setInSceneGraph(bool inGraph);
96 
98  bool mYawFixed;
101 
110  public:
115  SceneNode(SceneManager* creator);
120  SceneNode(SceneManager* creator, const String& name);
121  ~SceneNode();
122 
128  virtual void attachObject(MovableObject* obj);
129 
132  virtual unsigned short numAttachedObjects(void) const;
133 
138  virtual MovableObject* getAttachedObject(unsigned short index);
139 
143  virtual MovableObject* getAttachedObject(const String& name);
144 
150  virtual MovableObject* detachObject(unsigned short index);
152  virtual void detachObject(MovableObject* obj);
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 
209  virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue,
210  VisibleObjectsBoundsInfo* visibleBounds,
211  bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false);
212 
218  virtual const AxisAlignedBox& _getWorldAABB(void) const;
219 
230  virtual ObjectIterator getAttachedObjectIterator(void);
241  virtual ConstObjectIterator getAttachedObjectIterator(void) const;
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 
297  virtual void _addBoundingBoxToQueue(RenderQueue* queue);
298 
306  virtual bool getShowBoundingBox() const;
307 
314  virtual SceneNode* createChildSceneNode(
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);
398  virtual void lookAt( const Vector3& targetPoint, TransformSpace relativeTo,
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);
430  SceneNode* getParentSceneNode(void) const;
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 
461  virtual DebugRenderable* getDebugRenderable();
462 
463 
464 
465 
466  };
471 }// namespace
472 
473 #include "OgreHeaderSuffix.h"
474 
475 #endif
OgreHeaderSuffix.h
Ogre::HashedVector< Light * >
Ogre::Vector3::UNIT_Y
static const Vector3 UNIT_Y
Definition: OgreVector3.h:802
Ogre::SceneNode::mAutoTrackTarget
SceneNode * mAutoTrackTarget
Auto tracking target.
Definition: OgreSceneNode.h:103
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::Vector3::ZERO
static const Vector3 ZERO
Definition: OgreVector3.h:800
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
Ogre::SceneNode::mHideBoundingBox
bool mHideBoundingBox
Definition: OgreSceneNode.h:72
Ogre::MovableObject
Abstract class defining a movable object in a scene.
Definition: OgreMovableObject.h:60
Ogre::SceneNode::mObjectsByName
ObjectMap mObjectsByName
Definition: OgreSceneNode.h:66
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::VisibleObjectsBoundsInfo
Structure collecting together information about the visible objects that have been discovered in a sc...
Definition: OgreSceneManager.h:86
Ogre::SceneNode::ObjectIterator
MapIterator< ObjectMap > ObjectIterator
Definition: OgreSceneNode.h:62
Ogre::WireBoundingBox
Allows the rendering of a wireframe bounding box.
Definition: OgreWireBoundingBox.h:48
Ogre::SceneNode
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:58
Ogre::SceneNode::mShowBoundingBox
bool mShowBoundingBox
Flag that determines if the bounding box of the node should be displayed.
Definition: OgreSceneNode.h:71
Ogre::SceneNode::getCreator
SceneManager * getCreator(void) const
Gets the creator of this scene node.
Definition: OgreSceneNode.h:248
Ogre::SceneNode::mYawFixed
bool mYawFixed
Whether to yaw around a fixed axis.
Definition: OgreSceneNode.h:98
Ogre::Quaternion
Implementation of a Quaternion, i.e.
Definition: OgreQuaternion.h:57
OgreHeaderPrefix.h
Ogre::SceneManager
Manages the organisation and rendering of a 'scene' i.e.
Definition: OgreSceneManager.h:143
Ogre::SceneNode::mAutoTrackOffset
Vector3 mAutoTrackOffset
Tracking offset for fine tuning.
Definition: OgreSceneNode.h:105
OgrePrerequisites.h
Ogre::SceneNode::ObjectMap
HashMap< String, MovableObject * > ObjectMap
Definition: OgreSceneNode.h:61
Ogre::SceneNode::ConstObjectIterator
ConstMapIterator< ObjectMap > ConstObjectIterator
Definition: OgreSceneNode.h:63
Ogre::Radian
Wrapper class which indicates a given angle value is in Radians.
Definition: OgreMath.h:47
Ogre::SceneNode::mAutoTrackLocalDirection
Vector3 mAutoTrackLocalDirection
Local 'normal' direction vector.
Definition: OgreSceneNode.h:107
Ogre::AxisAlignedBox
A 3D box aligned with the x/y/z axes.
Definition: OgreAxisAlignedBox.h:54
Ogre::SceneNode::mWorldAABB
AxisAlignedBox mWorldAABB
World-Axis aligned bounding box, updated only through _update.
Definition: OgreSceneNode.h:78
Ogre::MapIterator
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
Definition: OgreIteratorWrapper.h:319
OgreNode.h
OgreIteratorWrappers.h
Ogre::Vector3::NEGATIVE_UNIT_Z
static const Vector3 NEGATIVE_UNIT_Z
Definition: OgreVector3.h:806
Ogre::SceneNode::getAutoTrackOffset
virtual const Vector3 & getAutoTrackOffset(void)
Get the auto tracking offset for this node, if the node is auto tracking.
Definition: OgreSceneNode.h:424
Ogre::SceneNode::_notifyRootNode
virtual void _notifyRootNode(void)
Notifies this SceneNode that it is the root scene node.
Definition: OgreSceneNode.h:170
Ogre::SceneNode::mWireBoundingBox
WireBoundingBox * mWireBoundingBox
Pointer to a Wire Bounding Box for this Node.
Definition: OgreSceneNode.h:69
Ogre::Quaternion::IDENTITY
static const Quaternion IDENTITY
Definition: OgreQuaternion.h:301
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::ConstMapIterator
Concrete IteratorWrapper for const access to the underlying key-value container.
Definition: OgreIteratorWrapper.h:352
Ogre::SceneNode::getAutoTrackLocalDirection
virtual const Vector3 & getAutoTrackLocalDirection(void)
Get the auto tracking local direction for this node, if it is auto tracking.
Definition: OgreSceneNode.h:426
OgreAxisAlignedBox.h
Ogre::SceneNode::mYawFixedAxis
Vector3 mYawFixedAxis
Fixed axis to yaw around.
Definition: OgreSceneNode.h:100
Ogre::Node
Class representing a general-purpose node an articulated scene graph.
Definition: OgreNode.h:64
Ogre::SceneNode::mIsInSceneGraph
bool mIsInSceneGraph
Is this node a current part of the scene graph?
Definition: OgreSceneNode.h:109
Ogre::SceneNode::mCreator
SceneManager * mCreator
SceneManager which created this node.
Definition: OgreSceneNode.h:75
Ogre::SceneNode::getAutoTrackTarget
virtual SceneNode * getAutoTrackTarget(void)
Get the auto tracking target for this node, if any.
Definition: OgreSceneNode.h:422
Ogre::Vector3
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
Ogre::SceneNode::isInSceneGraph
virtual bool isInSceneGraph(void) const
Determines whether this node is in the scene graph, i.e.
Definition: OgreSceneNode.h:164
Ogre::RenderQueue
Class to manage the scene object rendering queue.
Definition: OgreRenderQueue.h:92

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Apr 13 2021 08:53:15