DI-Guy SDK Documentation  13.2
diguyGraphicsShape Class Reference

A class that represents the unique per-character non-shared mesh object. DI-Guy encapsulates its textured geometry in objects called shapes. One or more shapes are associated with each link, so when a link is "drawn", it is actually its array of shapes that are drawn. For example, a head link might have two shapes associated with it: A human head and a helmet. A shape can either be a rigid mesh or a skinned one. More...

#include <diguyGraphicsShape.h>

Inheritance diagram for diguyGraphicsShape:
diguyDx11GraphicsShape diguyDx9GraphicsShape diguyOglGraphicsShape diguyOsgGraphicsShape

Public Member Functions

Virtual Functions

The functions in this section are all virtual functions that will be called by DI-Guy at various times during DI-Guy execution.

Because the functions are all virtual, DI-Guy programmers can create a subclass of this class and override them. Unless otherwise stated, the base class functions do not need to be called.

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 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...
 
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 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 set_graphics_lod_ranges (float *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_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...
 
virtual void instancing_state_changed (int val)
 
int get_link_to_matrix_table (int *num_matrices, const float **lookup_data)
 
int get_bone_index_from_link_index (int link_index)
 accesses underlying shader matrix lookup table. More...
 
int get_has_offset_matrix () const
 Returns true if this shape is attached to a link with a connection point offset. More...
 
int get_offset_matrix_4x4_ptr (float *matrix, int transpose=0) const
 Fills out a 4x4 matrix with the connection point's offset from parent link. More...
 
int get_local_transformation_matrix_4x4_ptr (float *matrix, int transpose=0) const
 This function fills out the passed float array with the character-local-coordinate system transformation matrix of this shape, will only be different from it's parent link if it has an offset matrix. More...
 
int get_bounding_box (float *bbox_min_x, float *bbox_min_y, float *bbox_min_z, float *bbox_max_x, float *bbox_max_y, float *bbox_max_z)
 Documentation Pending. More...
 

Accessor Functions

The functions in this section provide access to data in this object.

They are designed to be called by DI-Guy programmers.

Unless otherwise noted all functions in this class section are callable from:

  • C++
  • Script
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 () const
 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...
 
const char * get_class_type () const
 returns the class type of the shape... More...
 
const char * get_object_type () const
 returns the object type of the shape... More...
 
const char * get_material_type () const
 returns the material type of the shape... this is an optional data More...
 
int get_is_pbr_ready () const
 returns if pbr shader should be used 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 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_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)
 By default DI-Guy provides three 4 float uniforms at the shape level that can be used by end users to customize the appearance of characters via shaders and misc textures. 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_row (const char *name)
 Returns the row of the shared variation texture to use for this drawable. 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 get_variation_texture_row ()
 Returns the row of the large global variation texture map to use for this shapes data. More...
 
void set_variation_texture_data (unsigned char *texture_data)
 takes ownership of the data 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...
 
static int get_shared_variation_texture_size ()
 Returns the number of rows in the shared variation texture. More...
 

Private Functions

The functions and variables past this point are for internal use only.

No external access to them is expected or necessary.

bdiShapem_scripted_object
 A pointer to internal data. More...
 
class bdiShape
 
class bdiGraphicsFactory
 
bdiShapeget_scripted_object ()
 
 diguyGraphicsShape (void *internal_data)
 A protected constructor. More...
 
virtual ~diguyGraphicsShape ()
 A protected destructor. More...
 

Detailed Description

A class that represents the unique per-character non-shared mesh object. DI-Guy encapsulates its textured geometry in objects called shapes. One or more shapes are associated with each link, so when a link is "drawn", it is actually its array of shapes that are drawn. For example, a head link might have two shapes associated with it: A human head and a helmet. A shape can either be a rigid mesh or a skinned one.

Can be subclassed by filling out the diguy_graphics_set_shape_create_func().

Constructor & Destructor Documentation

diguyGraphicsShape::diguyGraphicsShape ( void *  internal_data)
protected

A protected constructor.

Constructors are called automatically by DI-Guy.

virtual diguyGraphicsShape::~diguyGraphicsShape ( )
protectedvirtual

A protected destructor.

Destructors are called automatically by DI-Guy.

Member Function Documentation

const char* diguyGraphicsShape::get_name ( )

This function returns the name of the shape.

The returned pointer will never be NULL.

Returns:

name of the shape as C string

long diguyGraphicsShape::get_uid ( )

All shapes are assigned a unique identifier, or uid.

This function returns this shape's uid.

Note: unique identifiers can change between DI-Guy runs.

Returns:

unique identifier of object

diguyCharacter* diguyGraphicsShape::get_character ( )

