C# Class Axiom.Core.Node

Class representing a general-purpose node an articulated scene graph.
A node in the scene graph is a node in a structured tree. A node contains information about the transformation which will apply to it and all of its children. Child nodes can have transforms of their own, which are combined with their parent's transformations. This is an abstract class - concrete classes are based on this for specific purposes, e.g. SceneNode, Bone
Inheritance: IRenderable
Mostra file Open project: WolfgangSt/axiom Class Usage Examples

Protected Properties

Property Type Description
accumAnimWeight float
cachedRelativeTransform Axiom.MathLib.Matrix4
cachedTransform Axiom.MathLib.Matrix4
childNodes Axiom.Collections.NodeCollection
childrenToUpdate Axiom.Collections.NodeCollection
customParams List
derivedOrientation Axiom.MathLib.Quaternion
derivedPosition Vector3
derivedScale Vector3
inheritOrientation bool
inheritScale bool
initialOrientation Axiom.MathLib.Quaternion
initialPosition Vector3
initialScale Vector3
isParentNotified bool
material Axiom.Graphics.Material
name string
needChildUpdate bool
needParentUpdate bool
needRelativeTransformUpdate bool
needTransformUpdate bool
nextUnnamedNodeExtNum long
nodeMaterial Axiom.Graphics.Material
nodeSubMesh SubMesh
orientation Axiom.MathLib.Quaternion
parent Node
position Vector3
rotationFromInitial Axiom.MathLib.Quaternion
scale Vector3
scaleFromInitial Vector3
subMesh SubMesh
suppressUpdateEvent bool
translationFromInitial Vector3

Public Methods

Method Description
AddChild ( Node child ) : void

Adds a node to the list of children of this node.

CancelUpdate ( Node child ) : void

Called by children to notify their parent that they no longer need an update.

CreateChild ( ) : Node

Creates a new Child node.

CreateChild ( Vector3 translate ) : Node

Creates a new child node.

CreateChild ( Vector3 translate, Axiom.MathLib.Quaternion rotate ) : Node

Creates a new child node.

CreateChild ( string name ) : Node

Creates a new name child node.

CreateChild ( string name, Vector3 translate ) : Node

Creates a new named child node.

CreateChild ( string name, Vector3 translate, Axiom.MathLib.Quaternion rotate ) : Node

Creates a new named child node.

GetChild ( string name ) : Node

Gets a child node by name.

GetDebugRenderable ( ) : Node.DebugRenderable
GetDebugRenderable ( Real scaling ) : Node.DebugRenderable
GetSquaredViewDepth ( Camera camera ) : float

GetWorldTransforms ( Axiom.MathLib.Matrix4 matrices ) : void

HasChild ( Node node ) : bool

Whether the specified node is a child of this node.

HasChild ( string name ) : bool

Whether this node contains a child of the specified name

NeedUpdate ( ) : void

To be called in the event of transform changes to this node that require its recalculation.

This not only tags the node state as being 'dirty', it also requests its parent to know about its dirtiness so it will get an update next time.

NeedUpdate ( bool forceParentUpdate ) : void
Node ( ) : System

Node ( string name ) : System

OnUpdatedFromParent ( ) : void
Pitch ( float degrees ) : void

Rotate the node around the X-axis.

Pitch ( float degrees, TransformSpace relativeTo ) : void

Rotate the node around the X-axis.

ProcessQueuedUpdates ( ) : void
QueueNeedUpdate ( Node node ) : void
RemoveAllChildren ( ) : void

Removes all child nodes attached to this node.

RemoveChild ( string name ) : Node

Removes the child node with the specified name.

RemoveChild ( Node child ) : void

Removes the specifed node that is a child of this node.

RemoveFromParent ( ) : void

Removes the node from parent node if any

RequestUpdate ( Node child ) : void

Called by children to notify their parent that they need an update.

ResetOrientation ( ) : void

Resets the nodes orientation (local axes as world axes, no rotation).

ResetToInitialState ( ) : void

Resets the position / orientation / scale of this node to its initial state, see SetInitialState for more info.

Roll ( float degrees ) : void

Rotate the node around the Z-axis.

Roll ( float degrees, TransformSpace relativeTo ) : void

Rotate the node around the Z-axis.

Rotate ( Axiom.MathLib.Quaternion rotation ) : void

Rotate the node around an arbitrary axis using a Quaternion.

Rotate ( Axiom.MathLib.Quaternion rotation, TransformSpace relativeTo ) : void

Rotate the node around an arbitrary axis using a Quaternion.

Rotate ( Vector3 axis, float degrees ) : void

Rotate the node around an arbitrary axis.

Rotate ( Vector3 axis, float degrees, TransformSpace relativeTo ) : void

Rotate the node around an arbitrary axis.

ScaleBy ( Vector3 factor ) : void

Scales the node, combining its current scale with the passed in scaling factor.

This method applies an extra scaling factor to the node's existing scale, (unlike setScale which overwrites it) combining its current scale with the new one. E.g. calling this method twice with Vector3(2,2,2) would have the same effect as setScale(Vector3(4,4,4)) if the existing scale was 1. Note that like rotations, scalings are oriented around the node's origin.

SetInitialState ( ) : void

Sets the current transform of this node to be the 'initial state' ie that position / orientation / scale to be used as a basis for delta values used in keyframe animation.

You never need to call this method unless you plan to animate this node. If you do plan to animate it, call this method once you've loaded the node with its base state, ie the state on which all keyframes are based. If you never call this method, the initial state is the identity transform (do nothing) and a position of zero

Translate ( Matrix3 axes, Vector3 move ) : void

Moves the node along arbitrary axes.

This method translates the node by a vector which is relative to a custom set of axes.

Translate ( Matrix3 axes, Vector3 move, TransformSpace relativeTo ) : void

Moves the node along arbitrary axes.

This method translates the node by a vector which is relative to a custom set of axes.

Translate ( Vector3 translate ) : void

Moves the node along the cartesian axes. This method moves the node by the supplied vector along the world cartesian axes, i.e. along world x,y,z

Translate ( Vector3 translate, TransformSpace relativeTo ) : void

Moves the node along the cartesian axes. This method moves the node by the supplied vector along the world cartesian axes, i.e. along world x,y,z

Yaw ( float degrees ) : void

Rotate the node around the Y-axis.

Yaw ( float degrees, TransformSpace relativeTo ) : void

Rotate the node around the Y-axis.

Protected Methods

Method Description
CreateChildImpl ( ) : Node

Must be overridden in subclasses. Specifies how a Node is created. CreateChild uses this to create a new one and add it to the list of child nodes. This allows subclasses to not have to override CreateChild and duplicate all its functionality.

CreateChildImpl ( string name ) : Node

Must be overridden in subclasses. Specifies how a Node is created. CreateChild uses this to create a new one and add it to the list of child nodes. This allows subclasses to not have to override CreateChild and duplicate all its functionality.

MakeInverseTransform ( Vector3 position, Vector3 scale, Axiom.MathLib.Quaternion orientation, Axiom.MathLib.Matrix4 &destMatrix ) : void

Internal method for building an inverse Matrix4 from orientation / scale / position.

As makeTransform except it build the inverse given the same data as makeTransform, so performing -translation, 1/scale, -rotate in that order.

MakeTransform ( Vector3 position, Vector3 scale, Axiom.MathLib.Quaternion orientation, Axiom.MathLib.Matrix4 &destMatrix ) : void

Internal method for building a Matrix4 from orientation / scale / position.

Transform is performed in the order scale, rotate, translation, i.e. translation is independent of orientation axes, scale does not affect size of translation, rotation and scaling are always centered on the origin.

NotifyOfNewParent ( Node newParent ) : void
OnRename ( string oldName ) : void

Can be overriden in derived classes to fire an event or rekey this node in the collections which contain it

RemoveChild ( Node child, bool removeFromInternalList ) : void

Internal method to remove a child of this node, keeping it in the list of child nodes by option. Useful when enumerating the list of children while removing them too.

Update ( bool updateChildren, bool hasParentChanged ) : void

Internal method to update the Node. Updates this node and any relevant children to incorporate transforms etc. Don't call this yourself unless you are writing a SceneManager implementation.

UpdateFromParent ( ) : void

Triggers the node to update its combined transforms. This method is called internally by the engine to ask the node to update its complete transformation based on its parents derived transform.

dispose ( bool disposeManagedResources ) : void

