OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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-2014 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 "OgreHeaderPrefix.h"
35 
36 namespace Ogre {
37 
53  class _OgreExport SceneNode : public Node
54  {
55  public:
59 
60  protected:
62 
65 
67  Node* createChildImpl( SceneMemoryMgrTypes sceneType );
68 
70  bool mYawFixed;
73 
78  ObjectVec::iterator getAttachedObjectIt( const String& name );
79  ObjectVec::const_iterator getAttachedObjectIt( const String& name ) const;
80  public:
82  SceneNode( IdType id, SceneManager* creator, NodeMemoryManager *nodeMemoryManager,
83  SceneNode *parent );
84 
88  SceneNode( const Transform &transformPtrs );
89 
90  virtual ~SceneNode();
91 
93  virtual bool setStatic( bool bStatic );
94 
96  virtual void _notifyStaticDirty(void) const;
97 
103  virtual_l2 void attachObject(MovableObject* obj);
104 
107  size_t numAttachedObjects(void) const { return mAttachments.size(); }
108 
113  MovableObject* getAttachedObject( size_t index ) { return mAttachments[index]; }
114 
119  MovableObject* getAttachedObject( const String& name );
120 
125  virtual_l2 void detachObject(MovableObject* obj);
126 
129  virtual void detachAllObjects(void);
130 
132  virtual void _callMemoryChangeListeners(void);
133 
144  virtual ObjectIterator getAttachedObjectIterator(void);
155  virtual ConstObjectIterator getAttachedObjectIterator(void) const;
156 
162  SceneManager* getCreator(void) const { return mCreator; }
163 
176  virtual void removeAndDestroyChild( SceneNode *sceneNode );
177 
184  virtual void removeAndDestroyAllChildren(void);
185 
192  virtual SceneNode* createChildSceneNode(
194  const Vector3& translate = Vector3::ZERO,
195  const Quaternion& rotate = Quaternion::IDENTITY );
196 
197  virtual void setListener( Listener* listener );
198 
213  void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y );
214 
215  bool isYawFixed(void) const { return mYawFixed; }
216 
219  void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
230  virtual void setDirection(Real x, Real y, Real z,
231  TransformSpace relativeTo = TS_LOCAL,
232  const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
233 
244  virtual void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL,
245  const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
252  virtual void lookAt( const Vector3& targetPoint, TransformSpace relativeTo,
253  const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
272  virtual void setAutoTracking(bool enabled, SceneNode* const target = 0,
273  const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z,
274  const Vector3& offset = Vector3::ZERO);
275 
277  SceneNode* getParentSceneNode(void) const;
286  virtual void setVisible(bool visible, bool cascade = true);
294  virtual void flipVisibility(bool cascade = true);
295 
305  virtual void setDebugDisplayEnabled(bool enabled, bool cascade = true);
306 
308  //virtual DebugRenderable* getDebugRenderable();
309 
310 #ifndef NDEBUG
311  virtual void _setCachedTransformOutOfDate(void);
312 #endif
313  };
318 }// namespace
319 
320 #include "OgreHeaderSuffix.h"
321 
322 #endif
Represents the transform of a single object, arranged in SoA (Structure of Arrays) ...
Definition: OgreTransform.h:37
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:255
Manages the organisation and rendering of a 'scene' i.e.
static const Vector3 ZERO
Definition: OgreVector3.h:807
#define virtual_l2
Definition: OgrePlatform.h:379
bool isYawFixed(void) const
Abstract class defining a movable object in a scene.
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:53
Implementation of a Quaternion, i.e.
static const Quaternion IDENTITY
static const Vector3 NEGATIVE_UNIT_Z
Definition: OgreVector3.h:813
Ogre::uint32 IdType
Big projects with lots, lots of units for very long periods of time (MMORPGs?) may want to define thi...
Definition: OgreId.h:36
Concrete IteratorWrapper for const access to the underlying container.
Standard 3-dimensional vector.
Definition: OgreVector3.h:50
vector< MovableObject * >::type ObjectVec
Definition: OgreSceneNode.h:56
size_t numAttachedObjects(void) const
Reports the number of objects attached to this node.
ObjectVec mAttachments
Definition: OgreSceneNode.h:61
ConstVectorIterator< ObjectVec > ConstObjectIterator
Definition: OgreSceneNode.h:58
Wrapper class which indicates a given angle value is in Radians.
Definition: OgreMath.h:49
SceneMemoryMgrTypes
The types of NodeMemoryManager & ObjectMemoryManagers.
Definition: OgreCommon.h:318
static const Vector3 UNIT_Y
Definition: OgreVector3.h:809
_StringBase String
Definition: OgreCommon.h:53
VectorIterator< ObjectVec > ObjectIterator
Definition: OgreSceneNode.h:57
MovableObject * getAttachedObject(size_t index)
Retrieves a pointer to an attached object.
bool mYawFixed
Whether to yaw around a fixed axis.
Definition: OgreSceneNode.h:70
SceneManager * mCreator
SceneManager which created this node.
Definition: OgreSceneNode.h:64
Concrete IteratorWrapper for nonconst access to the underlying container.
Vector3 mYawFixedAxis
Fixed axis to yaw around.
Definition: OgreSceneNode.h:72
Class representing a general-purpose node an articulated scene graph.
Definition: OgreNode.h:58
SceneManager * getCreator(void) const
Gets the creator of this scene node.
Wrap-around class that contains multiple ArrayMemoryManager, one per hierarchy depth.