DI-Guy SDK Documentation  13.1
diguyOsgGraphicsShape Class Reference

#include <diguyOsgGraphicsShape.h>

Inheritance diagram for diguyOsgGraphicsShape:
diguyGraphicsShape

Public Member Functions

 diguyOsgGraphicsShape (void *internal_data)
 
virtual void build ()
 This function will be called by DI-Guy when it is time for renderer-specific shape objects to be created. More...
 
virtual void unbuild ()
 This function will be called by DI-Guy when it is time for the renderer-specific shape objects created during the build() call to be destroyed. More...
 
virtual void show ()
 This function will be called by DI-Guy when the shape should be shown, typically due to a change in the motion data that controls the switch. More...
 
virtual void hide ()
 This function will be called by DI-Guy when the shape should be hidden, typically due to a change in the motion data that controls the switch. More...
 
virtual void instancing_state_changed (int val)
 
virtual void set_graphics_lod_ranges (float *lod_ranges)
 This function will be called by DI-Guy when the LOD ranges of this shape need to be updated after the shape has initially been built in the Build Stage. More...
 
virtual void set_graphics_lod (int lod)
 This function will be called by DI-Guy when the LOD of this link is "manually" set by a diguyCharacter::set_graphics_lod() function call. More...
 
virtual void update ()
 This function will be called by DI-Guy when it is time for renderer-specific shape objects created during the build() call to be updated with new data. More...
 
- Public Member Functions inherited from diguyGraphicsShape
const char * get_name ()
 This function returns the name of the shape. More...
 
long get_uid ()
 All shapes are assigned a unique identifier, or uid. More...
 
diguyCharacterget_character ()
 This function returns a pointer to the diguyCharacter to which this shape belongs. More...
 
const char * get_shape_set_name ()
 This function returns the name of the shape set of which this shape is a part. More...
 
const char * get_shape_set_shape_name ()
 This function returns the name of the shape. More...
 
const char * get_recommended_attachment_link_name ()
 This function returns the name of the link to which this shape is typically attached. More...
 
int get_num_lods ()
 This function returns how many LODs this shape has. More...
 
float * get_lod_ranges ()
 This function returns the LOD ranges of this shape. More...
 
int get_graphics_lod ()
 This function returns the most recent lod setting as set by set_graphics_lod(), or as set by diguyCharacter::set_graphics_lod(). More...
 
const char * get_shape_set_filename_for_lod (int lod)
 This function returns the filename of the geometry file from which the shape is read for a specific LOD. More...
 
int get_num_meshes (int lod)
 This function returns the number of low-level geometry meshes that comprise this shape. More...
 
diguyGraphicsMeshget_mesh_at_index_for_lod (int index, int lod)
 This function returns a pointer to one of the low-level geometry mesh objects that comprise this shape. More...
 
diguyGraphicsLinkget_link ()
 This function returns a pointer to the link to which this shape is actually attached. More...
 
const char * get_switch_var_name ()
 This function returns the name of the DI-Guy motion data variable that controls whether this shape should be visible. More...
 
int get_switch_value ()
 This function returns the value of the DI-Guy motion data variable for which the shape should be visible. More...
 
int get_is_hidden ()
 This function returns whether this shape should currently be hidden or shown, based on the value of the shape's switch variable (if any). More...
 
int set_is_hidden (int hidden)
 hides or shows the shape More...
 
diguyGraphicsFileget_diguy_graphics_file (int lod)
 This function returns the geometry file from which geometry for the shape was read. More...
 
void * get_diguy_graphics_file_part (int lod)
 This function returns a pointer to an object that represents the geometry for the shape. More...
 
int get_graphics_state_switch_index ()
 Some shapes have meshes that have multiple selectable graphics states, including materials and textures. More...
 
int get_num_switched_graphics_states ()
 Returns the number of switched graphics states available to this shape. More...
 
diguyGraphicsStateget_switched_graphics_state (int switch_value=-1)
 Returns the graphics state associated with the passed switch value. More...
 
int get_unique_color (unsigned char *r, unsigned char *g, unsigned char *b)
 Returns in the passed pointers the unique color of this shape. More...
 
int get_contains_skinned_file ()
 This function identifies if this shape has skinned data. More...
 
int set_material_parameter_4f (const char *parameter_name, float x, float y, float z, float w, float blend_time=0.0)
 Per shape material data. More...
 
int get_material_parameter_4f (const char *parameter_name, float *x, float *y, float *z, float *w)
 Allow access to the current values of a material parameter, accounting for value blending. More...
 
