RigsofRods
Soft-body Physics Simulation
Public Member Functions
AngelOgre::SceneNode Class Reference

Class representing a node in the scene graph. More...

#include <AngelOgre_OgreSceneNode.h>

+ Inheritance diagram for AngelOgre::SceneNode:
+ Collaboration diagram for AngelOgre::SceneNode:

Public Member Functions

void attachObject (MovableObject@ obj)
 Adds an instance of a scene object to this node. More...
 
MovableObject getAttachedObject (const string &name)
 Retrieves a pointer to an attached object. More...
 
MovableObject detachObject (uint16 index)
 Detaches the indexed object from this scene node. More...
 
void detachObject (MovableObject@ obj)
 Detaches an object by pointer. More...
 
MovableObject detachObject (const string &name)
 Detaches the named object from this node and returns a pointer to it. More...
 
void detachAllObjects (void)
 Detaches all objects attached to this node. More...
 
bool isInSceneGraph (void) const
 Determines whether this node is in the scene graph, i.e. More...
 
MovableObjectArray getAttachedObjects ()
 The MovableObjects attached to this node. More...
 
SceneManager getCreator (void) const
 Gets the creator of this scene node. More...
 
void removeAndDestroyChild (const string &name)
 This method removes and destroys the named child and all of its children. More...
 
void removeAndDestroyChild (uint16 index)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void removeAndDestroyChild (SceneNode@ child)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void removeAndDestroyAllChildren (void)
 Removes and destroys all children of this node. More...
 
void showBoundingBox (bool bShow)
 Allows the showing of the node's bounding box. More...
 
void hideBoundingBox (bool bHide)
 Allows the overriding of the node's bounding box over the SceneManager's bounding box setting. More...
 
bool getShowBoundingBox () const
 This allows scene managers to determine if the node's bounding box should be added to the rendering queue. More...
 
SceneNode createChildSceneNode (const vector3 &translate=vector3(0.f, 0.f, 0.f), const Quaternion &rotate=quaternion())
 Creates an unnamed new SceneNode as a child of this node. More...
 
SceneNode createChildSceneNode (const string &name, const vector3 &translate=vector3(0.f, 0.f, 0.f), const Quaternion &rotate=quaternion())
 Creates a new named SceneNode as a child of this node. More...
 
void setFixedYawAxis (bool useFixed, const vector3 &fixedAxis=vector3(0.f, 1.f, 0.f))
 Tells the node whether to yaw around it's own local Y axis or a fixed axis of choice. More...
 
void yaw (const Radian &angle, TransformSpace relativeTo=TS_LOCAL)
 Rotate the node around the Y-axis. More...
 
void setDirection (const vector3 &vec, TransformSpace relativeTo=TS_LOCAL, const vector3 &localDirectionVector=vector3(0.f, 0.f, -1.f))
 Sets the node's direction vector ie it's local -z. More...
 
void lookAt (const vector3 &targetPoint, TransformSpace relativeTo, const vector3 &localDirectionVector=vector3(0.f, 0.f, -1.f))
 Points the local -Z direction of this node at a point in space. More...
 
void setAutoTracking (bool enabled, SceneNode@ const target=0, const vector3 &localDirectionVector=vector3(0.f, 0.f, -1.f), const vector3 &offset=vector3(0.f, 0.f, 0.f))
 Enables / disables automatic tracking of another SceneNode. More...
 
SceneNode getAutoTrackTarget (void)
 Get the auto tracking target for this node, if any. More...
 
const vector3 & getAutoTrackOffset (void)
 Get the auto tracking offset for this node, if the node is auto tracking. More...
 
const vector3 & getAutoTrackLocalDirection (void)
 Get the auto tracking local direction for this node, if it is auto tracking. More...
 
SceneNode getParentSceneNode (void)
 Gets the parent of this SceneNode. More...
 
void setVisible (bool visible, bool cascade=true)
 Makes all objects attached to this node become visible / invisible. More...
 
void flipVisibility (bool cascade=true)
 Inverts the visibility of all objects attached to this node. More...
 
void setDebugDisplayEnabled (bool enabled, bool cascade=true)
 Tells all objects attached to this node whether to display their debug information or not. More...
 
- Public Member Functions inherited from AngelOgre::Node
const vector3 & getPosition () const
 
void setPosition (const vector3 &in)
 
const vector3 & getScale () const
 
void setScale (const vector3 &in)
 
const string & getName () const
 
Node getParent ()
 
string __getUniqueName () const
 A Rigs of Rods extension - generates unique name as "{name} ({mem_address})". More...
 
ChildNodeArray getChildren ()
 Not const because we don't want all elements to be const (this isn't the case with raw pointers in C++). More...
 

Detailed Description

Class representing a node in the scene graph.

Remarks
A SceneNode is a type of Node which is used to organise objects in a scene. It has the same hierarchical transformation properties of the generic Node class, but also adds the ability to attach world objects to the node, and stores hierarchical bounding volumes of the nodes in the tree. Child nodes are contained within the bounds of the parent, and so on down the tree, allowing for fast culling.

