| [148] | 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 |  | 
|---|
 | 43 |         /** \addtogroup Core | 
|---|
 | 44 |         *  @{ | 
|---|
 | 45 |         */ | 
|---|
 | 46 |         /** \addtogroup Scene | 
|---|
 | 47 |         *  @{ | 
|---|
 | 48 |         */ | 
|---|
 | 49 |         /** Class representing a node in the scene graph. | 
|---|
 | 50 |         @remarks | 
|---|
 | 51 |             A SceneNode is a type of Node which is used to organise objects in a scene. | 
|---|
 | 52 |             It has the same hierarchical transformation properties of the generic Node class, | 
|---|
 | 53 |             but also adds the ability to attach world objects to the node, and stores hierarchical | 
|---|
 | 54 |             bounding volumes of the nodes in the tree. | 
|---|
 | 55 |             Child nodes are contained within the bounds of the parent, and so on down the | 
|---|
 | 56 |             tree, allowing for fast culling. | 
|---|
 | 57 |     */ | 
|---|
 | 58 |     class _OgreExport SceneNode : public Node | 
|---|
 | 59 |     { | 
|---|
 | 60 |     public: | 
|---|
 | 61 |         typedef HashMap<String, MovableObject*> ObjectMap; | 
|---|
 | 62 |         typedef MapIterator<ObjectMap> ObjectIterator; | 
|---|
 | 63 |                 typedef ConstMapIterator<ObjectMap> ConstObjectIterator; | 
|---|
 | 64 |  | 
|---|
 | 65 |     protected: | 
|---|
 | 66 |         ObjectMap mObjectsByName; | 
|---|
 | 67 |  | 
|---|
 | 68 |                 /// Pointer to a Wire Bounding Box for this Node | 
|---|
 | 69 |                 WireBoundingBox *mWireBoundingBox; | 
|---|
 | 70 |                 /// Flag that determines if the bounding box of the node should be displayed | 
|---|
 | 71 |                 bool mShowBoundingBox; | 
|---|
 | 72 |         bool mHideBoundingBox; | 
|---|
 | 73 |  | 
|---|
 | 74 |         /// SceneManager which created this node | 
|---|
 | 75 |         SceneManager* mCreator; | 
|---|
 | 76 |  | 
|---|
 | 77 |         /// World-Axis aligned bounding box, updated only through _update | 
|---|
 | 78 |         AxisAlignedBox mWorldAABB; | 
|---|
 | 79 |  | 
|---|
 | 80 |         /** @copydoc Node::updateFromParentImpl. */ | 
|---|
 | 81 |         void updateFromParentImpl(void) const; | 
|---|
 | 82 |  | 
|---|
 | 83 |         /** See Node. */ | 
|---|
 | 84 |         Node* createChildImpl(void); | 
|---|
 | 85 |  | 
|---|
 | 86 |         /** See Node. */ | 
|---|
 | 87 |         Node* createChildImpl(const String& name); | 
|---|
 | 88 |  | 
|---|
 | 89 |                 /** See Node */ | 
|---|
 | 90 |                 void setParent(Node* parent); | 
|---|
 | 91 |  | 
|---|
 | 92 |                 /** Internal method for setting whether the node is in the scene  | 
|---|
 | 93 |                         graph. | 
|---|
 | 94 |                 */ | 
|---|
 | 95 |                 virtual void setInSceneGraph(bool inGraph); | 
|---|
 | 96 |  | 
|---|
 | 97 |         /// Whether to yaw around a fixed axis. | 
|---|
 | 98 |         bool mYawFixed; | 
|---|
 | 99 |         /// Fixed axis to yaw around | 
|---|
 | 100 |         Vector3 mYawFixedAxis; | 
|---|
 | 101 |  | 
|---|
 | 102 |         /// Auto tracking target | 
|---|
 | 103 |         SceneNode* mAutoTrackTarget; | 
|---|
 | 104 |         /// Tracking offset for fine tuning | 
|---|
 | 105 |         Vector3 mAutoTrackOffset; | 
|---|
 | 106 |         /// Local 'normal' direction vector | 
|---|
 | 107 |         Vector3 mAutoTrackLocalDirection; | 
|---|
 | 108 |                 /// Is this node a current part of the scene graph? | 
|---|
 | 109 |                 bool mIsInSceneGraph; | 
|---|
 | 110 |     public: | 
|---|
 | 111 |         /** Constructor, only to be called by the creator SceneManager. | 
|---|
 | 112 |         @remarks | 
|---|
 | 113 |             Creates a node with a generated name. | 
|---|
 | 114 |         */ | 
|---|
 | 115 |         SceneNode(SceneManager* creator); | 
|---|
 | 116 |         /** Constructor, only to be called by the creator SceneManager. | 
|---|
 | 117 |         @remarks | 
|---|
 | 118 |             Creates a node with a specified name. | 
|---|
 | 119 |         */ | 
|---|
 | 120 |         SceneNode(SceneManager* creator, const String& name); | 
|---|
 | 121 |         ~SceneNode(); | 
|---|
 | 122 |  | 
|---|
 | 123 |         /** Adds an instance of a scene object to this node. | 
|---|
 | 124 |         @remarks | 
|---|
 | 125 |             Scene objects can include Entity objects, Camera objects, Light objects,  | 
|---|
 | 126 |             ParticleSystem objects etc. Anything that subclasses from MovableObject. | 
|---|
 | 127 |         */ | 
|---|
 | 128 |         virtual void attachObject(MovableObject* obj); | 
|---|
 | 129 |  | 
|---|
 | 130 |         /** Reports the number of objects attached to this node. | 
|---|
 | 131 |         */ | 
|---|
 | 132 |         virtual unsigned short numAttachedObjects(void) const; | 
|---|
 | 133 |  | 
|---|
 | 134 |         /** Retrieves a pointer to an attached object. | 
|---|
 | 135 |         @remarks Retrieves by index, see alternate version to retrieve by name. The index | 
|---|
 | 136 |         of an object may change as other objects are added / removed. | 
|---|
 | 137 |         */ | 
|---|
 | 138 |         virtual MovableObject* getAttachedObject(unsigned short index); | 
|---|
 | 139 |  | 
|---|
 | 140 |         /** Retrieves a pointer to an attached object. | 
|---|
 | 141 |         @remarks Retrieves by object name, see alternate version to retrieve by index. | 
|---|
 | 142 |         */ | 
|---|
 | 143 |         virtual MovableObject* getAttachedObject(const String& name); | 
|---|
 | 144 |  | 
|---|
 | 145 |         /** Detaches the indexed object from this scene node. | 
|---|
 | 146 |         @remarks | 
|---|
 | 147 |             Detaches by index, see the alternate version to detach by name. Object indexes | 
|---|
 | 148 |             may change as other objects are added / removed. | 
|---|
 | 149 |         */ | 
|---|
 | 150 |         virtual MovableObject* detachObject(unsigned short index); | 
|---|
 | 151 |         /** Detaches an object by pointer. */ | 
|---|
 | 152 |         virtual void detachObject(MovableObject* obj); | 
|---|
 | 153 |  | 
|---|
 | 154 |         /** Detaches the named object from this node and returns a pointer to it. */ | 
|---|
 | 155 |         virtual MovableObject* detachObject(const String& name); | 
|---|
 | 156 |  | 
|---|
 | 157 |         /** Detaches all objects attached to this node. | 
|---|
 | 158 |         */ | 
|---|
 | 159 |         virtual void detachAllObjects(void); | 
|---|
 | 160 |  | 
|---|
 | 161 |                 /** Determines whether this node is in the scene graph, i.e. | 
|---|
 | 162 |                         whether it's ultimate ancestor is the root scene node. | 
|---|
 | 163 |                 */ | 
|---|
 | 164 |                 virtual bool isInSceneGraph(void) const { return mIsInSceneGraph; } | 
|---|
 | 165 |  | 
|---|
 | 166 |                 /** Notifies this SceneNode that it is the root scene node.  | 
|---|
 | 167 |                 @remarks | 
|---|
 | 168 |                         Only SceneManager should call this! | 
|---|
 | 169 |                 */ | 
|---|
 | 170 |                 virtual void _notifyRootNode(void) { mIsInSceneGraph = true; } | 
|---|
 | 171 |                          | 
|---|
 | 172 |  | 
|---|
 | 173 |         /** Internal method to update the Node. | 
|---|
 | 174 |             @note | 
|---|
 | 175 |                 Updates this scene node and any relevant children to incorporate transforms etc. | 
|---|
 | 176 |                 Don't call this yourself unless you are writing a SceneManager implementation. | 
|---|
 | 177 |             @param | 
|---|
 | 178 |                 updateChildren If true, the update cascades down to all children. Specify false if you wish to | 
|---|
 | 179 |                 update children separately, e.g. because of a more selective SceneManager implementation. | 
|---|
 | 180 |             @param | 
|---|
 | 181 |                 parentHasChanged This flag indicates that the parent transform has changed, | 
|---|
 | 182 |                     so the child should retrieve the parent's transform and combine it with its own | 
|---|
 | 183 |                     even if it hasn't changed itself. | 
|---|
 | 184 |         */ | 
|---|
 | 185 |         virtual void _update(bool updateChildren, bool parentHasChanged); | 
|---|
 | 186 |  | 
|---|
 | 187 |                 /** Tells the SceneNode to update the world bound info it stores. | 
|---|
 | 188 |                 */ | 
|---|
 | 189 |                 virtual void _updateBounds(void); | 
|---|
 | 190 |  | 
|---|
 | 191 |         /** Internal method which locates any visible objects attached to this node and adds them to the passed in queue. | 
|---|
 | 192 |             @remarks | 
|---|
 | 193 |                 Should only be called by a SceneManager implementation, and only after the _updat method has been called to | 
|---|
 | 194 |                 ensure transforms and world bounds are up to date. | 
|---|
 | 195 |                 SceneManager implementations can choose to let the search cascade automatically, or choose to prevent this | 
|---|
 | 196 |                 and select nodes themselves based on some other criteria. | 
|---|
 | 197 |             @param | 
|---|
 | 198 |                 cam The active camera | 
|---|
 | 199 |             @param | 
|---|
 | 200 |                 queue The SceneManager's rendering queue | 
|---|
 | 201 |                         @param | 
|---|
 | 202 |                                 visibleBounds bounding information created on the fly containing all visible objects by the camera | 
|---|
 | 203 |             @param | 
|---|
 | 204 |                 includeChildren If true, the call is cascaded down to all child nodes automatically. | 
|---|
 | 205 |             @param | 
|---|
 | 206 |                 displayNodes If true, the nodes themselves are rendered as a set of 3 axes as well | 
|---|
 | 207 |                     as the objects being rendered. For debugging purposes. | 
|---|
 | 208 |         */ | 
|---|
 | 209 |                 virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue,  | 
|---|
 | 210 |                         VisibleObjectsBoundsInfo* visibleBounds,  | 
|---|
 | 211 |             bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false); | 