unsigned char * get_variation_texture ()
 Returns a char * of length get_variation_texture_size() that represents the pixels in a unique per shape texture. More...
 
int get_variation_texture_size ()
 Returns the size of the texture specified in get_variation_texture() More...
 
int get_num_variations ()
 Returns the number of texture variations that this shape has. More...
 
const char * get_variation_name (int variation_index)
 Returns the name of the texture variations at variation_index. More...
 
int set_variation_index (int variation_index)
 Sets the shape to have the variation specified at variation_index, returns -1 if out of array bounds. More...
 
int get_has_custom_variation ()
 true if set_unique_ramp_data() is ever called on this object. More...
 
int get_num_variation_components ()
 Returns the number of different components in the current variation texture. More...
 
const char * get_variation_component_name (int index)
 Returns the name of the component at index in the current variation texture. More...
 
int get_variation_component_index (const char *name)
 Returns the index of the component with name in the current variation texture. More...
 
int set_variation_component_value (int index, float color_shift_r, float color_shift_g, float color_shift_b)
 Sets the color shift value of the component at index in the current variation texture. More...
 
int set_state_switch_index (int index)
 Sets current material swap index, allows overriding of value that was set based on appearance settings. More...
 
int get_shader_matrix_data (int *num_matrixes, const float **matrix_data)
 This function is typically called by scene graph renderers as part of diguyGraphicsShape::update(). More...
 
int get_are_shader_matrices_transposed ()
 Returns the transpose state of the shader matrices. More...
 
virtual void draw (int lod)
 This function will be called by DI-Guy when it is time for the geometry of this shape to be drawn. More...
 
virtual void update_variation_texture (int num_pixels, unsigned char *pixel_data)
 Pushes a char * pixel buffer of length num_pixels that represents the unique per shape texture. More...
 
int get_bind_color_array (int *num_colors, const float **color_data)
 Returns the unique color of the character links. More...
 
int get_link_to_matrix_table (int *num_matrices, const float **lookup_data)
 
int get_bone_index_from_link_index (int link_index)
 
int get_has_offset_matrix ()
 
int get_offset_matrix_4x4_ptr (float *matrix, int transpose=0)
 
int get_has_offset_translation ()
 
int get_offset_translation (float *tx, float *ty, float *tz)
 
int get_has_offset_rotation ()
 
int get_offset_rotation (float *rz, float *rx, float *ry)
 
int get_has_offset_scale ()
 
int get_offset_scale (float *sx, float *sy, float *sz)
 
bdiShapeget_scripted_object ()
 

Static Public Member Functions

static void set_use_pixel_lods (bool use_pixel_lods)
 

Static Public Attributes

static char * s_ufrm_link_matrices_string = NULL
 
static char * s_ufrm_link_colors_string = NULL
 

Additional Inherited Members

- Protected Member Functions inherited from diguyGraphicsShape
 diguyGraphicsShape (void *internal_data)
 A protected constructor. More...
 
virtual ~diguyGraphicsShape ()
 A protected destructor. More...
 

Constructor & Destructor Documentation

diguyOsgGraphicsShape::diguyOsgGraphicsShape ( void *  internal_data)

Member Function Documentation

void diguyOsgGraphicsShape::build ( )
virtual

This function will be called by DI-Guy when it is time for renderer-specific shape objects to be created.

All information necessary to build the shape should be available via the Accessor Functions above when this function is called.

The build() function for the link to which a shape is attached will be called before the shape's build() function.

Immediate Mode:

Immediate mode renderers can override this function, to create a pre-compiled object that expedites the draw(). Display lists in OpenGL are an example of this.

Scene Graph:

Scene graph renderers usually do override this function, to create scene graph nodes that will hold geometry nodes of meshes attached to the shape.

The following nodes are typically created:

  • a switch node to control showing and hiding of the shape
  • an LOD node to control which meshes are shown due to LOD calculations
  • a geometry parent or group-type object to which mesh nodes can be attached

    The scene graph nodes created by this function should be attached to the nodes of the link to which the shape is attached. Use the get_link() function to get a pointer to the link.

    In addition, the scene graph objects of meshes attached to the shape should be retrieved and attached to the shape's nodes. Use the get_mesh_at_index_for_lod() function to get pointers to the meshes.

Callable From:

  • N/A (automatically called by DI-Guy Graphics API during the Build Stage)

Reimplemented from diguyGraphicsShape.

void diguyOsgGraphicsShape::unbuild ( )
virtual