This function returns a pointer to the diguyCharacter to which this shape belongs.

Returns:

pointer of type diguyCharacter

const char* diguyGraphicsShape::get_shape_set_name ( )

This function returns the name of the shape set of which this shape is a part.

A shape set is a collection of shapes that are related, coming from a set of related geometry files, sometimes one file per LOD.

A shape is a collection of parts each representing the same thing at varying levels of detail.

For example, in its config files DI-Guy has a shape set named "firefighter", which references five OpenFlight files named firefighter_LOD1.flt through firefighter_LOD5.flt. The firefighter shape set contains separate shapes for the head, arms, legs, etc., at five different levels of detail.

Use the function get_shape_set_filename_for_lod() to get the actual geometry filenames that should be used for each LOD.

Returns:

shape set of shape as C string

const char* diguyGraphicsShape::get_shape_set_shape_name ( )

This function returns the name of the shape.

This name identifies which pieces of geometry out of the shape set should comprise the shape.

Returns:

shape name of shape as C string

const char* diguyGraphicsShape::get_recommended_attachment_link_name ( )

This function returns the name of the link to which this shape is typically attached.

Use the function get_link() to get a pointer to the actual link to which this shape is attached.

Returns:

name of recommended attachment link as C string

int diguyGraphicsShape::get_num_lods ( )

This function returns how many LODs this shape has.

This will be a number between 1 and 7.

Returns:

number of LODs

float* diguyGraphicsShape::get_lod_ranges ( )

This function returns the LOD ranges of this shape.

The returned pointer points to an array of eight floats, which represent ranges in meters at which LODs should be shown.

Returns:

LOD ranges

Only Callable From C++

int diguyGraphicsShape::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().

Returns:

LOD index; integer from 1 to get_num_lods()

const char* diguyGraphicsShape::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.

Parameters
lodlevel of detail; a number between 1 and get_num_lods()

Returns:

geometry filename as C string

int diguyGraphicsShape::get_num_meshes ( int  lod)

This function returns the number of low-level geometry meshes that comprise this shape.

Parameters
lodlevel of detail; a number between 1 and get_num_lods()

Returns:

number of meshes in this shape

diguyGraphicsMesh* diguyGraphicsShape::get_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.

Parameters
indexindex of mesh; a number between 0 and get_num_meshes() - 1
lodlevel of detail; a number between 1 and get_num_lods()

Returns:

pointer to object of type diguyGraphicsMesh; NULL on error

diguyGraphicsLink* diguyGraphicsShape::get_link ( )

This function returns a pointer to the link to which this shape is actually attached.

Parameters
indexindex of mesh; a number between 0 and get_num_meshes() - 1
lodlevel of detail; a number between 1 and get_num_lods()

Returns:

pointer to object of type diguyGraphicsMesh; NULL on error

const char* diguyGraphicsShape::get_switch_var_name ( )

This function returns the name of the DI-Guy motion data variable that controls whether this shape should be visible.

The returned pointer will be NULL if there is no associated variable. This visiblity can be overridden by calling diguyGraphicsLink::set_shape_switch_override() on the parent link.

Returns:

name of the variable; NULL if there is no variable

int diguyGraphicsShape::get_switch_value ( )

This function returns the value of the DI-Guy motion data variable for which the shape should be visible.

Note that the variable in the motion data is a float, but gets cast to an integer and compared against this number during shape updates.

Returns:

number representing value for which shape should be visible

int diguyGraphicsShape::get_is_hidden ( ) const

This function returns whether this shape should currently be hidden or shown, based on the value of the shape's switch variable (if any).

Returns:

1 if shape is hidden, 0 if not

int diguyGraphicsShape::set_is_hidden ( int  hidden)

hides or shows the shape

const char* diguyGraphicsShape::get_class_type ( ) const

returns the class type of the shape...

typically 'head' or 'body' or 'hands'. characters should only have one shape with a given class type, this is optional data.

const char* diguyGraphicsShape::get_object_type ( ) const

returns the object type of the shape...

this is an optional data and typically used to identify what's in a characters hands.

const char* diguyGraphicsShape::get_material_type ( ) const

returns the material type of the shape... this is an optional data

int diguyGraphicsShape::get_is_pbr_ready ( ) const

returns if pbr shader should be used

diguyGraphicsFile* diguyGraphicsShape::get_diguy_graphics_file ( int  lod)

This function returns the geometry file from which geometry for the shape was read.

Each LOD of the shape may potentially come from a different file.

Note that if a diguyGraphicsFile create function has not been registered with a call to diguy_graphics_set_file_create_func(), this function will return NULL.

Parameters
lodlevel of detail; a number between 1 and get_num_lods()