|---|
 | 212 |  | 
|---|
 | 213 |         /** Gets the axis-aligned bounding box of this node (and hence all subnodes). | 
|---|
 | 214 |         @remarks | 
|---|
 | 215 |             Recommended only if you are extending a SceneManager, because the bounding box returned | 
|---|
 | 216 |             from this method is only up to date after the SceneManager has called _update. | 
|---|
 | 217 |         */ | 
|---|
 | 218 |         virtual const AxisAlignedBox& _getWorldAABB(void) const; | 
|---|
 | 219 |  | 
|---|
 | 220 |         /** Retrieves an iterator which can be used to efficiently step through the objects  | 
|---|
 | 221 |             attached to this node. | 
|---|
 | 222 |         @remarks | 
|---|
 | 223 |             This is a much faster way to go through <B>all</B> the objects attached to the node | 
|---|
 | 224 |             than using getAttachedObject. But the iterator returned is only valid until a change | 
|---|
 | 225 |             is made to the collection (ie an addition or removal) so treat the returned iterator | 
|---|
 | 226 |             as transient, and don't add / remove items as you go through the iterator, save changes | 
|---|
 | 227 |             until the end, or retrieve a new iterator after making the change. Making changes to | 
|---|
 | 228 |             the object returned through the iterator is OK though. | 
|---|
 | 229 |         */ | 