Definition at line 20 of file AngelOgre_OgreSceneNode.h.

Member Function Documentation

◆ attachObject()

void AngelOgre::SceneNode::attachObject ( MovableObject obj)

Adds an instance of a scene object to this node.

Remarks
Scene objects can include Entity objects, Camera objects, Light objects, ParticleSystem objects etc. Anything that subclasses from MovableObject.

◆ createChildSceneNode() [1/2]

SceneNode AngelOgre::SceneNode::createChildSceneNode ( const string &  name,
const vector3 &  translate = vector3(0.f, 0.f, 0.f),
const Quaternion &  rotate = quaternion() 
)

Creates a new named SceneNode as a child of this node.

Remarks
This creates a child node with a given name, which allows you to look the node up from the parent which holds this collection of nodes.
Parameters
translateInitial translation offset of child relative to parent
rotateInitial rotation relative to parent

◆ createChildSceneNode() [2/2]

SceneNode AngelOgre::SceneNode::createChildSceneNode ( const vector3 &  translate = vector3(0.f, 0.f, 0.f),
const Quaternion &  rotate = quaternion() 
)

Creates an unnamed new SceneNode as a child of this node.

Parameters
translateInitial translation offset of child relative to parent
rotateInitial rotation relative to parent

◆ detachAllObjects()

void AngelOgre::SceneNode::detachAllObjects ( void  )

Detaches all objects attached to this node.

◆ detachObject() [1/3]

MovableObject AngelOgre::SceneNode::detachObject ( const string &  name)

Detaches the named object from this node and returns a pointer to it.

◆ detachObject() [2/3]

void AngelOgre::SceneNode::detachObject ( MovableObject obj)

Detaches an object by pointer.

◆ detachObject() [3/3]

MovableObject AngelOgre::SceneNode::detachObject ( uint16  index)

Detaches the indexed object from this scene node.

Remarks
Detaches by index, see the alternate version to detach by name. Object indexes may change as other objects are added / removed.

◆ flipVisibility()

void AngelOgre::SceneNode::flipVisibility ( bool  cascade = true)

Inverts the visibility of all objects attached to this node.

Remarks

This is a shortcut to calling setVisible(!isVisible()) on the objects attached to this node, and optionally to all objects attached to child nodes.
Parameters
cascadeIf true, this setting cascades into child nodes too.

◆ getAttachedObject()

MovableObject AngelOgre::SceneNode::getAttachedObject ( const string &  name)

Retrieves a pointer to an attached object.

Remarks
Retrieves by object name, see alternate version to retrieve by index.

◆ getAttachedObjects()

MovableObjectArray AngelOgre::SceneNode::getAttachedObjects ( )

The MovableObjects attached to this node.

This is a much faster way to go through all the objects attached to the node than using getAttachedObject.

◆ getAutoTrackLocalDirection()

const vector3& AngelOgre::SceneNode::getAutoTrackLocalDirection ( void  )

Get the auto tracking local direction for this node, if it is auto tracking.

◆ getAutoTrackOffset()

const vector3& AngelOgre::SceneNode::getAutoTrackOffset ( void  )

Get the auto tracking offset for this node, if the node is auto tracking.

◆ getAutoTrackTarget()

SceneNode AngelOgre::SceneNode::getAutoTrackTarget ( void  )

Get the auto tracking target for this node, if any.

◆ getCreator()

SceneManager AngelOgre::SceneNode::getCreator ( void  ) const

Gets the creator of this scene node.

Remarks
This method returns the SceneManager which created this node. This can be useful for destroying this node.

◆ getParentSceneNode()

SceneNode AngelOgre::SceneNode::getParentSceneNode ( void  )

Gets the parent of this SceneNode.

◆ getShowBoundingBox()

bool AngelOgre::SceneNode::getShowBoundingBox ( ) const

This allows scene managers to determine if the node's bounding box should be added to the rendering queue.

Remarks
Scene Managers that implement their own _findVisibleObjects will have to check this flag and then use _addBoundingBoxToQueue to add the bounding box wireframe.

◆ hideBoundingBox()

void AngelOgre::SceneNode::hideBoundingBox ( bool  bHide)

Allows the overriding of the node's bounding box over the SceneManager's bounding box setting.

Remarks
Use this to override the bounding box setting of the node.

◆ isInSceneGraph()

bool AngelOgre::SceneNode::isInSceneGraph ( void  ) const

Determines whether this node is in the scene graph, i.e.

whether it's ultimate ancestor is the root scene node.

◆ lookAt()

void AngelOgre::SceneNode::lookAt ( const vector3 &  targetPoint,
TransformSpace  relativeTo,
const vector3 &  localDirectionVector = vector3(0.f, 0.f, -1.f) 
)

Points the local -Z direction of this node at a point in space.

Parameters
targetPointA vector specifying the look at point.
relativeToThe space in which the point resides
localDirectionVectorThe vector which normally describes the natural direction of the node, usually -Z

