This is preliminary documentation and is subject to change.

WebGL 3D Node


This is 3d node in 3d space.



Use new iv.node() or node.newNode() in order to create new node. new iv.node() creates node with zero reference count.


object 3d object, triangle mesh, light or camera for instance.
tm Local transformation matrix. May be null - equals to identity matrix.
wtm World space transformation matrix. May be used for caching purposes.
name Node name. Empty string is default.
material Material attached to node. This material is used only by object attached to this node. Does not applied recursively to all subnodes

Node state. BIt combination of following flags:

  • 1 - this node and object visible. If not set, object attached to this node is hidden.
  • 2 - children nodes are visible. If not set, all sub-objects are hidden.
  • 4 - selected. Set if node currently selected.
  • 8 - closed.
  • 16 - no z write. May be used by markups or other nodes in order to provide "special" effects.
  • 64 - no hit testing. When set, object can't be selected by mouse click in 3d window.
  • 0x80 - hide in tree view. Used by tree view control.
  • 0x100 - cast shadows (this object only)
  • 0x200 - receive shadows (this object only)
parent Parent node. May be null or undefined.
firstChild First child node. May be null or undefined.
lastChild Last child node. May be null or undefined.
next Next node in list of child nodes. May be null or undefined.
ref Reference count to this node.
anim Optional data for animation.
rmode per node render mode. Affects whole subtree, starting from this node. Set to string name of render mode. During rendering it may be replaced intrenal index of render mode. For list of possible value see this.
opacity Opacity of node and all sub-nodes. undefined means 1.0 opacity. Please note that opacity of rendered object is multiplication of all parent nodes opacities.
meta Optional metadata object. Learn more about metadata usage.



Method can change state variable of this node.

state State to set
mask Mask

Method returns true is state was changed, false if state was same already.


Method creates new child node and returns it.


Method inserts node as child into this node.

node Node to select.

Method returns inserted node. Method increments reference count of node.


Method removes child node.

node Node to remove.

If the method succeeds, the return value is true.


Methods removes all objects and nodes from whole sub-tree.


Method attaches object to this node. This method increases reference count of new object and decreases count of old one.

obj Object.


Method searches sub-node in this node by name.

name Name of the node.

null is returned if such node was not found.




Learn more about notification functions, node notification events.



Method selects node in 3d space. This method works with 3rd bit (state&4)of state attribute.

node Node to select.
sel true for select node, false - deselect.
keep Keep old selection. In false previous selection will be removed.


Method return list of selected nodes.

a Optional empty array, where selection will be stored. If a was not specified and selection is not empty, new array will be created.

If selection is empty, unmodified a will be returned.


Visibility of node is controlled by 0 and 1 bits in state variable. state&1 - node itself is visible, state&2 children objects are visible.

Toggle visibility can be done in one of the following ways:

  •  n.state^=3;
  • n.state|=1; // show this object
  • n.state&=~1; // hide this object
  •  if(n.visible())n.hide();else;


Following function can be used in order to show hide nodes.


Show or hide node.

a [optional] if a is not specified, visibility status will be set. If a is provided, visibility will be set to value a.

Method returns true is state was changed, false if node was visible/hidden already. You should update viewport in order to reflect changes.


Hides node. Method returns false if node was hidden before.


It returns true if node is visible and false if hidden. 


Position of node is defined by local transformation matrix. tm property.


Method creates local transformation matrix - if not exist already and returns it. You can modify returned in order to change position of node. In order to reset transformation, set matrix to identity state or set .tm property to null.

	var tm=n.enableTM();
	tm[12]=x; // move node by X axis

Learn more


Method returns world space transformation matrix of this node.


Method calculates world space bounding box using specified transformation matrix.

tm Transformation matrix
b b should be null for first call.
vis boolean flags. When true, only visible objects will be included in bounding box

Methods returns bounding box in required coordinate system. Bounding box is defined by two points - first point in first 3 elements of array, second is in last 3.



Method changes current animation position measured in seconds. It updates transformation matrix by calculating new position, rotation and scaling.

time Time in seconds


Method retrieves current animation position, in seconds.


In this article