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 |

Spinner

Derived from: TransformNode3D
Class name: Spinner3D
Description: This special dynamic transformation represents a time-variable rotation around a user-specified axis.

 

Function List:

Name XE_spinner_set_period
Arguments int node_id, float period
Return Type bool
Description Sets the duration (in seconds) the spinner node will take to complete its rotation

Parameters:
- node_id, the node's id
- period, the spinner's duration (Default value is 1 sec)

Returns true if the node id was found
Notes:  

Name XE_spinner_get_period
Arguments int node_id, float& period
Return Type bool
Description Retrieves the spinner's duration

Parameters:
- node_id, the node's id
- period, the spinner's duration

Returns true if the node id was found
Notes:  

Name XE_spinner_set_repeats
Arguments int node_id, unsigned int repeats
Return Type bool
Description Sets the number of repeats this spinner node will perform. A repeats value of 0 indicates that the spinner is in looping mode.

Parameters:
- node_id, the node's id
- repeats, the number of repeats (Default is 0, infinite)

Returns true if the node id was found
Notes:  

Name XE_spinner_get_repeats
Arguments int node_id, unsigned int& repeats
Return Type bool
Description Retrieves the number of repeats

Parameters:
- node_id, the node's id
- repeats, the number of repeats

Returns true if the node id was found
Notes:  

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

Parameters:
- node_id, the node's id
- angle, the starting angle of rotation (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& start_angle
Return Type bool
Description Retrieves the starting rotation angle

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

Returns true if the node id was found
Notes:  

 

Scene Description Language Declaration

XML node name spinner
Placement: Anywhere
Special notes: -
Inherited attributes: name, active, visible
New attributes:
attribute type description
axis VEC3 The axis of rotation direction (rotation is relative to (0,0,0) in the local coordinate system)
period FLOAT The period of rotation
repeats FLOAT Number of complete rotations. Zero for infinite rotation.
start_angle FLOAT The initial angular offset of rotation.
Events:
event name condition
- -
Inherited events: -
New messages:
attribute value description
start - Start the animation.
stop - Stop and reset the animation.
pause - Pause (but not reset) the animation.
repeats FLOAT Same as the corresponding attribute.
period FLOAT Same as the corresponding attribute.
Inherited messages: active, visible, hide, show, deactivate, enable, activate, disable
Redefined messages: -
Obsolete messages: transation, scale, rotation

Example

<world ambient="0.3 0.3 0.3" background="0.2 0.2 0.2">
   
    <eventmessage event="init" recipient="handle_spin" message="start"></eventmessage>

    <camera name="first_person" aperture="50.0" 
            near="2.0" far="1000" follow="Myself" primary="true">
    </camera> 

    <transformation rotation="0,1,0,0" scale="1,1,1" translation="0,322,0">
<spinner name="handle_spin" period="3.0" repeats="0" axis="1,0,0">
<object file="Fan_Handle.obj"/>
</spinner>
</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