|---|
 | 230 |         virtual ObjectIterator getAttachedObjectIterator(void); | 
|---|
 | 231 |         /** Retrieves an iterator which can be used to efficiently step through the objects  | 
|---|
 | 232 |             attached to this node. | 
|---|
 | 233 |         @remarks | 
|---|
 | 234 |             This is a much faster way to go through <B>all</B> the objects attached to the node | 
|---|
 | 235 |             than using getAttachedObject. But the iterator returned is only valid until a change | 
|---|
 | 236 |             is made to the collection (ie an addition or removal) so treat the returned iterator | 
|---|
 | 237 |             as transient, and don't add / remove items as you go through the iterator, save changes | 
|---|
 | 238 |             until the end, or retrieve a new iterator after making the change. Making changes to | 
|---|
 | 239 |             the object returned through the iterator is OK though. | 
|---|
 | 240 |         */ | 
|---|
 | 241 |                 virtual ConstObjectIterator getAttachedObjectIterator(void) const; | 
|---|
 | 242 |  | 
|---|
 | 243 |         /** Gets the creator of this scene node.  | 
|---|
 | 244 |         @remarks | 
|---|
 | 245 |             This method returns the SceneManager which created this node. | 
|---|
 | 246 |             This can be useful for destroying this node. | 
|---|
 | 247 |         */ | 
