Packagesandy.core.scenegraph
Classpublic class Node
SubclassesATransformable, Group

ABSTRACT CLASS - Base class for all nodes in the object tree.

The base class for all Group and object nodes, that handles all basic operations on a tree node.



Public Properties
 PropertyDefined by
  boundingBox : BBox
The bounding box of this node IMPORTANT: Do not modify it unless you perfectly know what you are doing
Node
  boundingSphere : BSphere
The bounding sphere of this node IMPORTANT: Do not modify it unless you perfectly know what you are doing
Node
  broadcaster : BubbleEventBroadcaster
[read-only] The broadcaster

The broadcaster is used to send events to listeners.
This property is a BubbleEventBroadcaster.

Node
  changed : Boolean = false
This property set the cache status of the current node.
Node
  children : Array
The children of this node are stored inside this array.
Node
  culled : CullingState
This property represent the culling state of the current node.
Node
  modelMatrix : Matrix4
Cached matrix corresponding to the transformation to the 0,0,0 frame system
Node
  name : String
Name of this node.
Node
  parent : Node
The parent node of this node.
Node
  scene : Scene3D = null
Reference to the scene is it linked to.
Node
  viewMatrix : Matrix4
Cached matrix corresponding to the transformation to the camera frame system
Node
  visible : Boolean = true
Specify the visibility of this node.
Node
Protected Properties
 PropertyDefined by
  m_oEB : BubbleEventBroadcaster
Node
Public Methods
 MethodDefined by
  
Node(p_sName:String = "")
Creates a node in the object tree of the world.
Node
  
addChild(p_oChild:Node):void
Adds a new child to this node.
Node
  
addEventListener(p_sEvt:String, p_oL:*):void
Adds a listener for the specified event.
Node
  
cull(p_oScene:Scene3D, p_oFrustum:Frustum, p_oViewMatrix:Matrix4, p_bChanged:Boolean):void
Tests this node against the frustum volume to get its visibility.
Node
  
destroy():void
Delete this node and all its child nodes.
Node
  
getChildByName(p_sName:String, p_bRecurs:Boolean = false):Node
Returns the child node with the specified name.
Node
  
getChildFromId(p_nId:uint, p_bRecurs:Boolean = false):Node
Returns the child node with the specified id.
Node
  
getChildList():Array
Returns an array with all child nodes of this node.
Node
  
hasParent():Boolean
Tests if this node has a parent.
Node
  
isParent(p_oNode:Node):Boolean
Tests if the node passed in the argument is parent of this node.
Node
  
remove():void
Removes this node from the node tree, saving its child nodes.
Node
  
removeChildById(p_nId:Number):Boolean
Removes the child node with the specified id.
Node
  
removeChildByName(p_sName:String):Boolean
Removes the child node with the specified name.
Node
  
removeEventListener(p_sEvt:String, p_oL:*):void
Removes a listener for the specified event.
Node
  
render(p_oScene:Scene3D, p_oCamera:Camera3D):void
Renders this node.
Node
  
swapParent(p_oNewParent:Node):void
Moves this node to another parent node.
Node
  
toString():String
Returns a string representation of this object
Node
  
update(p_oScene:Scene3D, p_oModelMatrix:Matrix4, p_bChanged:Boolean):void
Updates this node.
Node
Public Constants
 ConstantDefined by
  id : uint
The unique id of this node in the node graph.
Node
Property detail
boundingBoxproperty
public var boundingBox:BBox

The bounding box of this node IMPORTANT: Do not modify it unless you perfectly know what you are doing

boundingSphereproperty 
public var boundingSphere:BSphere

The bounding sphere of this node IMPORTANT: Do not modify it unless you perfectly know what you are doing

broadcasterproperty 
broadcaster:BubbleEventBroadcaster  [read-only]

The broadcaster

The broadcaster is used to send events to listeners.
This property is a BubbleEventBroadcaster.

Implementation
    public function get broadcaster():BubbleEventBroadcaster
changedproperty 
public var changed:Boolean = false

This property set the cache status of the current node. IMPORTANT Currently this property isn't used!

childrenproperty 
public var children:Array

The children of this node are stored inside this array. IMPORTANT: Use this property mainly as READ ONLY. To add, delete or search a specific child, you can use the specific method to do that

culledproperty 
public var culled:CullingState

This property represent the culling state of the current node. This state is defined during the culling phasis as it refers to the position of the object against the viewing frustum.

modelMatrixproperty 
public var modelMatrix:Matrix4

Cached matrix corresponding to the transformation to the 0,0,0 frame system

m_oEBproperty 
protected var m_oEB:BubbleEventBroadcaster
nameproperty 
public var name:String

Name of this node. Of no name is specified, the unique ID of the node will be used

parentproperty 
parent:Node  [read-write]

The parent node of this node.

The reference is null if this nod has no parent (for exemple for a root node).

Implementation
    public function get parent():Node
    public function set parent(value:Node):void
sceneproperty 
public var scene:Scene3D = null

Reference to the scene is it linked to. Initialized at null.

viewMatrixproperty 
public var viewMatrix:Matrix4

Cached matrix corresponding to the transformation to the camera frame system

visibleproperty 
public var visible:Boolean = true

Specify the visibility of this node. If true, the node is visible, if fase, it will not be displayed.

Constructor detail
Node()constructor
public function Node(p_sName:String = "")

Creates a node in the object tree of the world.

This constructor should normally not be called directly, only from a sub class.

Parameters
p_sName:String (default = "") — A string identifier for this object.
Method detail
addChild()method
public function addChild(p_oChild:Node):void

Adds a new child to this node.

A node can have several children, and when you add a child to a node, it is automatically connected to the parent node through its parent property.

Parameters
p_oChild:Node — The child node to add
addEventListener()method 
public function addEventListener(p_sEvt:String, p_oL:*):void

Adds a listener for the specified event.

Parameters
p_sEvt:String — Name of the Event.
 
p_oL:* — Listener object.
cull()method 
public function cull(p_oScene:Scene3D, p_oFrustum:Frustum, p_oViewMatrix:Matrix4, p_bChanged:Boolean):void

Tests this node against the frustum volume to get its visibility.

If the node and its children aren't in the frustum, the node is set to cull and will not be displayed.

The method also updates the bounding volumes, to make a more accurate culling system possible.
First the bounding sphere is updated, and if intersecting, the bounding box is updated to perform a more precise culling.

[MANDATORY] The update method must be called first!

Parameters
p_oScene:Scene3D — The current scene
 
p_oFrustum:Frustum — The frustum of the current camera
 
p_oViewMatrix:Matrix4[ToDo: explain]
 
p_bChanged:Boolean[ToDo: explain]
destroy()method 
public function destroy():void

Delete this node and all its child nodes.

This node nad all its child nodes are deleted, including all data they are storing.
The method makes recursive calls to the destroy method of the child nodes.

getChildByName()method 
public function getChildByName(p_sName:String, p_bRecurs:Boolean = false):Node

Returns the child node with the specified name.

Parameters
p_sName:String — The name of the child you want to retrieve
 
p_bRecurs:Boolean (default = false) — Set to true if you want to search the the children for the requested node

Returns
Node — The requested node or null if no child with this name was found
getChildFromId()method 
public function getChildFromId(p_nId:uint, p_bRecurs:Boolean = false):Node

Returns the child node with the specified id.

Parameters
p_nId:uint — The id of the child you want to retrieve
 
p_bRecurs:Boolean (default = false) — Set to true if you want to search the the children for the requested node

Returns
Node — The requested node or null if no child with this is was found
getChildList()method 
public function getChildList():Array

Returns an array with all child nodes of this node. Note : the public children property can by used too

Returns
Array — The array of childs nodes
hasParent()method 
public function hasParent():Boolean

Tests if this node has a parent.

Returns
Boolean — true if this node has a parent, false otherwise.
isParent()method 
public function isParent(p_oNode:Node):Boolean

Tests if the node passed in the argument is parent of this node.

Parameters
p_oNode:Node — The node you are testing

Returns
Boolean — true if the node in the argument is the parent of this node, false otherwise.
remove()method 
public function remove():void

Removes this node from the node tree, saving its child nodes.

NOTE that remove method only remove the current node and NOT its children!
To remove the current node and all its children please refer to the destroy method.

The child nodes of this node becomes child nodes of this node's parent.

removeChildById()method 
public function removeChildById(p_nId:Number):Boolean

Removes the child node with the specified id.

All the children of the node you want to remove are lost.
The link between them and the rest of the tree is broken, and they will not be rendered anymore!

The object itself and its children are still in memory!
If you want to free them completely, call child.destroy()

Parameters
p_nId:Number — The id of the child you want to remove

Returns
Boolean — true if the node was removed from node tree, false otherwise.
removeChildByName()method 
public function removeChildByName(p_sName:String):Boolean

Removes the child node with the specified name.

All children of the node you want to remove are lost.
The link between them and the rest of the tree is broken, and they will not be rendered anymore!

The object itself and its children are still in memory!
If you want to free them completely, call child.destroy()

Parameters
p_sName:String — The name of the node you want to remove.

Returns
Boolean — true if the node was removed from node tree, false otherwise.
removeEventListener()method 
public function removeEventListener(p_sEvt:String, p_oL:*):void

Removes a listener for the specified event.

Parameters
p_sEvt:String — Name of the Event.
 
p_oL:* — Listener object.
render()method 
public function render(p_oScene:Scene3D, p_oCamera:Camera3D):void

Renders this node.

Overridden in sub classes

Parameters
p_oScene:Scene3D — p_oScene The current scene
 
p_oCamera:Camera3D — p_oCamera The camera of the world
swapParent()method 
public function swapParent(p_oNewParent:Node):void

Moves this node to another parent node.

This node is removed from its current parent node, and added as a child of the specified node

Parameters
p_oNewParent:Node — The node to become parent of this node
toString()method 
public function toString():String

Returns a string representation of this object

Returns
String — The fully qualified name of this class
update()method 
public function update(p_oScene:Scene3D, p_oModelMatrix:Matrix4, p_bChanged:Boolean):void

Updates this node.

For a node with transformation, this method updateS the transformation taking into account the matrix cache system.

[ToDo : Explain the parameters and what they do with more details]

Parameters
p_oScene:Scene3D — The current scene
 
p_oModelMatrix:Matrix4
 
p_bChanged:Boolean
Constant detail
idconstant
public const id:uint

The unique id of this node in the node graph.

This value is very useful to retrieve a specific node.