C# Class Axiom.Core.SceneNode

Represents a node in a scene graph.
A SceneNode is a type of Node which is used to organize 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.
Inheritance: Node
Afficher le fichier Open project: WolfgangSt/axiom Class Usage Examples

Protected Properties

Свойство Type Description
autoTrackLocalDirection Vector3
autoTrackOffset Vector3
autoTrackTarget SceneNode
creator SceneManager
isInSceneGraph bool
isYawFixed bool
lightList LightList
lightListDirty bool
objectList Axiom.Collections.MovableObjectCollection
showBoundingBox bool
visible bool
wireBox WireBoundingBox
worldAABB Axiom.Math.AxisAlignedBox
worldBoundingSphere Axiom.Math.Sphere
yawFixedAxis Vector3

Méthodes publiques

Méthode Description
AddBoundingBoxToQueue ( RenderQueue queue ) : void

Adds this nodes bounding box (wireframe) to the RenderQueue.

AttachObject ( Axiom.Core.MovableObject obj ) : void

Attaches a MovableObject to this scene node.

A MovableObject will not show up in the scene until it is attached to a SceneNode.

CreateChildSceneNode ( ) : SceneNode

Creates a new child scene node.

CreateChildSceneNode ( Vector3 translate ) : SceneNode

Creates a new child scene node.

CreateChildSceneNode ( Vector3 translate, Quaternion rotate ) : SceneNode

Creates a new child scene node.

CreateChildSceneNode ( string name ) : SceneNode

Creates a new name child node.

CreateChildSceneNode ( string name, Vector3 translate ) : SceneNode

Creates a new named child scene node.

CreateChildSceneNode ( string name, Vector3 translate, Quaternion rotate ) : SceneNode

Creates a new named child scene node.

DetachAllObjects ( ) : void

Removes all currently attached SceneObjects from this SceneNode.

Bounds for this SceneNode are also updated.

DetachObject ( Axiom.Core.MovableObject obj ) : void

Removes the specifed object from this scene node.

Bounds for this SceneNode are also updated.

FindLights ( float radius ) : LightList

Allows retrieval of the nearest lights to the center of this SceneNode.

This method allows a list of lights, ordered by proximity to the center of this SceneNode, to be retrieved. Multiple access to this method when neither the node nor the lights have moved will result in the same list being returned without recalculation. Can be useful when implementing IRenderable.Lights.

FindVisibleObjects ( Camera camera, RenderQueue queue ) : void

Overloaded method.

FindVisibleObjects ( Camera camera, RenderQueue queue, bool includeChildren, bool displayNodes ) : void

Overloaded method.

FindVisibleObjects ( Camera camera, RenderQueue queue, bool includeChildren, bool displayNodes, bool onlyShadowCasters ) : void

Internal method which locates any visible objects attached to this node and adds them to the passed in queue.

GetDebugRenderable ( ) : Node.DebugRenderable
GetObject ( int index ) : Axiom.Core.MovableObject

Returns a movable object attached to this node by index. Node that this method is O(n), whereas the string overload of this method is O(1). Use the string version of this method if speed is important.

GetObject ( string name ) : Axiom.Core.MovableObject

Returns a movable object attached to this node by name. Node that this method is O(n), whereas the integer overload of this method is O(1). Use the integer version of this method if speed is important.

LookAt ( Vector3 target, TransformSpace relativeTo ) : void
LookAt ( Vector3 target, TransformSpace relativeTo, Vector3 localDirection ) : void

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

NotifyAttachedObjectNameChanged ( Axiom.Core.MovableObject obj ) : void

Rekeys the scene object using its new Name

RemoveAndDestroyAllChildren ( ) : void

Removes and destroys all children in the subtree of this node.

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

RemoveAndDestroyChild ( SceneNode sceneNode ) : void

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

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 ( String name ) : void

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

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.

SceneNode ( SceneManager creator ) : System

Basic constructor. Takes a scene manager reference to record the creator.

Can be created manually, but should be left the Create* Methods.

SceneNode ( SceneManager creator, string name ) : System

Overloaded constructor. Takes a scene manager reference to record the creator, and a name for the node.

SetAsRootNode ( ) : void

Only called by SceneManagers

SetAutoTracking ( bool enabled ) : void
SetAutoTracking ( bool enabled, SceneNode target ) : void
SetAutoTracking ( bool enabled, SceneNode target, Vector3 localDirection ) : void
SetAutoTracking ( bool enabled, SceneNode target, Vector3 localDirection, Vector3 offset ) : void

Enables / disables automatic tracking of another SceneNode.

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.

SetDirection ( Real x, Real y, Real z ) : void
SetDirection ( Real x, Real y, Real z, TransformSpace relativeTo ) : void
SetDirection ( Real x, Real y, Real z, TransformSpace relativeTo, Vector3 localDirectionVector ) : void

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

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 the property.

SetDirection ( Vector3 vec ) : void
SetDirection ( Vector3 vec, TransformSpace relativeTo ) : void
SetDirection ( Vector3 vec, TransformSpace relativeTo, Vector3 localDirection ) : void

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

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 the property.

SetFixedYawAxis ( bool useFixed ) : void

Sets a default fixed yaw axis of Y.

SetFixedYawAxis ( bool useFixed, Vector3 fixedAxis ) : void

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

This method allows you to change the yaw behavior of the node - by default, it yaws around it's own local Y axis when told to yaw with TransformSpace.Local, this makes it yaw around a fixed axis. You only really need this when you're using auto tracking (SetAutoTracking(bool), because when you're manually rotating a node you can specify the TransformSpace in which you wish to work anyway.

Yaw ( float degrees ) : void

Overridden to apply fixed yaw axis behavior.

Méthodes protégées

Méthode Description
CreateChildImpl ( ) : Node

CreateChildImpl ( string name ) : Node

OnRename ( string oldName ) : void
Update ( bool updateChildren, bool hasParentChanged ) : void

Internal method to update the Node.

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

UpdateBounds ( ) : void

Tell the SceneNode to update the world bound info it stores.

UpdateFromParent ( ) : void

dispose ( bool disposeManagedResources ) : void

Private Methods

Méthode Description
AutoTrack ( ) : void

Internal method used to update auto-tracking scene nodes.

Clear ( ) : void

Need to clear list of child objects in addition to base class functionality.

Method Details

AddBoundingBoxToQueue() public méthode

Adds this nodes bounding box (wireframe) to the RenderQueue.
public AddBoundingBoxToQueue ( RenderQueue queue ) : void
queue Axiom.Graphics.RenderQueue
Résultat void

AttachObject() public méthode

Attaches a MovableObject to this scene node.
A MovableObject will not show up in the scene until it is attached to a SceneNode.
public AttachObject ( Axiom.Core.MovableObject obj ) : void
obj Axiom.Core.MovableObject
Résultat void

CreateChildImpl() protected méthode

protected CreateChildImpl ( ) : Node
Résultat Node

CreateChildImpl() protected méthode

protected CreateChildImpl ( string name ) : Node
name string
Résultat Node

CreateChildSceneNode() public méthode

Creates a new child scene node.
public CreateChildSceneNode ( ) : SceneNode
Résultat SceneNode

CreateChildSceneNode() public méthode

Creates a new child scene node.
public CreateChildSceneNode ( Vector3 translate ) : SceneNode
translate Vector3 A vector to specify the position relative to the parent.
Résultat SceneNode

CreateChildSceneNode() public méthode

Creates a new child scene node.
public CreateChildSceneNode ( Vector3 translate, Quaternion rotate ) : SceneNode
translate Vector3 A vector to specify the position relative to the parent.
rotate Axiom.Math.Quaternion A quaternion to specify the orientation relative to the parent.
Résultat SceneNode

CreateChildSceneNode() public méthode

Creates a new name child node.
public CreateChildSceneNode ( string name ) : SceneNode
name string
Résultat SceneNode

CreateChildSceneNode() public méthode

Creates a new named child scene node.
public CreateChildSceneNode ( string name, Vector3 translate ) : SceneNode
name string Name of the node.
translate Vector3 A vector to specify the position relative to the parent.
Résultat SceneNode

CreateChildSceneNode() public méthode

Creates a new named child scene node.
public CreateChildSceneNode ( string name, Vector3 translate, Quaternion rotate ) : SceneNode
name string Name of the node.
translate Vector3 A vector to specify the position relative to the parent.
rotate Axiom.Math.Quaternion A quaternion to specify the orientation relative to the parent.
Résultat SceneNode

DetachAllObjects() public méthode

Removes all currently attached SceneObjects from this SceneNode.
Bounds for this SceneNode are also updated.
public DetachAllObjects ( ) : void
Résultat void

DetachObject() public méthode

Removes the specifed object from this scene node.
Bounds for this SceneNode are also updated.
public DetachObject ( Axiom.Core.MovableObject obj ) : void
obj Axiom.Core.MovableObject Reference to the object to remove.
Résultat void

FindLights() public méthode

Allows retrieval of the nearest lights to the center of this SceneNode.
This method allows a list of lights, ordered by proximity to the center of this SceneNode, to be retrieved. Multiple access to this method when neither the node nor the lights have moved will result in the same list being returned without recalculation. Can be useful when implementing IRenderable.Lights.
public FindLights ( float radius ) : LightList
radius float Parameter to specify lights intersecting a given radius of /// this SceneNode's centre
Résultat LightList

FindVisibleObjects() public méthode

Overloaded method.
public FindVisibleObjects ( Camera camera, RenderQueue queue ) : void
camera Camera
queue Axiom.Graphics.RenderQueue
Résultat void

FindVisibleObjects() public méthode

Overloaded method.
public FindVisibleObjects ( Camera camera, RenderQueue queue, bool includeChildren, bool displayNodes ) : void
camera Camera
queue Axiom.Graphics.RenderQueue
includeChildren bool
displayNodes bool
Résultat void

FindVisibleObjects() public méthode

Internal method which locates any visible objects attached to this node and adds them to the passed in queue.
public FindVisibleObjects ( Camera camera, RenderQueue queue, bool includeChildren, bool displayNodes, bool onlyShadowCasters ) : void
camera Camera Active camera.
queue Axiom.Graphics.RenderQueue Queue to which these objects should be added.
includeChildren bool If true, cascades down to all children.
displayNodes bool Renders the local axes for the node.
onlyShadowCasters bool
Résultat void

GetDebugRenderable() public méthode

public GetDebugRenderable ( ) : Node.DebugRenderable
Résultat Node.DebugRenderable

GetObject() public méthode

Returns a movable object attached to this node by index. Node that this method is O(n), whereas the string overload of this method is O(1). Use the string version of this method if speed is important.
public GetObject ( int index ) : Axiom.Core.MovableObject
index int The index of the object to return.
Résultat Axiom.Core.MovableObject

GetObject() public méthode

Returns a movable object attached to this node by name. Node that this method is O(n), whereas the integer overload of this method is O(1). Use the integer version of this method if speed is important.
public GetObject ( string name ) : Axiom.Core.MovableObject
name string The name of the object to return.
Résultat Axiom.Core.MovableObject

LookAt() public méthode

public LookAt ( Vector3 target, TransformSpace relativeTo ) : void
target Vector3
relativeTo TransformSpace
Résultat void

LookAt() public méthode

Points the local Z direction of this node at a point in space.
public LookAt ( Vector3 target, TransformSpace relativeTo, Vector3 localDirection ) : void
target Vector3 A vector specifying the look at point.
relativeTo TransformSpace The space in which the point resides.
localDirection Vector3 /// The vector which normally describes the natural direction of the node, usually -Z. ///
Résultat void

NotifyAttachedObjectNameChanged() public méthode

Rekeys the scene object using its new Name
public NotifyAttachedObjectNameChanged ( Axiom.Core.MovableObject obj ) : void
obj Axiom.Core.MovableObject
Résultat void

OnRename() protected méthode

protected OnRename ( string oldName ) : void
oldName string
Résultat void

RemoveAndDestroyAllChildren() public méthode

Removes and destroys all children in the subtree of this node.
Use this to destroy all nodes found in the child subtree of this node and remove them from the scene graph. Note that all objects attached to the nodes will be detached but will not be destroyed.
public RemoveAndDestroyAllChildren ( ) : void
Résultat void

RemoveAndDestroyChild() public méthode

This method removes and destroys the child and all of its children.
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.

public RemoveAndDestroyChild ( SceneNode sceneNode ) : void
sceneNode SceneNode The node to remove and destroy
Résultat void

RemoveAndDestroyChild() public méthode

This method removes and destroys the child and all of its children.
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.

public RemoveAndDestroyChild ( String name ) : void
name String name of the node to remove and destroy
Résultat void

SceneNode() public méthode

Basic constructor. Takes a scene manager reference to record the creator.
Can be created manually, but should be left the Create* Methods.
public SceneNode ( SceneManager creator ) : System
creator SceneManager
Résultat System

SceneNode() public méthode

Overloaded constructor. Takes a scene manager reference to record the creator, and a name for the node.
public SceneNode ( SceneManager creator, string name ) : System
creator SceneManager
name string
Résultat System

SetAsRootNode() public méthode

Only called by SceneManagers
public SetAsRootNode ( ) : void
Résultat void

SetAutoTracking() public méthode

public SetAutoTracking ( bool enabled ) : void
enabled bool
Résultat void

SetAutoTracking() public méthode

public SetAutoTracking ( bool enabled, SceneNode target ) : void
enabled bool
target SceneNode
Résultat void

SetAutoTracking() public méthode

public SetAutoTracking ( bool enabled, SceneNode target, Vector3 localDirection ) : void
enabled bool
target SceneNode
localDirection Vector3
Résultat void

SetAutoTracking() public méthode

Enables / disables automatic tracking of another SceneNode.
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.
public SetAutoTracking ( bool enabled, SceneNode target, Vector3 localDirection, Vector3 offset ) : void
enabled bool /// If true, tracking will be enabled and the 'target' cannot be null. /// If false tracking will be disabled and the current orientation will be maintained. ///
target SceneNode /// Reference to the SceneNode to track. Can be null if and only if the enabled param is false. ///
localDirection Vector3 /// The local vector considered to be the usual 'direction' /// of the node; normally the local -Z but can be another direction. ///
offset Vector3 /// If 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. ///
Résultat void

SetDirection() public méthode

public SetDirection ( Real x, Real y, Real z ) : void
x Real
y Real
z Real
Résultat void

SetDirection() public méthode

public SetDirection ( Real x, Real y, Real z, TransformSpace relativeTo ) : void
x Real
y Real
z Real
relativeTo TransformSpace
Résultat void

SetDirection() public méthode

Sets the node's direction vector ie it's local -z.
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 the property.
public SetDirection ( Real x, Real y, Real z, TransformSpace relativeTo, Vector3 localDirectionVector ) : void
x Real The x component of the direction vector.
y Real The y component of the direction vector.
z Real The z component of the direction vector.
relativeTo TransformSpace The space in which this direction vector is expressed.
localDirectionVector Vector3 The vector which normally describes the natural direction /// of the node, usually -Z. ///
Résultat void

SetDirection() public méthode

public SetDirection ( Vector3 vec ) : void
vec Vector3
Résultat void

SetDirection() public méthode

public SetDirection ( Vector3 vec, TransformSpace relativeTo ) : void
vec Vector3
relativeTo TransformSpace
Résultat void

SetDirection() public méthode

Sets the node's direction vector ie it's local -z.
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 the property.
public SetDirection ( Vector3 vec, TransformSpace relativeTo, Vector3 localDirection ) : void
vec Vector3 The direction vector.
relativeTo TransformSpace The space in which this direction vector is expressed.
localDirection Vector3 The vector which normally describes the natural direction /// of the node, usually -Z. ///
Résultat void

SetFixedYawAxis() public méthode

Sets a default fixed yaw axis of Y.
public SetFixedYawAxis ( bool useFixed ) : void
useFixed bool
Résultat void

SetFixedYawAxis() public méthode

Tells the node whether to yaw around it's own local Y axis or a fixed axis of choice.
This method allows you to change the yaw behavior of the node - by default, it yaws around it's own local Y axis when told to yaw with TransformSpace.Local, this makes it yaw around a fixed axis. You only really need this when you're using auto tracking (SetAutoTracking(bool), because when you're manually rotating a node you can specify the TransformSpace in which you wish to work anyway.
public SetFixedYawAxis ( bool useFixed, Vector3 fixedAxis ) : void
useFixed bool /// If 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 behavior. ///
fixedAxis Vector3 The axis to use if the first parameter is true.
Résultat void

Update() protected méthode

Internal method to update the Node.
Updates this scene 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
hasParentChanged bool
Résultat void

UpdateBounds() protected méthode

Tell the SceneNode to update the world bound info it stores.
protected UpdateBounds ( ) : void
Résultat void

UpdateFromParent() protected méthode

protected UpdateFromParent ( ) : void
Résultat void

Yaw() public méthode

Overridden to apply fixed yaw axis behavior.
public Yaw ( float degrees ) : void
degrees float
Résultat void

dispose() protected méthode

protected dispose ( bool disposeManagedResources ) : void
disposeManagedResources bool
Résultat void

Property Details

autoTrackLocalDirection protected_oe property

Local 'normal' direction vector.
protected Vector3 autoTrackLocalDirection
Résultat Vector3

autoTrackOffset protected_oe property

Tracking offset for fine tuning.
protected Vector3 autoTrackOffset
Résultat Vector3

autoTrackTarget protected_oe property

Auto tracking target.
protected SceneNode,Axiom.Core autoTrackTarget
Résultat SceneNode

creator protected_oe property

Reference to the scene manager who created me.
protected SceneManager,Axiom.Core creator
Résultat SceneManager

isInSceneGraph protected_oe property

Is this node a current part of the scene graph?
protected bool isInSceneGraph
Résultat bool

isYawFixed protected_oe property

Where to yaw around a fixed axis.
protected bool isYawFixed
Résultat bool

lightList protected_oe property

List of lights within range of this node.
protected LightList lightList
Résultat LightList

lightListDirty protected_oe property

Keeps track of whether the list of lights located near this node needs updating.
protected bool lightListDirty
Résultat bool

objectList protected_oe property

A collection of all objects attached to this scene node.
protected MovableObjectCollection,Axiom.Collections objectList
Résultat Axiom.Collections.MovableObjectCollection

showBoundingBox protected_oe property

Whether or not to display this node's bounding box.
protected bool showBoundingBox
Résultat bool

visible protected_oe property

Determines whether node and children are visible or not.
protected bool visible
Résultat bool

wireBox protected_oe property

Renderable bounding box for this node.
protected WireBoundingBox,Axiom.Core wireBox
Résultat WireBoundingBox

worldAABB protected_oe property

Bounding box. Updated through Update.
protected AxisAlignedBox,Axiom.Math worldAABB
Résultat Axiom.Math.AxisAlignedBox

worldBoundingSphere protected_oe property

Word bounding sphere surrounding this node.
protected Sphere,Axiom.Math worldBoundingSphere
Résultat Axiom.Math.Sphere

yawFixedAxis protected_oe property

Fixed axis to yaw around.
protected Vector3 yawFixedAxis
Résultat Vector3