|---|
 | 248 |         SceneManager* getCreator(void) const { return mCreator; } | 
|---|
 | 249 |  | 
|---|
 | 250 |         /** This method removes and destroys the named child and all of its children. | 
|---|
 | 251 |         @remarks | 
|---|
 | 252 |             Unlike removeChild, which removes a single named child from this | 
|---|
 | 253 |             node but does not destroy it, this method destroys the child | 
|---|
 | 254 |             and all of it's children.  | 
|---|
 | 255 |         @par | 
|---|
 | 256 |             Use this if you wish to recursively destroy a node as well as  | 
|---|
 | 257 |             detaching it from it's parent. Note that any objects attached to | 
|---|
 | 258 |             the nodes will be detached but will not themselves be destroyed. | 
|---|
 | 259 |         */ | 
|---|
 | 260 |         virtual void removeAndDestroyChild(const String& name); | 
|---|
 | 261 |  | 
|---|
 | 262 |         /** This method removes and destroys the child and all of its children. | 
|---|
 | 263 |         @remarks | 
|---|
 | 264 |             Unlike removeChild, which removes a single named child from this | 
|---|
 | 265 |             node but does not destroy it, this method destroys the child | 
|---|
 | 266 |             and all of it's children.  | 
|---|
 | 267 |         @par | 
|---|
 | 268 |             Use this if you wish to recursively destroy a node as well as  | 
|---|
 | 269 |             detaching it from it's parent. Note that any objects attached to | 
|---|
 | 270 |             the nodes will be detached but will not themselves be destroyed. | 
|---|
 | 271 |         */ | 
|---|
 | 272 |         virtual void removeAndDestroyChild(unsigned short index); | 
|---|
 | 273 |  | 
|---|
 | 274 |         /** Removes and destroys all children of this node. | 
|---|
 | 275 |         @remarks | 
|---|
 | 276 |             Use this to destroy all child nodes of this node and remove | 
|---|
 | 277 |             them from the scene graph. Note that all objects attached to this | 
|---|
 | 278 |             node will be detached but will not be destroyed. | 
|---|
 | 279 |         */ | 
|---|
 | 280 |         virtual void removeAndDestroyAllChildren(void); | 
|---|
 | 281 |  | 
|---|
 | 282 |         /** Allows the showing of the node's bounding box. | 
|---|
 | 283 |         @remarks | 
|---|
 | 284 |             Use this to show or hide the bounding box of the node. | 
|---|
 | 285 |         */ | 
|---|
 | 286 |                 virtual void showBoundingBox(bool bShow); | 
|---|
 | 287 |  | 
|---|
 | 288 |         /** Allows the overriding of the node's bounding box | 
|---|
 | 289 |             over the SceneManager's bounding box setting. | 
|---|
 | 290 |         @remarks | 
|---|
 | 291 |             Use this to override the bounding box setting of the node. | 
|---|
 | 292 |         */ | 
|---|
 | 293 |                 virtual void hideBoundingBox(bool bHide); | 
|---|
 | 294 |  | 
|---|
 | 295 |         /** Add the bounding box to the rendering queue. | 
|---|
 | 296 |         */ | 
|---|
 | 297 |                 virtual void _addBoundingBoxToQueue(RenderQueue* queue); | 