This function will be called by DI-Guy when it is time for the renderer-specific shape objects created during the build() call to be destroyed.

The unbuild() function for the shape will be called before the unbuild() function of the link to which the shape is attached.

Immediate Mode:

Scene graph renderers can override this function, to destroy the scene graph nodes created by build().

Scene Graph:

Scene graph renderers usually do override this function, to destroy the scene graph nodes created by build().

Callable From:

  • N/A (automatically called by DI-Guy Graphics API during the Unbuild Stage)

Reimplemented from diguyGraphicsShape.

void diguyOsgGraphicsShape::show ( )
virtual

This function will be called by DI-Guy when the shape should be shown, typically due to a change in the motion data that controls the switch.

See get_switch_var_name() and get_switch_value().

Immediate Mode:

Immediate mode renderers usually do not override this function. DI-Guy does not call the draw() function of hidden shapes.

Scene Graph:

Scene graph renderers usually do override this function, to update the state of the switch node created during the build() call.

Callable From:

  • N/A (automatically called by DI-Guy Graphics API during Update Stage)

Reimplemented from diguyGraphicsShape.

void diguyOsgGraphicsShape::hide ( )
virtual

This function will be called by DI-Guy when the shape should be hidden, typically due to a change in the motion data that controls the switch.

See get_switch_var_name() and get_switch_value().

Immediate Mode:

Immediate mode renderers usually do not override this function. DI-Guy does not call the draw() function of hidden shapes.

Scene Graph:

Scene graph renderers usually do override this function, to update the state of the switch node created during the build() call.

Callable From:

  • N/A (automatically called by DI-Guy Graphics API during Update Stage)

Reimplemented from diguyGraphicsShape.

void diguyOsgGraphicsShape::instancing_state_changed ( int  val)
virtual

Reimplemented from diguyGraphicsShape.

void diguyOsgGraphicsShape::set_graphics_lod_ranges ( float *  ranges)
virtual

This function will be called by DI-Guy when the LOD ranges of this shape need to be updated after the shape has initially been built in the Build Stage.

Parameters
lod_rangesnew lod ranges for this shape

See diguyScenario::set_default_lod_ranges() for a description of what will be in the lod_ranges argument.

Immediate Mode:

Immediate mode renderers usually do not override this function. Instead, they use the lod passed into the draw() function.

Scene Graph:

Scene graph renderers can override this function, to update the ranges of LOD nodes created in the Build Stage, if any.

If there were LOD-type nodes created in the Build Stage, their ranges should be updated based on the passed values.

If no LOD-type nodes were created in the Build Stage, this function should have no effect.

Typically only one of set_graphics_lod_ranges() or set_graphics_lod() is implemented.

Callable From:

Reimplemented from diguyGraphicsShape.

void diguyOsgGraphicsShape::set_graphics_lod ( int  lod)
virtual

This function will be called by DI-Guy when the LOD of this link is "manually" set by a diguyCharacter::set_graphics_lod() function call.

Immediate Mode:

Immediate mode renderers usually do not override this function. Instead, they use the lod passed into the draw() function.

Scene Graph:

Scene graph renderers sometimes override this function, to update the state of switch nodes created in the Build Stage.

Typically only one of set_graphics_lod_ranges() or set_graphics_lod() is implemented.

Callable From:

Reimplemented from diguyGraphicsShape.

static void diguyOsgGraphicsShape::set_use_pixel_lods ( bool  use_pixel_lods)
inlinestatic
void diguyOsgGraphicsShape::update ( )
virtual

This function will be called by DI-Guy when it is time for renderer-specific shape objects created during the build() call to be updated with new data.

Shape updates control whether the shape is visible based on motion data. The DI-Guy Graphics software looks at the switch value and calls show() or hide() as appropriate, so it is likely that this function does not need to be overridden in immediate mode.

The update() function for the link to which a shape is attached will be called before the shape's update() function.

Immediate Mode:

Immediate mode renderers usually do not override this function.

Scene Graph:

Scene graph renderers should override this function if they are supporting skinned characters. Each skinned shape can potentially have different uniforms that need to be sent to the video card; see get_shader_matrix_data().

Callable From:

  • N/A (automatically called by DI-Guy Graphics API during Update Stage)

Reimplemented from diguyGraphicsShape.

Member Data Documentation

char * diguyOsgGraphicsShape::s_ufrm_link_matrices_string = NULL
static
char * diguyOsgGraphicsShape::s_ufrm_link_colors_string = NULL
static

The documentation for this class was generated from the following files: