5.37. Node (element)

<node> ‐ A node

5.37.1. Attributes

NameTypeDefaults
idIDNone (required)
interactableBOOLEANtrue
draggableBOOLEANtrue
testableBOOLEANtrue
displayedBOOLEANtrue
updatableBOOLEANtrue
shadow-receiverBOOLEANtrue
shadow-casterBOOLEANtrue
depth_testBOOLEANtrue
self_orientedBOOLEANtrue
disabledBOOLEANfalse
modelViewMatrixFLOAT MATRIXNone (read-only)
user_exclusion_displaySTRINGEmpty string

5.37.2. Description

This element defines a node. Nodes are the backbone for the design of a scene graph. Since a node can be the parent of another node, the definition of nodes is recursive and allows for graph construction.

In addition to defining the structure of a scene graph, nodes are also information carriers:

Node identifiers (attribute id) are used for internal or external reference to nodes through the element use. In the current version, these identifiers do not have to be unique. In the case of reference to an ambiguous node identifier, only the first node that is encountered with the same id is selected. In the case of an ambiguous target id in a script command and if a multiple_nodes type target is used, all the nodes that carry the ambiguous id are targets of this command. If a single_node type target is used, only the first encountered node that carry the ambiguous id is a target of this command.

Since an interpolator is merged with its content node into a blended node after scene graph compiling, an interpolator element must have the same identifier as its parent node.

The boolean values of the shadow-caster and shadow-receiver attributes define whether the geometry casts or receives shadows in the shadowing mode. The boolean values of the interactable and testable attributes define whether the object can be selected by active selection or passive selection through a mouse button, and the boolean value of the draggable define whether the object can be drag and dropped through the mouse button (provided that it is interactable). See Section 2.6.1 and Section 2.6.2) for more details on selection and dragging.

The boolean value of the depth_test attribute defines whether the object should overlap all the other ones. This attribute should be set to false for transparent sprites in order to avoid incorrect object depth-ordering problems.

If boolean value of the self_oriented attribute is set to true, the object always faces the camera (provided that it is defined in the xOy plane). This attribute should be set to false for impostors or sprites that are not supposed to be viewed in perspective.

The boolean value of the updatable attribute defines whether the object is updated at each step. This attribute can dynamically be set to false for stopping the course of a transformation path.

The boolean value of the disabled attribute defines whether the texture of the object is rendered. In order to indicate to the user that an object is not currently available to modifications, this attribute can be set to false and the object will be rendered with a uniform gray texture instead of its original texture.

The value of the read-only attribute modelViewMatrix is a 4x4 float matrix that represents the absolute transformation from the view coordinates to the coordinates of the object/transformation carried by this node (depends on the viewpoint).

The value of the string attribute user_exclusion_display is used to avoid displaying a node for some of the users. At compilation time, only one single user can be rejected for node display. If more than one user needs to be rejected, use the set_node_attribute_value command with operator such as '+=' or '-=' to add or withdraw excluded users (see example below).

5.37.3. Expected children

The following elements can occur in nodes:

5.37.4. Examples

The example below defines a transformation interpolation node with an embedded node. The interpolation is used to compute a progressive scaling from size 1.0 to size 0.0.


<node id="interpolator_sail">
  <interpolator id="interpolator_sail" type="transformation" size="2">
    <schedule begin="2" dur="20" repeatCount="2" mode="sinus-periodic" fill="remove"/>
    <transformation id="transf_sail" geometry="scale" x="1"  y="1"  z="1" />
    <transformation id="transf_sail_end" geometry="scale" 
                     x="0.00001"  y="0.00001"  z="0.00001" />
  </interpolator>

  <node id="interpolator_w123_{#n}.{#k}">
    ... sub-node description ....
  </node>
</node>

The example below defines a quad that will be drawn whatever the other objects in the scene since the depth test is disabled.

<node id="sprite_star_{#n}" depth_test="false">
  <quad id="quad_{#nbElts}" x1="0.0" y1="1.0" z1="0.0" 
     x2="1.0" y2="1.0" z2="0.0" x3="1.0" y3="0.0" z3="0.0" 
     x4="0.0" y4="0.0" z4="0.0">
     <texture encoding="pnga" env_mode="blend" mipmapped="true"  
        xlink:href="textures/star{#n}-1.png" id="ground_metal" 
        tile_s="1" tile_t="-1" />
  </quad>
</node>

The example below defines two commands to modify the user_exclusion_display of the node(s) sphereNE_* by adding or removing the user node user_2 from the lists of excluded users.

<command>
  <trigger type="keystroke" value="l" />
  <action>
    <set_node_attribute_value user_exclusion_display="user_2"
                              operator="+=" />
    <target type="multiple_nodes" value="#sphereNE_*" />
  </action>
</command>
<command>
  <trigger type="keystroke" value="L" />
  <action>
    <set_node_attribute_value user_exclusion_display="user_2"
                              operator="-=" />
    <target type="multiple_nodes" value="#sphereNE_*" />
  </action>
</command>