◆ removeAndDestroyAllChildren()

void AngelOgre::SceneNode::removeAndDestroyAllChildren ( void  )

Removes and destroys all children of this node.

Remarks
Use this to destroy all child nodes of this node and remove them from the scene graph. Note that all objects attached to this node will be detached but will not be destroyed.

◆ removeAndDestroyChild() [1/3]

void AngelOgre::SceneNode::removeAndDestroyChild ( const string &  name)

This method removes and destroys the named child and all of its children.

Remarks
Unlike removeChild, which removes a single named child from this node but does not destroy it, this method destroys the child and all of it's children.
Use this if you wish to recursively destroy a node as well as detaching it from it's parent. Note that any objects attached to the nodes will be detached but will not themselves be destroyed.

◆ removeAndDestroyChild() [2/3]

void AngelOgre::SceneNode::removeAndDestroyChild ( SceneNode child)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ removeAndDestroyChild() [3/3]

void AngelOgre::SceneNode::removeAndDestroyChild ( uint16  index)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setAutoTracking()

void AngelOgre::SceneNode::setAutoTracking ( bool  enabled,
SceneNode@ const  target = 0,
const vector3 &  localDirectionVector = vector3(0.f, 0.f, -1.f),
const vector3 &  offset = vector3(0.f, 0.f, 0.f) 
)

Enables / disables automatic tracking of another SceneNode.

Remarks
If you enable auto-tracking, this SceneNode will automatically rotate to point it's -Z at the target SceneNode every frame, no matter how it or the other SceneNode move. Note that by default the -Z points at the origin of the target SceneNode, if you want to tweak this, provide a vector in the 'offset' parameter and the target point will be adjusted.
Parameters
enabledIf true, tracking will be enabled and the next parameter cannot be null. If false tracking will be disabled and the current orientation will be maintained.
targetPointer to the SceneNode to track. Make sure you don't delete this SceneNode before turning off tracking (e.g. SceneManager::clearScene will delete it so be careful of this). Can be null if and only if the enabled param is false.
localDirectionVectorThe local vector considered to be the usual 'direction' of the node; normally the local -Z but can be another direction.
offsetIf supplied, this is the target point in local space of the target node instead of the origin of the target node. Good for fine tuning the look at point.

◆ setDebugDisplayEnabled()

void AngelOgre::SceneNode::setDebugDisplayEnabled ( bool  enabled,
bool  cascade = true 
)

Tells all objects attached to this node whether to display their debug information or not.

Remarks

This is a shortcut to calling setDebugDisplayEnabled() on the objects attached to this node, and optionally to all objects attached to child nodes.
Parameters
enabledWhether the objects are to display debug info or not
cascadeIf true, this setting cascades into child nodes too.

◆ setDirection()

void AngelOgre::SceneNode::setDirection ( const vector3 &  vec,
TransformSpace  relativeTo = TS_LOCAL,
const vector3 &  localDirectionVector = vector3(0.f, 0.f, -1.f) 
)

Sets the node's direction vector ie it's local -z.

Remarks
Note that the 'up' vector for the orientation will automatically be recalculated based on the current 'up' vector (i.e. the roll will remain the same). If you need more control, use setOrientation.
Parameters
vecThe components of the direction vector
relativeToThe space in which this direction vector is expressed
localDirectionVectorThe vector which normally describes the natural direction of the node, usually -Z

◆ setFixedYawAxis()

void AngelOgre::SceneNode::setFixedYawAxis ( bool  useFixed,
const vector3 &  fixedAxis = vector3(0.f, 1.f, 0.f) 
)

Tells the node whether to yaw around it's own local Y axis or a fixed axis of choice.

Remarks
This method allows you to change the yaw behaviour of the node - by default, it yaws around it's own local Y axis when told to yaw with TS_LOCAL, this makes it yaw around a fixed axis. You only floatly need this when you're using auto tracking (see setAutoTracking, because when you're manually rotating a node you can specify the TransformSpace in which you wish to work anyway.
Parameters
useFixedIf true, the axis passed in the second parameter will always be the yaw axis no matter what the node orientation. If false, the node returns to it's default behaviour.
fixedAxisThe axis to use if the first parameter is true.

◆ setVisible()

void AngelOgre::SceneNode::setVisible ( bool  visible,
bool  cascade = true 
)

Makes all objects attached to this node become visible / invisible.

Remarks

This is a shortcut to calling setVisible() on the objects attached to this node, and optionally to all objects attached to child nodes.
Parameters
visibleWhether the objects are to be made visible or invisible
cascadeIf true, this setting cascades into child nodes too.

◆ showBoundingBox()

void AngelOgre::SceneNode::showBoundingBox ( bool  bShow)

Allows the showing of the node's bounding box.

Remarks
Use this to show or hide the bounding box of the node.

◆ yaw()

void AngelOgre::SceneNode::yaw ( const Radian &  angle,
TransformSpace  relativeTo = TS_LOCAL 
)

Rotate the node around the Y-axis.


The documentation for this class was generated from the following file: