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
  appearance : Appearance
[write-only] Set that appearance to all the children of that node
Node
  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
  culled : CullingState
This property represent the culling state of the current node.
Node
  enableBackFaceCulling : Boolean
[write-only] Change the backface culling state to all the shapes objects in the children list
Node
  enableEvents : Boolean
[write-only] Enable event handling to all the children objects that can broadcast bubbling events
Node
  enableInteractivity : Boolean
[write-only] Change the interactivity of all the children
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
  useSingleContainer : Boolean
[write-only] Make all the Shape3D and descendants children react to this value.
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
  
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
  
perform(p_iOperation:INodeOperation):void
Performs an operation on this node and all of its children.
Node
  
remove():void
Removes this node from the node tree, saving its child nodes.
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
  children : Array
The children of this node are stored inside this array.
Node
  id : uint
The unique id of this node in the node graph.
Node
  modelMatrix : Matrix4
Cached matrix corresponding to the transformation to the 0,0,0 frame system
Node
  viewMatrix : Matrix4
Cached matrix corresponding to the transformation to the camera frame system
Node
Property detail
appearanceproperty
appearance:Appearance  [write-only]

Set that appearance to all the children of that node

Implementation
    public function set appearance(value:Appearance):void
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!

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.

enableBackFaceCullingproperty 
enableBackFaceCulling:Boolean  [write-only]

Change the backface culling state to all the shapes objects in the children list

Implementation
    public function set enableBackFaceCulling(value:Boolean):void
enableEventsproperty 
enableEvents:Boolean  [write-only]

Enable event handling to all the children objects that can broadcast bubbling events

Implementation
    public function set enableEvents(value:Boolean):void
enableInteractivityproperty 
enableInteractivity:Boolean  [write-only]

Change the interactivity of all the children

Implementation
    public function set enableInteractivity(value:Boolean):void
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.

useSingleContainerproperty 
useSingleContainer:Boolean  [write-only]

Make all the Shape3D and descendants children react to this value.

Implementation
    public function set useSingleContainer(value:Boolean):void
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
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.
perform()method 
public function perform(p_iOperation:INodeOperation):void

Performs an operation on this node and all of its children.

Traverses the subtree made up of this node and all of its children. While traversing the subtree, individual operations are performed on entry and exit of each node of the subtree.

Implements the visitor design pattern: Using the visitor design pattern, you can define a new operation on Node and its subclasses without having to change the classes and without having to take care of traversing the node tree.

Parameters
p_iOperation:INodeOperation — p_iOperation The operation to be performed on the node subtree

Example
       var mySpecialOperation:SpecialOperation = new SpecialOperation;
   
       mySpecialOperation.someParameter = 0.8;
       someTreeNode.perform(mySpecialOperation);
       trace(mySpecialOperation.someResult);
   
       mySpecialOperation.someParameter = 0.2;
       someOtherTreeNode.perform(mySpecialOperation);
       trace(mySpecialOperation.someResult);
   

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.

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 update the transformation taking into account the matrix cache system.

Parameters
p_oScene:Scene3D — The current scene
 
p_oModelMatrix:Matrix4
 
p_bChanged:Boolean
Constant detail
childrenconstant
public const 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

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.

modelMatrixconstant 
public const modelMatrix:Matrix4

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

viewMatrixconstant 
public const viewMatrix:Matrix4

Cached matrix corresponding to the transformation to the camera frame system