|---|
 | 298 |  | 
|---|
 | 299 |         /** This allows scene managers to determine if the node's bounding box | 
|---|
 | 300 |                         should be added to the rendering queue. | 
|---|
 | 301 |         @remarks | 
|---|
 | 302 |             Scene Managers that implement their own _findVisibleObjects will have to  | 
|---|
 | 303 |                         check this flag and then use _addBoundingBoxToQueue to add the bounding box | 
|---|
 | 304 |                         wireframe. | 
|---|
 | 305 |         */ | 
|---|
 | 306 |                 virtual bool getShowBoundingBox() const; | 
|---|
 | 307 |  | 
|---|
 | 308 |         /** Creates an unnamed new SceneNode as a child of this node. | 
|---|
 | 309 |         @param | 
|---|
 | 310 |             translate Initial translation offset of child relative to parent | 
|---|
 | 311 |         @param | 
|---|
 | 312 |             rotate Initial rotation relative to parent | 
|---|
 | 313 |         */ | 
|---|
 | 314 |         virtual SceneNode* createChildSceneNode( | 
|---|
 | 315 |             const Vector3& translate = Vector3::ZERO,  | 
|---|
 | 316 |             const Quaternion& rotate = Quaternion::IDENTITY ); | 
|---|
 | 317 |  | 
|---|
 | 318 |         /** Creates a new named SceneNode as a child of this node. | 
|---|
 | 319 |         @remarks | 
|---|
 | 320 |             This creates a child node with a given name, which allows you to look the node up from  | 
|---|
 | 321 |             the parent which holds this collection of nodes. | 
|---|
 | 322 |             @param | 
|---|
 | 323 |                 translate Initial translation offset of child relative to parent | 
|---|
 | 324 |             @param | 
|---|
 | 325 |                 rotate Initial rotation relative to parent | 
|---|
 | 326 |         */ | 
|---|
 | 327 |         virtual SceneNode* createChildSceneNode(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY); | 
|---|
 | 328 |  | 
|---|
 | 329 |         /** Allows retrieval of the nearest lights to the centre of this SceneNode. | 
|---|
 | 330 |         @remarks | 
|---|
 | 331 |             This method allows a list of lights, ordered by proximity to the centre | 
|---|
 | 332 |             of this SceneNode, to be retrieved. Can be useful when implementing | 
|---|
 | 333 |             MovableObject::queryLights and Renderable::getLights. | 
|---|
 | 334 |         @par | 
|---|
 | 335 |             Note that only lights could be affecting the frustum will take into | 
|---|
 | 336 |             account, which cached in scene manager. | 
|---|
 | 337 |         @see SceneManager::_getLightsAffectingFrustum | 
|---|
 | 338 |         @see SceneManager::_populateLightList | 
|---|
 | 339 |         @param destList List to be populated with ordered set of lights; will be | 
|---|
 | 340 |             cleared by this method before population. | 
|---|
 | 341 |         @param radius Parameter to specify lights intersecting a given radius of | 
|---|
 | 342 |             this SceneNode's centre. | 
|---|
 | 343 |                 @param lightMask The mask with which to include / exclude lights | 
|---|
 | 344 |         */ | 
|---|
 | 345 |         virtual void findLights(LightList& destList, Real radius, uint32 lightMask = 0xFFFFFFFF) const; | 
|---|
 | 346 |  | 
|---|
 | 347 |         /** Tells the node whether to yaw around it's own local Y axis or a fixed axis of choice. | 
|---|
 | 348 |         @remarks | 
|---|
 | 349 |         This method allows you to change the yaw behaviour of the node - by default, it | 
|---|
 | 350 |         yaws around it's own local Y axis when told to yaw with TS_LOCAL, this makes it | 
|---|
 | 351 |         yaw around a fixed axis.  | 
|---|
 | 352 |         You only really need this when you're using auto tracking (see setAutoTracking, | 
|---|
 | 353 |         because when you're manually rotating a node you can specify the TransformSpace | 
|---|
 | 354 |         in which you wish to work anyway. | 
|---|
 | 355 |         @param | 
|---|
 | 356 |         useFixed If true, the axis passed in the second parameter will always be the yaw axis no | 
|---|
 | 357 |         matter what the node orientation. If false, the node returns to it's default behaviour. | 
|---|
 | 358 |         @param | 
|---|
 | 359 |         fixedAxis The axis to use if the first parameter is true. | 
|---|
 | 360 |         */ | 
