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 |

Primitives

Derived from: -
Class name: -
Description:

Similar to the traditional fixed function OpenGL pipeline functionality, a number of functions have been exposed in order to send down the pipeline a batch of data for rendering. This allows the user to send dynamic data per frame. Each batch of data contains per-vertex information such as vertex position, normal and color. Three types of primitives are supported: Triangles, Lines and Points. Each list of primitives is generated within a "begin" and an "end" call.

Note that currently this API supports only dynamic data. This means that the begin-end procedure ensures that the current primitive list will be rendered on the subsequent frame. It is required that the primitive lists are provided in each frame they need to be displayed. In a future version, this will be controlled externally so that static lists (resident) can be supported as well.

 

Function List:

Name XE_geometry_primitives_list_begin
Arguments XE_PRIMITIVE_TYPE type, int count, float* mat
Return Type void
Description Initiate a new primitive rendering procedure. This is similar to glBegin. Begin calls are not nested. Each begin call requires an end call before a different list of data can be sent to the gpu buffers.

Parameters:
- type, PT_POINTS, PT_LINES, PT_TRIANGLES
- count, the number of elements for rendering (e.g. number of points, lines or triangles, NOT number of vertices)
- mat, a pointer to 16 float elements specifying a local matrix transformation
Notes: enum XE_PRIMITIVE_TYPE
{
PT_POINTS,
PT_LINES,
PT_TRIANGLES
};

Name XE_geometry_primitives_list_end
Arguments none
Return Type void
Description End the current primitive list.
Notes:  

Name XE_geometry_primitives_add_vertex_list
Arguments float* vertex_list, bool generate_normals
Return Type void
Description Pass a float array of vertices.

Parameters:
- vertex_list, a pointer to a list of floats containing the vertices. The vertex count expected must correspond to the element count that has been specified by the count parameter in the "begin" call, multiplied by the number of vertices the elements consist of (i.e. 3 for triangles, 2 for line segments, 1 for points).
- generate_normals, if no normals are available, then they are automatically generated. In case of triangles, the normals are the geometric (plane) normal of the triangles. In case of lines and points, they are automatically oriented towards the camera.
Notes:  

Name XE_geometry_primitives_add_normal_list
Arguments float* normal_list
Return Type void
Description Pass a float array of normals. If generate_normals has been specified at the XE_geometry_primitives_add_vertex_list call, then this function overrides the generated normals.

Parameters:
- normal_list, a pointer to a list of floats containing the normals. The count has been specified by the count parameter in the begin call
Notes:  

Name XE_geometry_primitives_add_color_list
Arguments unsigned char* color_list, bool unique_color
Return Type void
Description Pass a unsigned char array of RGBA colors. In case a single color is needed for all vertices, one color tuple can be used and the unique_color flag can be set to true.

Parameters:
- color_list, a pointer to a list of unsigned chars (RGBA) containing the colors. The count has been specified by the count parameter in the begin call
- unique_color, set to true if all vertices have the same color. color_list is then a simple rgba value.
Notes:  

Name XE_geometry_primitives_set_shadows_status
Arguments bool shadows_status
Return Type void
Description Sets whether shadows will be generated for the following lists. This is a global parameter.
For example, if a list of data needs to cast shadows:
- call this function with the parameter set to true
- send the list to the primitive engine
- call this function with the parameter set to false

Parameters:
- shadows_status, a flag indicating whether the new lists will be rendered with shadows enabled/disabled (Default value is false)
Notes:  

Name XE_geometry_primitives_get_shadows_status
Arguments bool& shadows_status
Return Type void
Description Retrieves the current primitive engine's shadow status

Parameters:
- shadows_status, a flag indicating whether the new lists will be rendered with shadows enabled/disabled
Notes:  

Name XE_geometry_primitives_set_lighting_status
Arguments bool lighting_status
Return Type void
Description Sets whether the following lists will be included in the lighting calculations. This is a global parameter.
For example, if a list of data needs to be lit using the lighting engine:
- call this function with the parameter set to true
- send the list to the primitive engine
- call this function with the parameter set to false

Parameters:
- lighting_status, a flag indicating whether the new lists will be included in the lighting calculations (Default value is false)
Notes:  

Name XE_geometry_primitives_get_lighting_status
Arguments bool& lighting_status
Return Type void
Description Retrieves the current primitive engine's lighting status

Parameters:
- lighting_status, a flag indicating whether the new lists will be included in the lighting calculations
Notes:  

Name XE_geometry_primitives_set_point_size
Arguments float& size
Return Type void
Description Sets the point size for the point rendering. This needs to be set each frame (resets to the default value after rendering).

Parameters:
- size, the diameter of the rasterized points (Default value is 1.0)
Notes:  

Name XE_geometry_primitives_get_point_size
Arguments float& size
Return Type void
Description Retrieves the point size for the point rendering

Parameters:
- size, the diameter of the rasterized points
Notes:  

Name XE_geometry_primitives_set_line_width
Arguments float width
Return Type void
Description Sets the line width for the line rendering This needs to be set each frame (resets to the default value after rendering).

Parameters:
- width, the rasterized line width for both aliased and antialiased lines (Default value is 1.0)
Notes:  

Name XE_geometry_primitives_get_line_width
Arguments float& width
Return Type void
Description Retrieves the line width for the line rendering

Parameters:
- width, the rasterized line width for both aliased and antialiased lines
Notes:  


Last updated: 3 Jun. 2013