Returns:

object of type diguyGraphicsFile

void* diguyGraphicsShape::get_diguy_graphics_file_part ( int  lod)

This function returns a pointer to an object that represents the geometry for the shape.

The returned object is an object that has been returned by a previous call to diguyGraphicsFile::find_part(), and can be safely cast to the type of object that has been so returned.

Note that if a diguyGraphicsFile create function has not been registered with a call to diguy_graphics_set_file_create_func(), this function will return NULL.

Parameters
lodlevel of detail; a number between 1 and get_num_lods()

Returns:

generic object which must be cast appropriately

Only Callable From C++

int diguyGraphicsShape::get_graphics_state_switch_index ( )

Some shapes have meshes that have multiple selectable graphics states, including materials and textures.

This function returns the value that specifies which graphics state to use for meshes of this shape.

This is different than get_switch_value(), which returns the value of the switch that controls whether or not meshes of this state are shown.

Returns:

value of state switch; -1 if there is no state switch

int diguyGraphicsShape::get_num_switched_graphics_states ( )

Returns the number of switched graphics states available to this shape.

See get_graphics_state_switch_index().

Returns:

number of switched graphics states

diguyGraphicsState* diguyGraphicsShape::get_switched_graphics_state ( int  switch_value = -1)

Returns the graphics state associated with the passed switch value.

Returns:

pointer to type diguyGraphicsState

int diguyGraphicsShape::set_state_switch_index ( int  index)

Sets current material swap index, allows overriding of value that was set based on appearance settings.

int diguyGraphicsShape::get_unique_color ( unsigned char *  r,
unsigned char *  g,
unsigned char *  b 
)

Returns in the passed pointers the unique color of this shape.

All shapes in a DI-Guy appearance are assigned a unique RGB color that can be used in pick/selection operations.

Also see diguyScenario::map_color_to_impact().

See programming_examples/diguy_graphics_api/ogl_examples/intersection_test for an example of its usage.

Returns:

0 on success, -1 on failure

int diguyGraphicsShape::get_contains_skinned_file ( )

This function identifies if this shape has skinned data.

Scene graph renderers will need to know this in the build phase to help set up the matrix data shader functionality.

Returns:

1 if contains at lease one file with skinned data, 0 if not

int diguyGraphicsShape::set_material_parameter_4f ( const char *  parameter_name,
float  x,
float  y,
float  z,
float  w,
float  blend_time = 0.0 
)

By default DI-Guy provides three 4 float uniforms at the shape level that can be used by end users to customize the appearance of characters via shaders and misc textures.

You can see a demonstration of this in the Exface_sales_demo.dss file where an additional texture is used. The uniforms are named:

-"ufrm_blood_color" -"ufrm_grime_color" -"ufrm_glow_color"

Example:

local character = this_scenario:get_character_at_index(0);
local link = character:get_link_at_index(0);
local shape = link:find_shape_by_class_type("head");
shape:set_material_parameter_4f("ufrm_blood_color",1,.1,.1,.5, 1);
int diguyGraphicsShape::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.

Returns -1 if the parameter can't be found.

unsigned char* diguyGraphicsShape::get_variation_texture ( )

Returns a char * of length get_variation_texture_size() that represents the pixels in a unique per shape texture.

Typically a Retained mode renderer would need to use this to load a state node with the texture see diguyOsgGraphicsShape.cpp for an example. For an immediate mode renderer we push the texture to the object via update_variation_texture()

int diguyGraphicsShape::get_variation_texture_size ( )

Returns the size of the texture specified in get_variation_texture()

static int diguyGraphicsShape::get_shared_variation_texture_size ( )
static

Returns the number of rows in the shared variation texture.

int diguyGraphicsShape::get_num_variations ( )

Returns the number of texture variations that this shape has.

const char* diguyGraphicsShape::get_variation_name ( int  variation_index)

Returns the name of the texture variations at variation_index.

int diguyGraphicsShape::set_variation_index ( int  variation_index)

Sets the shape to have the variation specified at variation_index, returns -1 if out of array bounds.

int diguyGraphicsShape::get_has_custom_variation ( )

true if set_unique_ramp_data() is ever called on this object.

int diguyGraphicsShape::get_num_variation_components ( )

Returns the number of different components in the current variation texture.

const char* diguyGraphicsShape::get_variation_component_name ( int  index)

Returns the name of the component at index in the current variation texture.

int diguyGraphicsShape::get_variation_component_row ( const char *  name)

Returns the row of the shared variation texture to use for this drawable.

int diguyGraphicsShape::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.

values should range from 0 to 1.0, where .5 is no change. 0.0 is black and 1.0 is full brightness.