|---|
 | 361 |         virtual void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y ); | 
|---|
 | 362 |  | 
|---|
 | 363 |                 /** Rotate the node around the Y-axis. | 
|---|
 | 364 |                 */ | 
|---|
 | 365 |                 virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL); | 
|---|
 | 366 |         /** Sets the node's direction vector ie it's local -z. | 
|---|
 | 367 |         @remarks | 
|---|
 | 368 |         Note that the 'up' vector for the orientation will automatically be  | 
|---|
 | 369 |         recalculated based on the current 'up' vector (i.e. the roll will  | 
|---|
 | 370 |         remain the same). If you need more control, use setOrientation. | 
|---|
 | 371 |         @param x,y,z The components of the direction vector | 
|---|
 | 372 |         @param relativeTo The space in which this direction vector is expressed | 
|---|
 | 373 |         @param localDirectionVector The vector which normally describes the natural | 
|---|
 | 374 |         direction of the node, usually -Z | 
|---|
 | 375 |         */ | 
|---|
 | 376 |         virtual void setDirection(Real x, Real y, Real z,  | 
|---|
 | 377 |             TransformSpace relativeTo = TS_LOCAL,  | 
|---|
 | 378 |             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); | 
|---|
 | 379 |  | 
|---|
 | 380 |         /** Sets the node's direction vector ie it's local -z. | 
|---|
 | 381 |         @remarks | 
|---|
 | 382 |         Note that the 'up' vector for the orientation will automatically be  | 
|---|
 | 383 |         recalculated based on the current 'up' vector (i.e. the roll will  | 
|---|
 | 384 |         remain the same). If you need more control, use setOrientation. | 
|---|
 | 385 |         @param vec The direction vector | 
|---|
 | 386 |         @param relativeTo The space in which this direction vector is expressed | 
|---|
 | 387 |         @param localDirectionVector The vector which normally describes the natural | 
|---|
 | 388 |         direction of the node, usually -Z | 
|---|
 | 389 |         */ | 
|---|
 | 390 |         virtual void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL,  | 
|---|
 | 391 |             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); | 
|---|
 | 392 |         /** Points the local -Z direction of this node at a point in space. | 
|---|
 | 393 |         @param targetPoint A vector specifying the look at point. | 
|---|
 | 394 |         @param relativeTo The space in which the point resides | 
|---|
 | 395 |         @param localDirectionVector The vector which normally describes the natural | 
|---|
 | 396 |         direction of the node, usually -Z | 
|---|
 | 397 |         */ | 
|---|
 | 398 |         virtual void lookAt( const Vector3& targetPoint, TransformSpace relativeTo, | 
|---|
 | 399 |             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); | 
|---|
 | 400 |         /** Enables / disables automatic tracking of another SceneNode. | 
|---|
 | 401 |         @remarks | 
|---|
 | 402 |         If you enable auto-tracking, this SceneNode will automatically rotate to | 
|---|
 | 403 |         point it's -Z at the target SceneNode every frame, no matter how  | 
|---|
 | 404 |         it or the other SceneNode move. Note that by default the -Z points at the  | 
|---|
 | 405 |         origin of the target SceneNode, if you want to tweak this, provide a  | 
|---|
 | 406 |         vector in the 'offset' parameter and the target point will be adjusted. | 
|---|
 | 407 |         @param enabled If true, tracking will be enabled and the next  | 
|---|
 | 408 |         parameter cannot be null. If false tracking will be disabled and the  | 
|---|
 | 409 |         current orientation will be maintained. | 
|---|
 | 410 |         @param target Pointer to the SceneNode to track. Make sure you don't | 
|---|
 | 411 |         delete this SceneNode before turning off tracking (e.g. SceneManager::clearScene will | 
|---|
 | 412 |         delete it so be careful of this). Can be null if and only if the enabled param is false. | 
|---|
 | 413 |         @param localDirectionVector The local vector considered to be the usual 'direction' | 
|---|
 | 414 |         of the node; normally the local -Z but can be another direction. | 
|---|
 | 415 |         @param offset If supplied, this is the target point in local space of the target node | 
|---|
 | 416 |         instead of the origin of the target node. Good for fine tuning the look at point. | 
|---|
 | 417 |         */ | 
