SceneGraph

Home About XEngine Engine API SceneGraph Changelog Programming Guide

Index

| Scene Description Language | camera | directory | eventmessage | geometry | group | input | light | node | primitives | root | spinner | transformation | user |

Transformation

Derived from: Group3D
Class name: TransformNode3D
Description: The transformation node geometrically transforms all of its nested nodes according to the specified, translation, rotation and scale parameters. As a result, nested transformations have a cumulative effect. The order of transformation is fixed: Scale, then Rotate then Translate. If you need to change this order you have to apply two nested transformations. The internal matrix is redefined only when the values are changed and not in every frame.

 

Function List

Name XE_transform_set_translation
Arguments int node_id, float x, float y, float z
Return Type bool
Description Sets the translation vector of the node in world coordinates

Parameters:
- node_id, the node's id
- x, the x value of the translation vector in world coordinates
- y, the y value of the translation vector in world coordinates
- z, the z value of the translation vector in world coordinates

Returns true if the node id was found
Notes:  

Name XE_transform_get_translation
Arguments int node_id, float& x, float& y, float& z
Return Type bool
Description Retrieves the translation vector of the node in world coordinates

Parameters:
- node_id, the node's id
- x, the x value of the translation vector in world coordinates
- y, the y value of the translation vector in world coordinates
- z, the z value of the translation vector in world coordinates

Returns true if the node id was found
Notes:  

Name XE_transform_set_rotation
Arguments int node_id, float angle, float x, float y, float z
Return Type bool
Description Sets an angle of rotation (in degrees) and an axis of rotation for this node

Parameters:
- node_id, the node's id
- angle, the rotation angle (in degrees)
- x, the x value of the vector
- y, the y value of the vector
- z, the z value of the vector

Returns true if the node id was found
Notes:  

Name XE_transform_get_rotation_axis
Arguments int node_id, float& x, float& y, float& z
Return Type bool
Description Retrieves the rotation axis

Parameters:
- node_id, the node's id
- x, the x value of the vector
- y, the y value of the vector
- z, the z value of the vector

Returns true if the node id was found
Notes:  

Name XE_transform_get_rotation_angle
Arguments int node_id, float& angle
Return Type bool
Description Retrieves the rotation angle

Parameters:
- node_id, the node's id
- angle, the rotation angle (in degrees)

Returns true if the node id was found
Notes:  

Name XE_transform_set_uniform_scale
Arguments int node_id, float scale
Return Type bool
Description Sets a scale value for all axes (isotropic scaling)

Parameters:
- node_id, the node's id
- scale, the scale value

Returns true if the node id was found
Notes:  

Name XE_transform_set_scale
Arguments int node_id, float x, float y, float z
Return Type bool
Description Sets a scale value for each axis

Parameters:
- node_id, the node's id
- x, the scaling value in the x direction
- y, the scaling value in the y direction
- z, the scaling value in the z direction

Returns true if the node id was found
Notes:  

Name XE_transform_set_scale
Arguments int node_id, float& x, float& y, float& z
Return Type bool
Description Retrieves the scale value for each axis

Parameters:
- node_id, the node's id
- x, the scaling value in the x direction
- y, the scaling value in the y direction
- z, the scaling value in the z direction

Returns true if the node id was found
Notes:  

Name XE_transform_set_explicit_matrix_status
Arguments int node_id, bool status
Return Type bool
Description Sets whether the internal transformation configuration will be overridden by a matrix supplied by the user.

Parameters:
- node_id, the node's id
- status, a flag indicating whether the internal configuration will be overridden (Default value is false)

Returns true if the node id was found
Notes:  

Name XE_transform_get_explicit_matrix_status
Arguments int node_id, bool& status
Return Type bool
Description Retrieves the internal transformation explicit matrix status

Parameters:
- node_id, the node's id
- status, a flag indicating whether the internal configuration will be overridden (Default value is false)

Returns true if the node id was found
Notes:  

Name XE_transform_set_matrix
Arguments int node_id, float* mat
Return Type bool
Description Sets a 16 float matrix which contains the transformation for this node. This function has no effect if the explicit matrix status is set to false.

Parameters:
- node_id, the node's id
- mat, a pointer to a 16 float array containing the transformation.

Returns true if the parent node id was found
Notes:  

Name XE_transform_get_matrix
Arguments int node_id, float* mat
Return Type bool
Description Retrieves a 16 float matrix containing the transformation for this node.

Parameters:
- node_id, the node's id
- mat, a pointer to a 16 float array containing the transformation.

Returns true if the parent node id was found
Notes:  

 

Scene Description Language Declaration

XML node name transformation
Placement: Anywhere
Special notes: -
Inherited attributes: name, active, visible
New attributes:
attribute type description
translation VEC3 The translation vector in world units.
scale VEC3 The scale factor along each one of the three local primary axes.
rotation VEC4 The OpenGL-style rotation to be applied to the underlying nodes. It is in the form (angle, axis.x, axis.y, axis.z), where angle is the right-handed rotation angle in degrees, and axis is the axis of rotation.
Events:
event name condition
- -
Inherited events: -
New messages:
attribute value description
translation VEC3 Same as the corresponding attribute.
scale VEC3 Same as the corresponding attribute.
rotation VEC4 Same as the corresponding attribute.
Inherited messages: active, visible, hide, show, deactivate, enable, activate, disable
Redefined messages: -
Obsolete messages: -

Example

<world ambient="0.3 0.3 0.3" background="0.2 0.2 0.2">
   
    <camera name="first_person" aperture="50.0" 
            near="2.0" far="1000" follow="Myself" primary="true">
    </camera> 

    <transformation name="environment" scale="1.0,1.0,1.0" translation="0,0,-10">
        
        <object name="geom1" file="arena.obj"></object>
        
        <transformation rotation="90,0,1,0" scale="0.5,0.2,4.0" translation="-20,700,-200">

            <object name="geom2" file="cloud.obj"></object>

        </transformation>
    
    </transformation>
 
    <user name="Myself" control="navigate" speed="2.0" turn="0.5 freeroll="false" 
          position="0,50,50" lookat="0,0,-10" input="MouseKeyboard">
    </user>

    <input name="MouseKeyboard" devicename="device0">
    </input>
    
</world>

Last updated: 3 Jun. 2013