int diguyGraphicsShape::get_variation_texture_row ( )

Returns the row of the large global variation texture map to use for this shapes data.

Returns 0 for the default color shift row

void diguyGraphicsShape::set_variation_texture_data ( unsigned char *  texture_data)

takes ownership of the data

int diguyGraphicsShape::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().

Scene graph renderers should queue up this data to be sent to the graphics card at the appropriate time.

Note that the format of the data in mat_data will be affected by the bdiGraphicsInitGraphicsAPI variable transpose_shader_matrices value.

Callable From:

C++
int diguyGraphicsShape::get_are_shader_matrices_transposed ( )

Returns the transpose state of the shader matrices.

Returns:

1 if shader matrices are transposed, 0 otherwise.

virtual void diguyGraphicsShape::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 in diguyOglGraphicsShape, diguyOsgGraphicsShape, diguyDx9GraphicsShape, and diguyDx11GraphicsShape.

virtual void diguyGraphicsShape::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 in diguyOglGraphicsShape, diguyOsgGraphicsShape, diguyDx9GraphicsShape, and diguyDx11GraphicsShape.

virtual void diguyGraphicsShape::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 in diguyOsgGraphicsShape.

virtual void diguyGraphicsShape::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 in diguyOglGraphicsShape, and diguyOsgGraphicsShape.

virtual void diguyGraphicsShape::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 in diguyOglGraphicsShape, and diguyOsgGraphicsShape.

virtual void diguyGraphicsShape::draw ( int  lod)
virtual

This function will be called by DI-Guy when it is time for the geometry of this shape to be drawn.

Immediate Mode:

Immediate mode renderers usually do not override this function. The actual draw calls happen in diguyGraphicsMesh::draw() calls.

Scene Graph:

Scene graph renderers usually do not override this function; drawing is handled automatically by scene graphs.

Callable From:

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

Reimplemented in diguyOglGraphicsShape, diguyDx9GraphicsShape, and diguyDx11GraphicsShape.

virtual void diguyGraphicsShape::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 in diguyOsgGraphicsShape.

virtual void diguyGraphicsShape::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 in diguyOsgGraphicsShape.

virtual void diguyGraphicsShape::update_variation_texture ( int  num_pixels,
unsigned char *  pixel_data 
)
virtual

Pushes a char * pixel buffer of length num_pixels that represents the unique per shape texture.

Typically a Immediate mode renderer would need to use this to create or update a texture see diguyOglGraphicsShape.cpp for an example. For an retained mode renderer we have get_variation_texture() as an accessor.

Callable From:

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

Reimplemented in diguyOsgGraphicsShape, and diguyOglGraphicsShape.

int diguyGraphicsShape::get_bind_color_array ( int *  num_colors,
const float **  color_data 
)

Returns the unique color of the character links.

All links in a DI-Guy appearance are assigned a unique RGB color that can be used in pick/selection operations. The data returned in color_data is an array of length num_colors with 4 floats per entry (r, g, b, a).

See programming_examples/diguy_graphics_api/osg_2_examples/intersection_test for an example of its usage.

Returns:

0 on success, -1 on failure

virtual void diguyGraphicsShape::instancing_state_changed ( int  val)
virtual

Reimplemented in diguyOsgGraphicsShape.

int diguyGraphicsShape::get_link_to_matrix_table ( int *  num_matrices,
const float **  lookup_data 
)
int diguyGraphicsShape::get_bone_index_from_link_index ( int  link_index)

accesses underlying shader matrix lookup table.

int diguyGraphicsShape::get_has_offset_matrix ( ) const

Returns true if this shape is attached to a link with a connection point offset.

int diguyGraphicsShape::get_offset_matrix_4x4_ptr ( float *  matrix,
int  transpose = 0 
) const

Fills out a 4x4 matrix with the connection point's offset from parent link.

int diguyGraphicsShape::get_local_transformation_matrix_4x4_ptr ( float *  matrix,
int  transpose = 0 
) const

This function fills out the passed float array with the character-local-coordinate system transformation matrix of this shape, will only be different from it's parent link if it has an offset matrix.

int diguyGraphicsShape::get_bounding_box ( float *  bbox_min_x,
float *  bbox_min_y,
float *  bbox_min_z,
float *  bbox_max_x,
float *  bbox_max_y,
float *  bbox_max_z 
)

Documentation Pending.

bdiShape* diguyGraphicsShape::get_scripted_object ( )
inline

Friends And Related Function Documentation

friend class bdiShape
friend
friend class bdiGraphicsFactory
friend

Member Data Documentation

bdiShape* diguyGraphicsShape::m_scripted_object
private

A pointer to internal data.


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