|---|
 | 418 |         virtual void setAutoTracking(bool enabled, SceneNode* const target = 0,  | 
|---|
 | 419 |             const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z, | 
|---|
 | 420 |             const Vector3& offset = Vector3::ZERO); | 
|---|
 | 421 |                 /** Get the auto tracking target for this node, if any. */ | 
|---|
 | 422 |         virtual SceneNode* getAutoTrackTarget(void) { return mAutoTrackTarget; } | 
|---|
 | 423 |                 /** Get the auto tracking offset for this node, if the node is auto tracking. */ | 
|---|
 | 424 |                 virtual const Vector3& getAutoTrackOffset(void) { return mAutoTrackOffset; } | 
|---|
 | 425 |                 /** Get the auto tracking local direction for this node, if it is auto tracking. */ | 
|---|
 | 426 |                 virtual const Vector3& getAutoTrackLocalDirection(void) { return mAutoTrackLocalDirection; } | 
|---|
 | 427 |                 /** Internal method used by OGRE to update auto-tracking cameras. */ | 
|---|
 | 428 |         void _autoTrack(void); | 
|---|
 | 429 |         /** Gets the parent of this SceneNode. */ | 
|---|
 | 430 |         SceneNode* getParentSceneNode(void) const; | 
|---|
 | 431 |         /** Makes all objects attached to this node become visible / invisible. | 
|---|
 | 432 |         @remarks     | 
|---|
 | 433 |             This is a shortcut to calling setVisible() on the objects attached | 
|---|
 | 434 |             to this node, and optionally to all objects attached to child | 
|---|
 | 435 |             nodes.  | 
|---|
 | 436 |         @param visible Whether the objects are to be made visible or invisible | 
|---|
 | 437 |         @param cascade If true, this setting cascades into child nodes too. | 
|---|
 | 438 |         */ | 
|---|
 | 439 |         virtual void setVisible(bool visible, bool cascade = true); | 
|---|
 | 440 |         /** Inverts the visibility of all objects attached to this node. | 
|---|
 | 441 |         @remarks     | 
|---|
 | 442 |         This is a shortcut to calling setVisible(!isVisible()) on the objects attached | 
|---|
 | 443 |         to this node, and optionally to all objects attached to child | 
|---|
 | 444 |         nodes.  | 
|---|
 | 445 |         @param cascade If true, this setting cascades into child nodes too. | 
|---|
 | 446 |         */ | 
|---|
 | 447 |         virtual void flipVisibility(bool cascade = true); | 
|---|
 | 448 |  | 
|---|
 | 449 |         /** Tells all objects attached to this node whether to display their | 
|---|
 | 450 |                         debug information or not. | 
|---|
 | 451 |         @remarks     | 
|---|
 | 452 |             This is a shortcut to calling setDebugDisplayEnabled() on the objects attached | 
|---|
 | 453 |             to this node, and optionally to all objects attached to child | 
|---|
 | 454 |             nodes.  | 
|---|
 | 455 |         @param enabled Whether the objects are to display debug info or not | 
|---|
 | 456 |         @param cascade If true, this setting cascades into child nodes too. | 
|---|
 | 457 |         */ | 
|---|
 | 458 |         virtual void setDebugDisplayEnabled(bool enabled, bool cascade = true); | 
|---|
 | 459 |  | 
|---|
 | 460 |                 /// As Node::getDebugRenderable, except scaling is automatically determined | 
|---|
 | 461 |                 virtual DebugRenderable* getDebugRenderable(); | 
|---|
 | 462 |  | 
|---|
 | 463 |  | 
|---|
 | 464 |  | 
|---|
 | 465 |  | 
|---|
 | 466 |     }; | 
|---|
 | 467 |         /** @} */ | 
|---|
 | 468 |         /** @} */ | 
|---|
 | 469 |  | 
|---|
 | 470 |  | 
|---|
 | 471 | }// namespace | 
|---|
 | 472 |  | 
|---|
 | 473 | #include "OgreHeaderSuffix.h" | 
|---|
 | 474 |  | 
|---|
 | 475 | #endif | 
|---|