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 |

Geometry

Derived from: Node3D
Class name: Geometry3D
Description: The object scene graph node loads and displays a mesh from an external file in one of the supported formats. Currently only the Alias Wavefront Object format is supperted (.obj and corresponding .mtl). All bitmap formats implemented by the FreeImage library are supported for textures.

 

Function List

Name XE_geometry_register_static_mesh
Arguments int node_id, const char* file_name
Return Type bool
Description Registers a static mesh in OBJ format.
If the OBJ file is not included in the provided data paths, then XE_scene_append_directory should be used to add the directory that points to the obj file.

Parameters:
node_id - the geometry node that will hold the mesh
file_name - the filename (without any paths) that contains the mesh.

Returns true if the node id was found
Notes:  

 

Scene Description Language Declaration

XML node name object
Placement: Anywhere
Special notes:

In addition to the regular color texture specified in a OBJ format material (in the .mtl file), the engine supports the loading of emission, bump and specular maps as part of the material description. In the .mtl file, these are provided by the following tags in each material declaration:

  • map_bump : In this version expects a greyscale height map of the surface detail. File must be in the RGB format.
  • map_ke : The emissive texture. The average per pixel luminace is used for the emission of the surface. The color of the emission is determined by the corresponding albedo of the object at that point.
  • map_Ks : A 4-channel bitmap (must be supported by the format, e.g. tiff), whose RGB channels represent the reflectivity coefficient (RGB Ks) and 4-th channel (alpha) provides the normalized specular exponent [0-127] mapped to [0,maxopacity]. maxopacity is the maximum value supported by the alpha channel in the chosen format.
Inherited attributes: name, active, visible
New attributes:
attribute type description
file STRING The file to load. The search path(s) for the file is (are) provided by the directory scene graph nodes.
Events:
event name condition
- -
Inherited events: -
New messages:
attribute value description
dump - Dumps the geometry information such as number of elements, vertices and material information
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="geom2" file="arena.obj"></object>
    
    </transformation>
 
    <user name="Myself" control="navigate" speed="2.0" turn="0.5"
          position="0,10,100" lookat="0,10,0" input="MouseKeyboard">
    </user>

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

Last updated: 3 Jun. 2013