Class level dispose method

When implementing this method in an inherited class the following template should be used; protected override void dispose( bool disposeManagedResources ) { if ( !isDisposed ) { if ( disposeManagedResources ) { // Dispose managed resources. } // There are no unmanaged resources to release, but // if we add them, they need to be released here. } // If it is available, make the call to the // base class's Dispose(Boolean) method base.dispose( disposeManagedResources ); }

Private Methods

Method Description
Clear ( ) : void

Simply clears the collection of children.

WeightedTransform ( float weight, Vector3 translate, Axiom.MathLib.Quaternion rotate, Vector3 scale ) : void

This method transforms a Node by a weighted amount from its initial state. If weighted transforms have already been applied, the previous transforms and this one are blended together based on their relative weight. This method should not be used in combination with the unweighted rotate, translate etc methods.

WeightedTransform ( float weight, Vector3 translate, Axiom.MathLib.Quaternion rotate, Vector3 scale, bool lookInMovementDirection ) : void

This method transforms a Node by a weighted amount from its initial state. If weighted transforms have already been applied, the previous transforms and this one are blended together based on their relative weight. This method should not be used in combination with the unweighted rotate, translate etc methods.

Method Details

AddChild() public method

Adds a node to the list of children of this node.
public AddChild ( Node child ) : void
child Node
return void

CancelUpdate() public method

Called by children to notify their parent that they no longer need an update.
public CancelUpdate ( Node child ) : void
child Node
return void

CreateChild() public method

Creates a new Child node.
public CreateChild ( ) : Node
return Node

CreateChild() public method

Creates a new child node.
public CreateChild ( Vector3 translate ) : Node
translate Vector3 A vector to specify the position relative to the parent.
return Node

CreateChild() public method

Creates a new child node.
public CreateChild ( Vector3 translate, Axiom.MathLib.Quaternion rotate ) : Node
translate Vector3 A vector to specify the position relative to the parent.
rotate Axiom.MathLib.Quaternion A quaternion to specify the orientation relative to the parent.
return Node

CreateChild() public method

Creates a new name child node.
public CreateChild ( string name ) : Node
name string
return Node

CreateChild() public method

Creates a new named child node.
public CreateChild ( string name, Vector3 translate ) : Node
name string Name of the node.
translate Vector3 A vector to specify the position relative to the parent.
return Node

CreateChild() public method

Creates a new named child node.
public CreateChild ( string name, Vector3 translate, Axiom.MathLib.Quaternion rotate ) : Node
name string Name of the node.
translate Vector3 A vector to specify the position relative to the parent.
rotate Axiom.MathLib.Quaternion A quaternion to specify the orientation relative to the parent.
return Node

CreateChildImpl() protected abstract method

Must be overridden in subclasses. Specifies how a Node is created. CreateChild uses this to create a new one and add it to the list of child nodes. This allows subclasses to not have to override CreateChild and duplicate all its functionality.
protected abstract CreateChildImpl ( ) : Node
return Node

CreateChildImpl() protected abstract method

Must be overridden in subclasses. Specifies how a Node is created. CreateChild uses this to create a new one and add it to the list of child nodes. This allows subclasses to not have to override CreateChild and duplicate all its functionality.
protected abstract CreateChildImpl ( string name ) : Node
name string The name of the node to add.
return Node

GetChild() public method

Gets a child node by name.
public GetChild ( string name ) : Node
name string
return Node

GetDebugRenderable() public method

public GetDebugRenderable ( ) : Node.DebugRenderable
return Node.DebugRenderable

GetDebugRenderable() public method

public GetDebugRenderable ( Real scaling ) : Node.DebugRenderable
scaling Real
return Node.DebugRenderable

GetSquaredViewDepth() public method

public GetSquaredViewDepth ( Camera camera ) : float
camera Camera
return float

GetWorldTransforms() public method

public GetWorldTransforms ( Axiom.MathLib.Matrix4 matrices ) : void
matrices Axiom.MathLib.Matrix4
return void

HasChild() public method

Whether the specified node is a child of this node.
public HasChild ( Node node ) : bool
node Node
return bool

HasChild() public method

Whether this node contains a child of the specified name
public HasChild ( string name ) : bool
name string
return bool

MakeInverseTransform() protected method

Internal method for building an inverse Matrix4 from orientation / scale / position.
As makeTransform except it build the inverse given the same data as makeTransform, so performing -translation, 1/scale, -rotate in that order.
protected MakeInverseTransform ( Vector3 position, Vector3 scale, Axiom.MathLib.Quaternion orientation, Axiom.MathLib.Matrix4 &destMatrix ) : void
position Vector3
scale Vector3
orientation Axiom.MathLib.Quaternion
destMatrix Axiom.MathLib.Matrix4
return void

MakeTransform() protected method

Internal method for building a Matrix4 from orientation / scale / position.
Transform is performed in the order scale, rotate, translation, i.e. translation is independent of orientation axes, scale does not affect size of translation, rotation and scaling are always centered on the origin.
protected MakeTransform ( Vector3 position, Vector3 scale, Axiom.MathLib.Quaternion orientation, Axiom.MathLib.Matrix4 &destMatrix ) : void
position Vector3
scale Vector3
orientation Axiom.MathLib.Quaternion
destMatrix Axiom.MathLib.Matrix4
return void

NeedUpdate() public method

To be called in the event of transform changes to this node that require its recalculation.
This not only tags the node state as being 'dirty', it also requests its parent to know about its dirtiness so it will get an update next time.
public NeedUpdate ( ) : void
return void

NeedUpdate() public method

public NeedUpdate ( bool forceParentUpdate ) : void
forceParentUpdate bool
return void

Node() public method

public Node ( ) : System
return System

Node() public method

public Node ( string name ) : System
name string
return System

NotifyOfNewParent() protected method

protected NotifyOfNewParent ( Node newParent ) : void
newParent Node
return void

OnRename() protected method

Can be overriden in derived classes to fire an event or rekey this node in the collections which contain it
protected OnRename ( string oldName ) : void
oldName string
return void

OnUpdatedFromParent() public method

public OnUpdatedFromParent ( ) : void
return void

Pitch() public method

Rotate the node around the X-axis.
public Pitch ( float degrees ) : void
degrees float
return void

Pitch() public method

Rotate the node around the X-axis.
public Pitch ( float degrees, TransformSpace relativeTo ) : void
degrees float
relativeTo TransformSpace
return void

ProcessQueuedUpdates() public static method

public static ProcessQueuedUpdates ( ) : void
return void

QueueNeedUpdate() public static method

public static QueueNeedUpdate ( Node node ) : void
node Node
return void

RemoveAllChildren() public method

Removes all child nodes attached to this node.
public RemoveAllChildren ( ) : void
return void

RemoveChild() public method

Removes the child node with the specified name.
public RemoveChild ( string name ) : Node
name string Name of the child node
return Node

RemoveChild() public method

Removes the specifed node that is a child of this node.
public RemoveChild ( Node child ) : void
child Node
return void

RemoveChild() protected method

Internal method to remove a child of this node, keeping it in the list of child nodes by option. Useful when enumerating the list of children while removing them too.
protected RemoveChild ( Node child, bool removeFromInternalList ) : void
child Node
removeFromInternalList bool
return void

RemoveFromParent() public method

Removes the node from parent node if any
public RemoveFromParent ( ) : void
return void

RequestUpdate() public method

Called by children to notify their parent that they need an update.
public RequestUpdate ( Node child ) : void
child Node
return void

ResetOrientation() public method

Resets the nodes orientation (local axes as world axes, no rotation).
public ResetOrientation ( ) : void
return void

ResetToInitialState() public method

Resets the position / orientation / scale of this node to its initial state, see SetInitialState for more info.
public ResetToInitialState ( ) : void
return void

Roll() public method

Rotate the node around the Z-axis.
public Roll ( float degrees ) : void
degrees float
return void

Roll() public method

Rotate the node around the Z-axis.
public Roll ( float degrees, TransformSpace relativeTo ) : void
degrees float
relativeTo TransformSpace
return void

Rotate() public method

Rotate the node around an arbitrary axis using a Quaternion.
public Rotate ( Axiom.MathLib.Quaternion rotation ) : void
rotation Axiom.MathLib.Quaternion
return void

Rotate() public method

Rotate the node around an arbitrary axis using a Quaternion.
public Rotate ( Axiom.MathLib.Quaternion rotation, TransformSpace relativeTo ) : void
rotation Axiom.MathLib.Quaternion
relativeTo TransformSpace
return void

Rotate() public method

Rotate the node around an arbitrary axis.
public Rotate ( Vector3 axis, float degrees ) : void
axis Vector3
degrees float
return void

Rotate() public method

Rotate the node around an arbitrary axis.
public Rotate ( Vector3 axis, float degrees, TransformSpace relativeTo ) : void
axis Vector3
degrees float
relativeTo TransformSpace
return void

ScaleBy() public method

Scales the node, combining its current scale with the passed in scaling factor.
This method applies an extra scaling factor to the node's existing scale, (unlike setScale which overwrites it) combining its current scale with the new one. E.g. calling this method twice with Vector3(2,2,2) would have the same effect as setScale(Vector3(4,4,4)) if the existing scale was 1. Note that like rotations, scalings are oriented around the node's origin.
public ScaleBy ( Vector3 factor ) : void
factor Vector3
return void

SetInitialState() public method

Sets the current transform of this node to be the 'initial state' ie that position / orientation / scale to be used as a basis for delta values used in keyframe animation.
You never need to call this method unless you plan to animate this node. If you do plan to animate it, call this method once you've loaded the node with its base state, ie the state on which all keyframes are based. If you never call this method, the initial state is the identity transform (do nothing) and a position of zero
public SetInitialState ( ) : void
return void

Translate() public method

Moves the node along arbitrary axes.
This method translates the node by a vector which is relative to a custom set of axes.
public Translate ( Matrix3 axes, Vector3 move ) : void
axes Matrix3 3x3 Matrix containg 3 column vectors each representing the /// X, Y and Z axes respectively. In this format the standard cartesian axes would be expressed as: /// 1 0 0 /// 0 1 0 /// 0 0 1 /// i.e. The Identity matrix. ///
move Vector3 Vector relative to the supplied axes.
return void

Translate() public method

Moves the node along arbitrary axes.
This method translates the node by a vector which is relative to a custom set of axes.
public Translate ( Matrix3 axes, Vector3 move, TransformSpace relativeTo ) : void
axes Matrix3 3x3 Matrix containg 3 column vectors each representing the /// X, Y and Z axes respectively. In this format the standard cartesian axes would be expressed as: /// 1 0 0 /// 0 1 0 /// 0 0 1 /// i.e. The Identity matrix. ///
move Vector3 Vector relative to the supplied axes.
relativeTo TransformSpace
return void

Translate() public method

Moves the node along the cartesian axes. This method moves the node by the supplied vector along the world cartesian axes, i.e. along world x,y,z
public Translate ( Vector3 translate ) : void
translate Vector3 Vector with x,y,z values representing the translation.
return void

Translate() public method

Moves the node along the cartesian axes. This method moves the node by the supplied vector along the world cartesian axes, i.e. along world x,y,z
public Translate ( Vector3 translate, TransformSpace relativeTo ) : void
translate Vector3 Vector with x,y,z values representing the translation.
relativeTo TransformSpace
return void

Update() protected method

Internal method to update the Node. Updates this node and any relevant children to incorporate transforms etc. Don't call this yourself unless you are writing a SceneManager implementation.
protected Update ( bool updateChildren, bool hasParentChanged ) : void
updateChildren bool If true, the update cascades down to all children. Specify false if you wish to /// update children separately, e.g. because of a more selective SceneManager implementation.
hasParentChanged bool if true then this will update its derived properties (scale, orientation, position) accoarding to the parent's
return void

UpdateFromParent() protected method

Triggers the node to update its combined transforms. This method is called internally by the engine to ask the node to update its complete transformation based on its parents derived transform.
protected UpdateFromParent ( ) : void
return void

Yaw() public method

Rotate the node around the Y-axis.
public Yaw ( float degrees ) : void
degrees float
return void

Yaw() public method

Rotate the node around the Y-axis.
public Yaw ( float degrees, TransformSpace relativeTo ) : void
degrees float
relativeTo TransformSpace
return void

dispose() protected method

Class level dispose method
When implementing this method in an inherited class the following template should be used; protected override void dispose( bool disposeManagedResources ) { if ( !isDisposed ) { if ( disposeManagedResources ) { // Dispose managed resources. } // There are no unmanaged resources to release, but // if we add them, they need to be released here. } // If it is available, make the call to the // base class's Dispose(Boolean) method base.dispose( disposeManagedResources ); }
protected dispose ( bool disposeManagedResources ) : void
disposeManagedResources bool True if Unmanaged resources should be released.
return void

Property Details

accumAnimWeight protected_oe property

Weight of applied animations so far, used for blending.
protected float accumAnimWeight
return float

cachedRelativeTransform protected_oe property

Cached relative transform as a 4x4 matrix.
protected Matrix4,Axiom.MathLib cachedRelativeTransform
return Axiom.MathLib.Matrix4

cachedTransform protected_oe property

Cached derived transform as a 4x4 matrix.
protected Matrix4,Axiom.MathLib cachedTransform
return Axiom.MathLib.Matrix4

childNodes protected_oe property

Collection of this nodes child nodes.
protected NodeCollection,Axiom.Collections childNodes
return Axiom.Collections.NodeCollection

childrenToUpdate protected_oe property

Collection of this nodes child nodes.
protected NodeCollection,Axiom.Collections childrenToUpdate
return Axiom.Collections.NodeCollection

customParams protected_oe property

protected List customParams
return List

derivedOrientation protected_oe property

World orientation of this node based on parents orientation.
protected Quaternion,Axiom.MathLib derivedOrientation
return Axiom.MathLib.Quaternion

derivedPosition protected_oe property

protected Vector3 derivedPosition
return Vector3

derivedScale protected_oe property

protected Vector3 derivedScale
return Vector3

inheritOrientation protected_oe property

protected bool inheritOrientation
return bool

inheritScale protected_oe property

protected bool inheritScale
return bool

initialOrientation protected_oe property

Original orientation of this node, used for resetting to original.
protected Quaternion,Axiom.MathLib initialOrientation
return Axiom.MathLib.Quaternion

initialPosition protected_oe property

protected Vector3 initialPosition
return Vector3

initialScale protected_oe property

protected Vector3 initialScale
return Vector3

isParentNotified protected_oe property

Flag indicating that parent has been notified about update request.
protected bool isParentNotified
return bool

material protected_oe static_oe property

protected static Material,Axiom.Graphics material
return Axiom.Graphics.Material

name protected_oe property

Name of this node.
protected string name
return string

needChildUpdate protected_oe property

Flag to indicate all children need to be updated.
protected bool needChildUpdate
return bool

needParentUpdate protected_oe property

Flag to indicate own transform from parent is out of date.
protected bool needParentUpdate
return bool

needRelativeTransformUpdate protected_oe property

protected bool needRelativeTransformUpdate
return bool

needTransformUpdate protected_oe property

protected bool needTransformUpdate
return bool

nextUnnamedNodeExtNum protected_oe static_oe property

protected static long nextUnnamedNodeExtNum
return long

nodeMaterial protected_oe property

Material to be used is this node itself will be rendered (axes, or bones).
protected Material,Axiom.Graphics nodeMaterial
return Axiom.Graphics.Material

nodeSubMesh protected_oe property

SubMesh to be used is this node itself will be rendered (axes, or bones).
protected SubMesh,Axiom.Core nodeSubMesh
return SubMesh

orientation protected_oe property

Orientation of this node relative to its parent.
protected Quaternion,Axiom.MathLib orientation
return Axiom.MathLib.Quaternion

parent protected_oe property

Parent node (if any)
protected Node,Axiom.Core parent
return Node

position protected_oe property

Position of this node relative to its parent.
protected Vector3 position
return Vector3

rotationFromInitial protected_oe property

protected Quaternion,Axiom.MathLib rotationFromInitial
return Axiom.MathLib.Quaternion

scale protected_oe property

protected Vector3 scale
return Vector3

scaleFromInitial protected_oe property

protected Vector3 scaleFromInitial
return Vector3

subMesh protected_oe static_oe property

protected static SubMesh,Axiom.Core subMesh
return SubMesh

suppressUpdateEvent protected_oe property

protected bool suppressUpdateEvent
return bool

translationFromInitial protected_oe property

protected Vector3 translationFromInitial
return Vector3