VisimBox 1.0 VisimBox 3d simulation and visualisation ToolBox

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Events
VisimBox.Scene.Node Class Reference

Base class for all nodes. More...

Inheritance diagram for VisimBox.Scene.Node:

List of all members.

## Classes
class | NodeEnumerator
## Public Member Functions
void | ChangeParent (Node newparent, bool remove=true, bool add=false)
| Change node ownership.
virtual void | AddNode (Node node, string name="subnode")
| Adds node to children.
virtual void | OnNodeAdded (Node tonode, Node newchild)
| Callback from children, reporting it has new child.
virtual void | OnNodeRemoved (Node fromnode, Node removed)
| Callback from children, reporting child has been removed.
virtual void | RemoveNode (string name)
virtual void | RemoveNode (Node node)
virtual Node | GetChildByFullName (string fullname)
| Searches for child by fullname.
virtual Node | SearchChild (string name)
| Searches subnodes for specified name.
virtual void | RenderHierarchy (RendererEventArgs args)
| Renders node hierarchy to rendercontext.
void | Rename (string newname)
void | RenameForDictionary (string newname)
| DO NOT USE, used internaly by NodeDictionary.
virtual bool | GetWorldTransformation (ref Matrix4 trans)
| If node has world transformation (either it's own transform multiplied by owner hierarchy, or valid transform of one of his parents), it sets parameter to this transformation and returns true.
| Node ()
| Constructs parentless node.
| Node (System.Xml.XmlReader reader)
| Node (Node parent)
| Constructs node with specified parent (and automatically saves itselfs to parents children)
virtual Node | CreateCopy ()
| creates and returns copy of this node
virtual bool | TimeTickHierarchy (double time)
| Do a time tick for node and it's children, parameter time is seconds from the last call, returns true if this node was changed somehow.
virtual bool | TimeTick (double time)
| Do a time tick.
virtual bool | SetTimeHierarchy (double time)
| set time of node and it's children to absolute value
virtual bool | SetTime (double time)
| set node time to absolute value
virtual Node | PickNode (Ray ray)
| Runs picking ray through the node hierarchy and returns first hit node (if any)
virtual void | Dispose ()
IEnumerator< Node > | GetEnumerator ()
void | Add (object value)
| for xml serialization...
virtual void | WriteInternalData (System.Xml.XmlWriter writer)
| Write internal data of the node to XML, without subnodes (called from WriteXML)
virtual bool | ReadInternalData (System.Xml.XmlReader reader)
| Reads one item of internal data. Should return true if recognized value (for overloading)
System.Xml.Schema.XmlSchema | GetSchema ()
| Reqired by IXMLserializable.
virtual void | ReadXml (System.Xml.XmlReader reader)
| Deserializes object from XML.
virtual void | WriteXml (System.Xml.XmlWriter writer)
| Serializes object to XML.
override string | ToString ()
## Protected Member Functions
void | RenameChild (Node child, string newname)
virtual void | TransformationChanged (ITransformation caller)
void | ParentTransChanged ()
virtual void | OnNodeMoved ()
virtual Node | GetNodeSameType ()
| creates new default node of the same type as this node
virtual bool | PickNode (ref NodeIntersectionInfo intersinfo)
| Checks node and it's hierarchy for intersection with ray. If node contains some closer object then already found, it returns true and modifies structure.
virtual void | CopyData (Node targetNode)
virtual void | ReadSubNodes (System.Xml.XmlReader reader)
## Protected Attributes
Node | _parent
NodeDictionary | _children
bool | _visible
string | _Name
RenderFlags | _RenderFlags
ITransformation | _Trans
bool | _MyTransChanged
| My transformation was changed, used by getworldtransformation.
bool | _MyParentTransChanged
| My boss transformation was changed, used by getworldtransformation.
Matrix4 | _WorldTrans
| Cached world transformation.
bool | _Disposing = false
## Properties
Node | Parent`[get]`
| Parent of the Node.
Node | this[string index]`[get]`
| Array like accessor to all direct subnodes.
string | Name`[get]`
| Name of the node.
string | FullName`[get]`
| Fullname of the node (complete tree)
bool | DontSave`[get, set]`
| If set to true, node won't save itself nor any of it's children (used by temporary renderer and other objects)
RenderFlags | RenderFlags`[get, set]`
| Current Render flags for the node (node will be rendered only if flags are correct.
virtual RenderFlags | DefaultRenderFlags`[get]`
| Default render flags for the node (node will be rendered only if flags are correct)
virtual ITransformation | Trans`[get, set]`
| Spatial transformation of the node. If null, node has no transformation.
bool | VisibleHierarchy`[get, set]`
| Should be node and its children rendered on render call?
bool | Visible`[get, set]`
| Is node visible and renderable? (in this case it must implement IRenderable interface)
bool | StaticHierarchy`[get, set]`
| Is node and it's children static (no relevant changes for renderer / physics)
bool | Pickable`[get, set]`
| Can node be picked by mouse click?
virtual string | XMLNodeName`[get]`
| XML name.
## Events
NodeCallBack | NodeMoved
| Callback for node local transformation change.
NodeCallBack | NodeAdded
| User callback for new node added, arguments = new node.
NodeCallBack | NodeRemoved
| User callback for new node added, arguments = node removed.

## Detailed Description

Base class for all nodes.

## Constructor & Destructor Documentation

VisimBox.Scene.Node.Node | ( |  | ) |

Constructs parentless node.

VisimBox.Scene.Node.Node | ( | System.Xml.XmlReader | reader | ) |

VisimBox.Scene.Node.Node | ( | Node | parent | ) |

Constructs node with specified parent (and automatically saves itselfs to parents children)

Parameters:

  parent |

## Member Function Documentation

void VisimBox.Scene.Node.Add | ( | object | value | ) |

for xml serialization...

Parameters:

  value |

virtual void VisimBox.Scene.Node.AddNode | ( | Node | node,
|  | string | name = `"subnode"`
| ) |  | `[virtual]`

Adds node to children.

Parameters:

  node | Node
  name | Name (warning, if node already contains node of this name, name will be changed!

Reimplemented in VisimBox.Scene.SceneRoot.

void VisimBox.Scene.Node.ChangeParent | ( | Node | newparent,
|  | bool | remove = `true`,
|  | bool | add = `false`
| ) |  |

Change node ownership.

Parameters:

  newparent | New parent of the node
  remove | if true, node will be also removed from the current parent list
  add | if true, will be added to newparent nodes

virtual void VisimBox.Scene.Node.CopyData | ( | Node | targetNode | ) | `[protected, virtual]`

Reimplemented in VisimBox.Physics.PhysNode, VisimBox.Physics.RigidBody, VisimBox.Physics.StaticCollision, VisimBox.Scene.CameraNode, VisimBox.Scene.GeometryNode, VisimBox.Scene.ImportedNode, VisimBox.Scene.LightNode, VisimBox.Scene.RenderableNode, VisimBox.Scene.NodeMesh, VisimBox.Scene.SkyBoxNode, and VisimBox.Scene.UnknownNode.

virtual Node VisimBox.Scene.Node.CreateCopy | ( |  | ) | `[virtual]`

creates and returns copy of this node

Returns:
  Copy of the node

Reimplemented in VisimBox.Scene.SceneRoot.

virtual void VisimBox.Scene.Node.Dispose | ( |  | ) | `[virtual]`

Reimplemented in VisimBox.Scene.LightNode, VisimBox.Scene.NodeMesh, and VisimBox.Scene.SkyBoxNode.

virtual Node VisimBox.Scene.Node.GetChildByFullName | ( | string | fullname | ) | `[virtual]`

Searches for child by fullname.

Parameters:

  fullname | Fullname of the child

Returns:
  null or child node

IEnumerator<Node> VisimBox.Scene.Node.GetEnumerator | ( |  | ) |

virtual Node VisimBox.Scene.Node.GetNodeSameType | ( |  | ) | `[protected, virtual]`

creates new default node of the same type as this node

Returns:
  new default node of the same type as this node

System.Xml.Schema.XmlSchema VisimBox.Scene.Node.GetSchema | ( |  | ) |

Reqired by IXMLserializable.

Returns:
  Null

virtual bool VisimBox.Scene.Node.GetWorldTransformation | ( | ref Matrix4 | trans | ) | `[virtual]`

If node has world transformation (either it's own transform multiplied by owner hierarchy, or valid transform of one of his parents), it sets parameter to this transformation and returns true.

Parameters:

  trans | Parameter to be filled with transformation matrix

Returns:
  True if trans is valid (if false, world transformation for node is identity)

Optimize, cache results and update them only if transformation changes

virtual void VisimBox.Scene.Node.OnNodeAdded | ( | Node | tonode,
|  | Node | newchild
| ) |  | `[virtual]`

Callback from children, reporting it has new child.

Parameters:

  tonode | Node receiving new node
  newchild | New node

Reimplemented in VisimBox.Scene.SceneRoot.

virtual void VisimBox.Scene.Node.OnNodeMoved | ( |  | ) | `[protected, virtual]`

virtual void VisimBox.Scene.Node.OnNodeRemoved | ( | Node | fromnode,
|  | Node | removed
| ) |  | `[virtual]`

Callback from children, reporting child has been removed.

Parameters:

  tonode | Node losing child
  newchild | removed node

Reimplemented in VisimBox.Scene.SceneRoot.

void VisimBox.Scene.Node.ParentTransChanged | ( |  | ) | `[protected]`

virtual Node VisimBox.Scene.Node.PickNode | ( | Ray | ray | ) | `[virtual]`

Runs picking ray through the node hierarchy and returns first hit node (if any)

Parameters:

  ray | Picking ray

Returns:
  First hit node or null

virtual bool VisimBox.Scene.Node.PickNode | ( | ref NodeIntersectionInfo | intersinfo | ) | `[protected, virtual]`

Checks node and it's hierarchy for intersection with ray. If node contains some closer object then already found, it returns true and modifies structure.

Parameters:

  intersinfo | Intersection info

Returns:
  True if ray hits something closer

Reimplemented in VisimBox.Scene.RenderableNode.

virtual bool VisimBox.Scene.Node.ReadInternalData | ( | System.Xml.XmlReader | reader | ) | `[virtual]`

Reads one item of internal data. Should return true if recognized value (for overloading)

Parameters:

  reader | Reader to read from

Returns:
  True if value was handled, false if not

Reimplemented in VisimBox.Physics.RigidBody, VisimBox.Scene.CameraNode, VisimBox.Scene.GeometryNode, VisimBox.Scene.ImportedNode, VisimBox.Scene.LightNode, VisimBox.Scene.RenderableNode, VisimBox.Scene.NodeMesh, VisimBox.Scene.SkyBoxNode, and VisimBox.Scene.UnknownNode.

virtual void VisimBox.Scene.Node.ReadSubNodes | ( | System.Xml.XmlReader | reader | ) | `[protected, virtual]`

virtual void VisimBox.Scene.Node.ReadXml | ( | System.Xml.XmlReader | reader | ) | `[virtual]`

Deserializes object from XML.

Parameters:

  reader | XML reader

Reimplemented in VisimBox.Scene.LightNode.

virtual void VisimBox.Scene.Node.RemoveNode | ( | string | name | ) | `[virtual]`

virtual void VisimBox.Scene.Node.RemoveNode | ( | Node | node | ) | `[virtual]`

void VisimBox.Scene.Node.Rename | ( | string | newname | ) |

void VisimBox.Scene.Node.RenameChild | ( | Node | child,
|  | string | newname
| ) |  | `[protected]`

void VisimBox.Scene.Node.RenameForDictionary | ( | string | newname | ) |

DO NOT USE, used internaly by NodeDictionary.

Parameters:

  newname |

virtual void VisimBox.Scene.Node.RenderHierarchy | ( | RendererEventArgs | args | ) | `[virtual]`

Renders node hierarchy to rendercontext.

Parameters:

  args | Renderer arguments

virtual Node VisimBox.Scene.Node.SearchChild | ( | string | name | ) | `[virtual]`

Searches subnodes for specified name.

Parameters:

  name | Name of the desired child, can be specified with parent/parent2/child syntax to find correct node

Returns:
  Null or found child node

virtual bool VisimBox.Scene.Node.SetTime | ( | double | time | ) | `[virtual]`

set node time to absolute value

Parameters:

  time | elapsed time in seconds

Returns:
  returns true if this node was changed somehow

virtual bool VisimBox.Scene.Node.SetTimeHierarchy | ( | double | time | ) | `[virtual]`

set time of node and it's children to absolute value

Parameters:

  time | elapsed time in seconds

Returns:
  returns true if this node was changed somehow

virtual bool VisimBox.Scene.Node.TimeTick | ( | double | time | ) | `[virtual]`

Do a time tick.

Parameters:

  time | Elapsed time in seconds

Returns:
  , returns true if this node was changed somehow

Reimplemented in VisimBox.Scene.LightNode, VisimBox.Scene.SceneRoot, VisimBoxDemos.EarthAttack.EarthAttack, VisimBoxDemos.MarsRover.MarsTerrain, and VisimBoxDemos.MarsRover.TerrainNode.

virtual bool VisimBox.Scene.Node.TimeTickHierarchy | ( | double | time | ) | `[virtual]`

Do a time tick for node and it's children, parameter time is seconds from the last call, returns true if this node was changed somehow.

Parameters:

  time | elapsed time

Returns:
  true if node or some of it's children changed state

override string VisimBox.Scene.Node.ToString | ( |  | ) |

virtual void VisimBox.Scene.Node.TransformationChanged | ( | ITransformation | caller | ) | `[protected, virtual]`

virtual void VisimBox.Scene.Node.WriteInternalData | ( | System.Xml.XmlWriter | writer | ) | `[virtual]`

Write internal data of the node to XML, without subnodes (called from WriteXML)

Parameters:

  writer | XML Writer

Reimplemented in VisimBox.Physics.RigidBody, VisimBox.Scene.CameraNode, VisimBox.Scene.GeometryNode, VisimBox.Scene.ImportedNode, VisimBox.Scene.LightNode, VisimBox.Scene.RenderableNode, VisimBox.Scene.NodeMesh, VisimBox.Scene.SceneRoot, VisimBox.Scene.SkyBoxNode, and VisimBox.Scene.UnknownNode.

virtual void VisimBox.Scene.Node.WriteXml | ( | System.Xml.XmlWriter | writer | ) | `[virtual]`

Serializes object to XML.

Parameters:

  writer | XML writer to save values

## Member Data Documentation

NodeDictionary VisimBox.Scene.Node._children`[protected]`

bool VisimBox.Scene.Node._Disposing = false`[protected]`

bool VisimBox.Scene.Node._MyParentTransChanged`[protected]`

My boss transformation was changed, used by getworldtransformation.

bool VisimBox.Scene.Node._MyTransChanged`[protected]`

My transformation was changed, used by getworldtransformation.

string VisimBox.Scene.Node._Name`[protected]`

Node VisimBox.Scene.Node._parent`[protected]`

RenderFlags VisimBox.Scene.Node._RenderFlags`[protected]`

ITransformation VisimBox.Scene.Node._Trans`[protected]`

bool VisimBox.Scene.Node._visible`[protected]`

Matrix4 VisimBox.Scene.Node._WorldTrans`[protected]`

Cached world transformation.

## Property Documentation

virtual RenderFlags VisimBox.Scene.Node.DefaultRenderFlags`[get]`

Default render flags for the node (node will be rendered only if flags are correct)

Reimplemented in VisimBox.Physics.PhysNode, VisimBox.Physics.RigidBody, VisimBox.Physics.StaticCollision, VisimBox.Scene.CameraNode, VisimBox.Scene.GeometryNode, VisimBox.Scene.ImportedNode, VisimBox.Scene.LightNode, VisimBox.Scene.RenderableNode, VisimBox.Scene.NodeMesh, VisimBox.Scene.SceneRoot, VisimBox.Scene.SkyBoxNode, and VisimBox.Scene.UnknownNode.

bool VisimBox.Scene.Node.DontSave`[get, set]`

If set to true, node won't save itself nor any of it's children (used by temporary renderer and other objects)

string VisimBox.Scene.Node.FullName`[get]`

Fullname of the node (complete tree)

string VisimBox.Scene.Node.Name`[get]`

Name of the node.

Node VisimBox.Scene.Node.Parent`[get]`

Parent of the Node.

bool VisimBox.Scene.Node.Pickable`[get, set]`

Can node be picked by mouse click?

RenderFlags VisimBox.Scene.Node.RenderFlags`[get, set]`

Current Render flags for the node (node will be rendered only if flags are correct.

bool VisimBox.Scene.Node.StaticHierarchy`[get, set]`

Is node and it's children static (no relevant changes for renderer / physics)

Node VisimBox.Scene.Node.this[string index]`[get]`

Array like accessor to all direct subnodes.

Parameters:

  index | name of the child node

Returns:
  Null or named Node

virtual ITransformation VisimBox.Scene.Node.Trans`[get, set]`

Spatial transformation of the node. If null, node has no transformation.

bool VisimBox.Scene.Node.Visible`[get, set]`

Is node visible and renderable? (in this case it must implement IRenderable interface)

bool VisimBox.Scene.Node.VisibleHierarchy`[get, set]`

Should be node and its children rendered on render call?

virtual string VisimBox.Scene.Node.XMLNodeName`[get]`

XML name.

Reimplemented in VisimBox.Scene.UnknownNode.

## Event Documentation

NodeCallBack VisimBox.Scene.Node.NodeAdded

User callback for new node added, arguments = new node.

NodeCallBack VisimBox.Scene.Node.NodeMoved

Callback for node local transformation change.

NodeCallBack VisimBox.Scene.Node.NodeRemoved

User callback for new node added, arguments = node removed.

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

- Node.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events