DI-Guy SDK Documentation  13.1
diguyGraphicsLink Class Reference

A class that represents the unique per-character non-shared joint of a character. A diguyCharacter is a hierarchy of links and joints. Think of the links as the bones of the characters while joints are the articulations. Note that the links themselves do not have any geometry directly associated with them; instead geometry is associated with shapes, which in turn are associated with links. More...

#include <diguyGraphicsLink.h>

Inheritance diagram for diguyGraphicsLink:
diguyOglGraphicsLink diguyOsgGraphicsLink

Public Member Functions

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 ()
 Returns the name of the link. More...
 
long get_uid ()
 All links are assigned a unique identifier, or uid. More...
 
int get_index ()
 Returns: index of the link. More...
 
diguyCharacterget_character ()
 Returns a pointer to the diguyCharacter to which this link belongs. More...
 
int get_num_shapes ()
 Returns: number of shapes on this link. More...
 
diguyGraphicsShapeget_shape_at_index (int index)
 Returns: pointer of type diguyGraphicsShape; NULL if no shape at the specified index. More...
 
diguyGraphicsShapefind_shape (const char *name)
 This function returns a pointer to the specified shape. More...
 
diguyGraphicsShapefind_shape_by_class_type (const char *name)
 This function returns a pointer to the specified shape. More...
 
diguyGraphicsJointType get_joint_type ()
 Returns the type of joint that attaches this link to its parent. More...
 
int get_offset_translation (float *tx, float *ty, float *tz)
 Returns in the passed variables the translation offset of this link from its parent. More...
 
int get_offset_rotation (float *rz, float *rx, float *ry)
 Returns in the passed variables the rotational offset of this link from its parent. More...
 
int get_translation (float *tx, float *ty, float *tz)
 Returns in the passed variables the translation amount of the link's joint. More...
 
int get_translation_double (double *tx, double *ty, double *tz)
 Returns in the passed variables the translation amount of the link's joint. More...
 
int get_translation_is_static ()
 Returns whether the translation returned by get_translation() is static (unchanging) or dynamic (can change frame to frame). More...
 
const char * get_var_name_tx ()
 Returns the name of the DI-Guy motion data variable that controls translation along the X axis. More...
 
const char * get_var_name_ty ()
 Returns the name of the DI-Guy motion data variable that controls translation along the Y axis. More...
 
const char * get_var_name_tz ()
 Returns the name of the DI-Guy motion data variable that controls translation along the Z axis. More...
 
int get_rotation (float *rz, float *rx, float *ry)
 Returns in the passed variables the rotation amount of the link's joint. More...
 
int get_rotation_euler (float *rz, float *rx, float *ry)
 Returns in the passed variables the rotation amount of the link's joint. More...
 
int get_rotation_quat (float *qx, float *qy, float *qz, float *qw)
 Returns in the passed variables the rotation amount of the link's joint. More...
 
int get_rotation_is_static ()
 Returns whether the rotation returned by get_rotation() is static (unchanging) or dynamic (can change frame to frame). More...
 
const char * get_var_name_rz ()
 Returns the name of the DI-Guy motion data variable that controls rotation about the Z axis. More...
 
const char * get_var_name_rx ()
 Returns the name of the DI-Guy motion data variable that controls rotation about the X axis. More...
 
const char * get_var_name_ry ()
 Returns the name of the DI-Guy motion data variable that controls rotation about the Y axis. More...
 
int get_scale (float *sz, float *sx, float *sy)
 Returns in the passed variables the scale amount of the link's joint. More...
 
int get_scale_is_static ()
 Returns whether the scale returned by get_scale() is static (unchanging) or dynamic (can change frame to frame). More...
 
const char * get_var_name_sx ()
 Returns the name of the DI-Guy motion data variable that controls scale in the Z dimension. More...
 
const char * get_var_name_sy ()
 Returns the name of the DI-Guy motion data variable that controls scale in the Y dimension. More...
 
const char * get_var_name_sz ()
 Returns the name of the DI-Guy motion data variable that controls scale in the X dimension. More...
 
diguyGraphicsLinkget_parent_link ()
 Returns a pointer to this link's parent link. More...
 
diguyGraphicsLinkget_attached_to_link ()
 Returns a pointer to this link's attached to link. More...
 
int get_is_position_link ()
 Returns 1 if this link is the position link, or 0 if not. More...
 
int get_num_child_links ()
 Returns how many child links this link has. More...
 
diguyGraphicsLinkget_child_link_at_index (int index)
 Returns a pointer to this link's child link at the specified index. More...
 
Matrix Retrieval Functions

All functions in this class section are restricted to C++.

int get_transformation_matrix (float matrix_array[4][4], int transpose=0)
 This function fills out the passed float array with the world-coordinate system transformation matrix of this link. More...
 
int get_transformation_matrix_4x4_ptr (float *matrix, int transpose=0)
 Pointer version of get_transformation_matrix(), see for docs. More...
 
int get_local_transformation_matrix (float matrix_array[4][4], int transpose=0)
 This function fills out the passed float array with the character-local-coordinate system transformation matrix of this link. More...
 
int get_local_transformation_matrix_4x4_ptr (float *matrix, int transpose=0)
 Pointer version of get_local_transformation_matrix(), see for docs. More...
 
int get_link_transformation_matrix (float matrix_array[4][4], int transpose=0)
 This function fills out the passed float array with the link-local-coordinate system transformation matrix of this link. More...
 
int get_link_transformation_matrix_4x4_ptr (float *matrix, int transpose=0)
 Pointer version of get_link_transformation_matrix(), see for docs. More...
 
const float * get_data_ptr ()
 Returns a pointer to the current motion data array. More...
 
const float * get_quat_data_ptr ()
 This function is similar to get_data_ptr(), except rotations in the returned array will be in quaternions instead of Euler angles. More...
 
int get_translation_data_index ()
 Returns the index of this link's translation data in the float array returned by get_data_ptr() or get_quat_data_ptr(). More...
 
int get_rotation_data_index ()
 Returns the index of this link's rotation data in the float array returned by get_data_ptr(). More...
 
int get_quat_data_index ()
 Returns the index of this link's rotation data in the float array returned by get_quat_data_ptr(). More...
 
int get_scale_data_index ()
 Returns the index of this link's scale data in the float array returned by get_data_ptr() or get_quat_data_ptr(). More...
 
int get_unique_color (unsigned char *r, unsigned char *g, unsigned char *b)
 Returns in the passed pointers the unique color of this link. More...
 
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 link objects to be created. More...
 
virtual void post_build ()
 This function will be called by DI-Guy when all links and shapes of a DI-Guy character have been built, providing an opportunity for final touch-ups to be made to the built hierarchy. More...
 
virtual void unbuild ()
 This function will be called by DI-Guy when it is time for the renderer-specific link objects created during the build() call to be destroyed. More...
 
virtual void attach_to_scene ()
 This function will be called by DI-Guy when it is time for renderer-specific link objects created during the build() call to be attached to their attach points. More...
 
virtual void detach_from_scene ()
 This function will be called by DI-Guy when it is time for renderer-specific link objects created during the build() call to be detached from their attach points. More...
 
virtual void instancing_state_changed (int instanced)
 TODO MARCM. More...
 
virtual void update ()
 This function will be called by DI-Guy when it is time for renderer-specific link objects created during the build() call to be updated with new transformation data. More...
 
virtual void push ()
 This function will be called by DI-Guy when it is traversing the link hierarchy to draw. More...
 
virtual void pop ()
 This function will be called by DI-Guy when it is traversing the link hierarchy to draw. More...
 
virtual void draw ()
 This function will be called by DI-Guy when it is time for the transformations of this link to be applied. More...
 
virtual void set_shader_instance (diguyGraphicsShaderInstance *shader_instance)
 This function will be called by DI-Guy when it a shader should be bound to this link. More...
 
Deprecated Functions

The following functions are deprecated.

As these functions may disappear in a future version of DI-Guy, it is recommended that you remove calls to these functions from your application.

int get_is_base_link ()
 Deprecated as of 9.1.4; use diguyGraphicsLink::get_is_position_link() instead. More...
 
int get_shader_matrix_index ()
 Deprecated as of 12.0.0 due to architecture change. More...
 

Experimental Functions

The following functions are experimental and may change or disappear with no warning.

virtual void begin_character_draw ()
 This function will be called by DI-Guy when the drawing of a new character is beginning. More...
 
virtual void end_character_draw ()
 This function will be called by DI-Guy when the drawing traversal of the character's link hierarchy has completed. More...
 
int get_inverse_rotation_matrix (float matrix_array[4][4], int transpose=0, int include_translation=1)
 
int get_inverse_rotation_matrix_4x4_ptr (float *matrix_array, int transpose=0, int include_translation=1)
 
static void set_use_linear_traversal_draw (int mode)
 This value corresponds to bdiGraphicsInitGraphicsAPI.use_linear_traversal_draw. More...
 
static int get_use_linear_traversal_draw ()
 This is always true as of DI-Guy 13. More...
 

Private Functions

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

No external access to them is expected or necessary.

bdiLinkm_scripted_object
 A pointer to internal data. More...
 
class bdiLink
 
class bdiGraphicsFactory
 
bdiLinkget_scripted_object ()
 
 diguyGraphicsLink (void *internal_data)
 A protected constructor. More...
 
virtual ~diguyGraphicsLink ()
 A protected destructor. More...
 

Detailed Description

A class that represents the unique per-character non-shared joint of a character. A diguyCharacter is a hierarchy of links and joints. Think of the links as the bones of the characters while joints are the articulations. Note that the links themselves do not have any geometry directly associated with them; instead geometry is associated with shapes, which in turn are associated with links.

Can be subclassed by filling out the diguy_graphics_set_link_create_func().

Constructor & Destructor Documentation

diguyGraphicsLink::diguyGraphicsLink ( void *  internal_data)
protected

A protected constructor.

Constructors are called automatically by DI-Guy.

virtual diguyGraphicsLink::~diguyGraphicsLink ( )
protectedvirtual

A protected destructor.

Destructors are called automatically by DI-Guy.

Member Function Documentation

const char* diguyGraphicsLink::get_name ( )

Returns the name of the link.

This pointer will never be NULL.

Returns:

name of the link

long diguyGraphicsLink::get_uid ( )

All links are assigned a unique identifier, or uid.

This function returns this links's uid.

Note: unique identifiers will change between DI-Guy runs!

Returns:

unique identifier of object

int diguyGraphicsLink::get_index ( )

Returns: index of the link.

diguyCharacter* diguyGraphicsLink::get_character ( )

Returns a pointer to the diguyCharacter to which this link belongs.

Returns:

pointer of type diguyCharacter

int diguyGraphicsLink::get_num_shapes ( )

Returns: number of shapes on this link.

diguyGraphicsShape* diguyGraphicsLink::get_shape_at_index ( int  index)

Returns: pointer of type diguyGraphicsShape; NULL if no shape at the specified index.

Parameters
indexindex of the shape; indices start at 0
diguyGraphicsShape* diguyGraphicsLink::find_shape ( const char *  name)

This function returns a pointer to the specified shape.

Parameters
namename of link to be found

Returns:

pointer of type diguyGraphicsShape; NULL if not found

diguyGraphicsShape* diguyGraphicsLink::find_shape_by_class_type ( const char *  name)

This function returns a pointer to the specified shape.

Parameters
namename of shape with class_type to be found, currently works with heads

Returns:

pointer of type diguyGraphicsShape; NULL if not found

diguyGraphicsJointType diguyGraphicsLink::get_joint_type ( )

Returns the type of joint that attaches this link to its parent.

Returns:

joint type of the link

int diguyGraphicsLink::get_offset_translation ( float *  tx,
float *  ty,
float *  tz 
)

Returns in the passed variables the translation offset of this link from its parent.

The offset will always remain fixed once DI-Guy is initialized.

Returned values are in meters.

Parameters
tx,ty,tzpointers to floats into which result should be placed

Returns:

0 on success, -1 on failure

int diguyGraphicsLink::get_offset_rotation ( float *  rz,
float *  rx,
float *  ry 
)

Returns in the passed variables the rotational offset of this link from its parent.

The offset will always remain fixed once DI-Guy is initialized.

Returned values are an Euler triple in degrees, and should be applied in RZ -> RX -> RY order, after the translation offset.

Parameters
rz,rx,rypointers to floats into which result should be placed

Returns:

0 on success, -1 on failure

int diguyGraphicsLink::get_translation ( float *  tx,
float *  ty,
float *  tz 
)

Returns in the passed variables the translation amount of the link's joint.

If there is a current render camera set, the position link's values will be in the local space of the camera. This is useful for rendering far from the origin.

The values may or may not stay constant frame to frame; see get_translation_is_static().

Returned values are in meters, and should be applied after the rotational offset (if any).

Parameters
tx,ty,tzpointers to floats into which result should be placed

Returns:

0 on success, -1 on failure

int diguyGraphicsLink::get_translation_double ( double *  tx,
double *  ty,
double *  tz 
)

Returns in the passed variables the translation amount of the link's joint.

The values may or may not stay constant frame to frame; see get_translation_is_static().

Returned values are in meters, and should be applied after the rotational offset (if any).

Parameters
tx,ty,tzpointers to doubles into which result should be placed

Returns:

0 on success, -1 on failure

int diguyGraphicsLink::get_translation_is_static ( )

Returns whether the translation returned by get_translation() is static (unchanging) or dynamic (can change frame to frame).

If the translation is dynamic the translation values will come from one or more DI-Guy motion variables; the names of the variables are accessible using the functions get_var_name_tx(), etc.

If the translation is static it will remain so; the value returned by this function should not change frame to frame.

Returns:

1 if translation is static, 0 if not, -1 on failure

const char* diguyGraphicsLink::get_var_name_tx ( )

Returns the name of the DI-Guy motion data variable that controls translation along the X axis.

The returned pointer will be NULL if there is no associated variable.

Returns:

name of the variable; NULL if there is no variable

const char* diguyGraphicsLink::get_var_name_ty ( )

Returns the name of the DI-Guy motion data variable that controls translation along the Y axis.

The returned pointer will be NULL if there is no associated variable.

Returns:

name of the variable; NULL if there is no variable

const char* diguyGraphicsLink::get_var_name_tz ( )

Returns the name of the DI-Guy motion data variable that controls translation along the Z axis.

The returned pointer will be NULL if there is no associated variable.

Returns:

name of the variable; NULL if there is no variable

int diguyGraphicsLink::get_rotation ( float *  rz,
float *  rx,
float *  ry 
)

Returns in the passed variables the rotation amount of the link's joint.

The values may or may not stay constant frame to frame; see get_rotation_is_static().

Returned values are an Euler triple in degrees, and should be applied in RZ -> RX -> RY order, after the translation.

Parameters
rz,rx,rypointers to floats into which result should be placed

Returns:

0 on success, -1 on failure

int diguyGraphicsLink::get_rotation_euler ( float *  rz,
float *  rx,
float *  ry 
)

Returns in the passed variables the rotation amount of the link's joint.

The values may or may not stay constant frame to frame; see get_rotation_is_static().

Returned values are an Euler triple in degrees, and should be applied in RZ -> RX -> RY order, after the translation.

Parameters
rz,rx,rypointers to floats into which result should be placed

Returns:

0 on success, -1 on failure

int diguyGraphicsLink::get_rotation_quat ( float *  qx,
float *  qy,
float *  qz,
float *  qw 
)

Returns in the passed variables the rotation amount of the link's joint.

The values may or may not stay constant frame to frame; see get_rotation_is_static().

Returned values are a quaternion and should be applied after the translation.

Parameters
qx,qy,qz,qwpointers to floats into which result should be placed

Returns:

0 on success, -1 on failure

int diguyGraphicsLink::get_rotation_is_static ( )

Returns whether the rotation returned by get_rotation() is static (unchanging) or dynamic (can change frame to frame).

If the rotation is dynamic the rotation values will come from one or more DI-Guy motion variables; the names of the variables are accessible using the functions get_var_name_rz(), etc.

If the rotation is static it will remain so; the value returned by this function should not change frame to frame.

Returns:

1 if rotation is static, 0 if not, -1 on failure

const char* diguyGraphicsLink::get_var_name_rz ( )

Returns the name of the DI-Guy motion data variable that controls rotation about the Z axis.

The returned pointer will be NULL if there is no associated variable.

const char* diguyGraphicsLink::get_var_name_rx ( )

Returns the name of the DI-Guy motion data variable that controls rotation about the X axis.

The returned pointer will be NULL if there is no associated variable.

const char* diguyGraphicsLink::get_var_name_ry ( )

Returns the name of the DI-Guy motion data variable that controls rotation about the Y axis.

The returned pointer will be NULL if there is no associated variable.

int diguyGraphicsLink::get_scale ( float *  sz,
float *  sx,
float *  sy 
)

Returns in the passed variables the scale amount of the link's joint.

The values may or may not stay constant frame to frame; see get_scale_is_static().

Returned values unitless scale factors, and should be applied after the rotation.

Parameters
sx,sy,szpointers to floats into which result should be placed

Returns:

0 on success, -1 on failure

int diguyGraphicsLink::get_scale_is_static ( )

Returns whether the scale returned by get_scale() is static (unchanging) or dynamic (can change frame to frame).

If the scale is dynamic the scale values will come from one or more DI-Guy motion variables; the names of the variables are accessible using the functions get_var_name_sx(), etc.

If the scale is static it will remain so; the value returned by this function should not change frame to frame.

Returns:

1 if scale is static, 0 if not, -1 on failure

const char* diguyGraphicsLink::get_var_name_sx ( )

Returns the name of the DI-Guy motion data variable that controls scale in the Z dimension.

The returned pointer will be NULL if there is no associated variable.

const char* diguyGraphicsLink::get_var_name_sy ( )

Returns the name of the DI-Guy motion data variable that controls scale in the Y dimension.

The returned pointer will be NULL if there is no associated variable.

const char* diguyGraphicsLink::get_var_name_sz ( )

Returns the name of the DI-Guy motion data variable that controls scale in the X dimension.

The returned pointer will be NULL if there is no associated variable.

diguyGraphicsLink* diguyGraphicsLink::get_parent_link ( )

Returns a pointer to this link's parent link.

Parent links are always links within the same character. If a link is attached to a link in another character (i.e., it is "parented to" another link), that link pointer can be obtained by calling get_attached_to_link().

The returned pointer will be NULL if the link is the position link and has no parent.

Returns:

object of type diguyGraphicsLink

diguyGraphicsLink* diguyGraphicsLink::get_attached_to_link ( )

Returns a pointer to this link's attached to link.

The attached to link is different than the parent link in that a parent link is always a link in the same character, while an attached to link is always a link in a different character.

Only position links can be attached to links of another character.

The returned pointer will be NULL if the link is not attached to the link of another character.

Returns:

object of type diguyGraphicsLink

int diguyGraphicsLink::get_is_position_link ( )

Returns 1 if this link is the position link, or 0 if not.

The position link is the root link of the DI-Guy character's link and shape hierarchy, and has no parent link.

Returns:

1 if this link is the position link, 0 if not, -1 on error

int diguyGraphicsLink::get_num_child_links ( )

Returns how many child links this link has.

Child links can be accessed using the get_child_link_at_index() function.

Returns:

number of child links

diguyGraphicsLink* diguyGraphicsLink::get_child_link_at_index ( int  index)

Returns a pointer to this link's child link at the specified index.

The returned pointer will be NULL if there is no link at that index.

Parameters
indexindex of the child link; indices start at 0

Returns:

object of type diguyGraphicsLink

int diguyGraphicsLink::get_transformation_matrix ( float  matrix_array[4][4],
int  transpose = 0 
)

This function fills out the passed float array with the world-coordinate system transformation matrix of this link.

NOTE:

If the character's performance level (CPL) is 3 or greater, link matrices are not computed or updated, and this call should not be used. See diguyCharacter::set_minimum_cpl() for more information.

Parameters
matrix_arraytwo-dimensional array of floats into which the matrix should be copied
transposedefaults to zero, sets if the matrix should be
treatedas row major or column-major

Returns:

0 on success, -1 on failure

int diguyGraphicsLink::get_transformation_matrix_4x4_ptr ( float *  matrix,
int  transpose = 0 
)

Pointer version of get_transformation_matrix(), see for docs.

Some end users might prefer this version to avoid copying data from an explicit float[4][4].

int diguyGraphicsLink::get_local_transformation_matrix ( float  matrix_array[4][4],
int  transpose = 0 
)

This function fills out the passed float array with the character-local-coordinate system transformation matrix of this link.

NOTE:

If the character's performance level (CPL) is 3 or greater, link matrices are not computed or updated, and this call should not be used. See diguyCharacter::set_minimum_cpl() for more information.

Parameters
matrix_arraytwo-dimensional array of floats into which the matrix should be copied
transposedefaults to 0, sets if the matrix should be treated
asrow major or column-major

Returns:

0 on success, -1 on failure

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

Pointer version of get_local_transformation_matrix(), see for docs.

Some end users might prefer this version to avoid copying data from an explicit float[4][4].

int diguyGraphicsLink::get_link_transformation_matrix ( float  matrix_array[4][4],
int  transpose = 0 
)

This function fills out the passed float array with the link-local-coordinate system transformation matrix of this link.

This is the same value as the matrix built from get_rotation() and get_translation()

NOTE:

If the character's performance level (CPL) is 3 or greater, link matrices are not computed or updated, and this call should not be used. See diguyCharacter::set_minimum_cpl() for more information.

Parameters
matrix_arraytwo-dimensional array of floats into which the matrix should be copied
transposedefaults to 0, sets if the matrix should be treated
asrow major or column-major

Returns:

0 on success, -1 on failure

int diguyGraphicsLink::get_link_transformation_matrix_4x4_ptr ( float *  matrix,
int  transpose = 0 
)

Pointer version of get_link_transformation_matrix(), see for docs.

Some end users might prefer this version to avoid copying data from an explicit float[4][4].

const float* diguyGraphicsLink::get_data_ptr ( )

Returns a pointer to the current motion data array.

Along with data indices returned below, motion data can be directly read from this state vector instead of making multiple calls for getting transform data.

The rotations in this array will be in Euler angles. If quaternions are being used, get_quat_data_ptr() should be called instead.

This function may return NULL, in which case the functions get_translation(), get_rotation(), and get_scale() must be used.

The pointer returned by this function may change from frame to frame, and therefore should not be saved.

This function should not be used for the position link (when get_is_position_link() returns 1).

This function should not be called in a derived class's constructor; the pointer will not yet be valid.

Returns:

pointer to floats; may return NULL if array isn't available

Callable From:

  • C++
const float* diguyGraphicsLink::get_quat_data_ptr ( )

This function is similar to get_data_ptr(), except rotations in the returned array will be in quaternions instead of Euler angles.

Returns:

pointer to floats; may return NULL if array isn't available

Callable From:

  • C++
int diguyGraphicsLink::get_translation_data_index ( )

Returns the index of this link's translation data in the float array returned by get_data_ptr() or get_quat_data_ptr().

The translation values are in (tx, ty, tz) order in the array.

This function may return -1, in which case this link has no translation data.

The index returned by this function will not change from frame to frame, and can therefore be saved once it has been obtained.

This function should not be used for the position link (when get_is_position_link() returns 1). Use get_translation() instead.

This function should not be called in a derived class's constructor; the index will not yet be valid.

Returns:

index into float array; -1 if no translation data for link

int diguyGraphicsLink::get_rotation_data_index ( )

Returns the index of this link's rotation data in the float array returned by get_data_ptr().

If quaternion data is being used, call get_quat_data_ptr() instead.

The rotation values in the data array will be Euler angles in (rz, rx, ry) order.

This function may return -1, in which case this link has no rotation data.

This function should not be used for the position link (when get_is_position_link() returns 1). Use get_rotation() instead.

This function should not be called in a derived class's constructor; the index will not yet be valid.

Returns:

index into float array; -1 if no rotation data for link

int diguyGraphicsLink::get_quat_data_index ( )

Returns the index of this link's rotation data in the float array returned by get_quat_data_ptr().

If Euler angle data is being used, call get_data_ptr() instead.

The rotation values in the data array will be a quaternion in (qx, qy, qz, qw) order.

This function may return -1, in which case this link has no rotation data.

The index returned by this function will not change from frame to frame, and can therefore be saved once it has been obtained.

This function should not be used for the position link (when get_is_position_link() returns 1). Use get_rotation() instead.

This function should not be called in a derived class's constructor; the index will not yet be valid.

Returns:

index into float array; -1 if no rotation data for link

int diguyGraphicsLink::get_scale_data_index ( )

Returns the index of this link's scale data in the float array returned by get_data_ptr() or get_quat_data_ptr().

The scale values are in (sx, sy, sz) order in the array.

This function may return -1, in which case this link has no scale data.

The index returned by this function will not change from frame to frame, and can therefore be saved once it has been obtained.

This function should not be used for the position link (when get_is_position_link() returns 1). Use get_scale() instead.

This function should not be called in a derived class's constructor; the index will not yet be valid.

Returns:

index into float array; -1 if no scale data for link

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

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

All links 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

Test with lua probably non-functional

virtual void diguyGraphicsLink::build ( )
virtual

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

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

Builds happen in depth-first traversal order, so the parent's build() function will always be called before this link's build() function.

Immediate Mode:

Immediate mode renderers usually do not override this function.

Scene Graph:

Scene graph renderers usually do override this function, to create scene graph nodes that allow for the various transformations to happen.

The following nodes are commonly created:

  • a static transform node to hold the offsets
  • a dynamic transform node (or DOF) to allow motion data to be applied
  • either an LOD or switch node to allow graphics LODs to be applied

    LOD nodes, that automatically handle LOD switching, should be created if automatic LOD switching is desired.

    A switch node should be created if manual setting of the graphics LOD is desired.

    If this link is a position link (it has no parent link), the scene graph nodes should not yet be attached to the scene graph; that should be done during the call to attach().

    Otherwise the scene graph nodes should start out attached to their attach points (a scene graph node of the parent link).

Callable From:

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

Reimplemented in diguyOsgGraphicsLink.

virtual void diguyGraphicsLink::post_build ( )
virtual

This function will be called by DI-Guy when all links and shapes of a DI-Guy character have been built, providing an opportunity for final touch-ups to be made to the built hierarchy.

This function will be called only for the top-level position link.

Immediate Mode:

Immediate mode renderers usually do not override this function.

Scene Graph:

Scene graph renderers sometimes override this function. They might to so to do renderer-specific optimizations to the created hierarchy.

Callable From:

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

Reimplemented in diguyOsgGraphicsLink.

virtual void diguyGraphicsLink::unbuild ( )
virtual

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

Unbuilds happen in reverse depth-first traversal order, so this link's unbuild() function will always be called before the parent's unbuild() function.

Immediate Mode:

Immediate mode renderers usually do not override this function.

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 diguyOsgGraphicsLink.

virtual void diguyGraphicsLink::attach_to_scene ( )
virtual

This function will be called by DI-Guy when it is time for renderer-specific link objects created during the build() call to be attached to their attach points.

This function will only be called for the position link.

Immediate Mode:

Immediate mode renderers usually do not override this function.

Scene Graph:

Scene graph renderers usually do override this function, to attach the scene graph nodes created during build() to somewhere on the scene graph.

Callable From:

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

Reimplemented in diguyOsgGraphicsLink.

virtual void diguyGraphicsLink::detach_from_scene ( )
virtual

This function will be called by DI-Guy when it is time for renderer-specific link objects created during the build() call to be detached from their attach points.

Immediate Mode:

Immediate mode renderers usually do not override this function.

Scene Graph:

Scene graph renderers usually do override this function, to detach the scene graph nodes created during build() from the scene graph.

Callable From:

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

Reimplemented in diguyOsgGraphicsLink.

virtual void diguyGraphicsLink::instancing_state_changed ( int  instanced)
virtual

TODO MARCM.

Immediate Mode:

Immediate mode renderers usually do not override this function.

Scene Graph:

TODO MARCM

Callable From:

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

Reimplemented in diguyOsgGraphicsLink.

virtual void diguyGraphicsLink::update ( )
virtual

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

Updates happen in depth-first traversal order, so the parent's update() function will always be called before this link's update() function.

Immediate Mode:

Immediate mode renderers usually do not override this function.

Scene Graph:

Scene graph renderers usually do override this function, to update the scene graph nodes created during build() with new values.

These values should be obtained by calling get_translation(), get_rotation(), and get_scale().

Callable From:

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

Reimplemented in diguyOsgGraphicsLink.

virtual void diguyGraphicsLink::push ( )
virtual

This function will be called by DI-Guy when it is traversing the link hierarchy to draw.

Immediate Mode:

Immediate mode renderers can override this function. Typically some type of transformation matrix stack push operation is performed.

Scene Graph:

Scene graph renderers usually do not override this function; transformation states are handled automatically by scene graphs.

Callable From:

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

Reimplemented in diguyOglGraphicsLink.

virtual void diguyGraphicsLink::pop ( )
virtual

This function will be called by DI-Guy when it is traversing the link hierarchy to draw.

Immediate Mode:

Immediate mode renderers can override this function. Typically some type of transformation matrix stack pop operation is performed.

Scene Graph:

Scene graph renderers usually do not override this function; transformation states are handled automatically by scene graphs.

Callable From:

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

Reimplemented in diguyOglGraphicsLink.

virtual void diguyGraphicsLink::draw ( )
virtual

This function will be called by DI-Guy when it is time for the transformations of this link to be applied.

Immediate Mode:

Immediate mode renderers usually do override this function, to apply transformations to the transformation stack.

Scene Graph:

Scene graph renderers usually do not override this function; transformation states are handled automatically by scene graphs.

Callable From:

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

Reimplemented in diguyOglGraphicsLink.

virtual void diguyGraphicsLink::set_shader_instance ( diguyGraphicsShaderInstance shader_instance)
virtual

This function will be called by DI-Guy when it a shader should be bound to this link.

This is important in some scene graph environments, when the scene graph is responsible for binding the shader.

Immediate Mode:

Immediate mode renderers usually do not override this function.

Scene Graph:

Scene graph renderers can override this function but some don't need to.

Callable From:

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

Reimplemented in diguyOsgGraphicsLink.

virtual void diguyGraphicsLink::begin_character_draw ( )
virtual

This function will be called by DI-Guy when the drawing of a new character is beginning.

This happens when the position link is drawn.

Immediate Mode:

Immediate mode renderers can override this function. Typically some type of transformation matrix stack push operation is performed. This is also an appropriate place to do any per-character modifications, such as:

  • applying scale
  • applying the base translation of the character
  • picking a current LOD
  • etc.

Scene Graph:

Scene graph renderers usually do not override this function; transformation states are handled automatically by scene graphs.

Callable From:

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

Reimplemented in diguyOglGraphicsLink.

virtual void diguyGraphicsLink::end_character_draw ( )
virtual

This function will be called by DI-Guy when the drawing traversal of the character's link hierarchy has completed.

Immediate Mode:

Immediate mode renderers can override this function. Typically any matrix stack push operation done in begin_character_draw() is undone here by an appropriate pop operation.

Scene Graph:

Scene graph renderers usually do not override this function; transformation states are handled automatically by scene graphs.

Callable From:

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

Reimplemented in diguyOglGraphicsLink.

static void diguyGraphicsLink::set_use_linear_traversal_draw ( int  mode)
static

This value corresponds to bdiGraphicsInitGraphicsAPI.use_linear_traversal_draw.

As of DI-Guy 13 this can only be true.

//linear draw behavior
{
// push the base transform of the character in the world
// the get_transformation_matrix() of the position link
m_position_link->begin_character_draw();
int i;
for each link in link array
{
// note the ability to skip links with nothing attached to them
if (link->get_num_shapes() > 0 || link->get_is_position_link())
{
// each link should multiply by the get_local_transformation_matrix
// which contains the precalculated concatenated matrix
link->push();
link->draw();
link->pop();
}
}
m_position_link->end_character_draw();
static int diguyGraphicsLink::get_use_linear_traversal_draw ( )
static

This is always true as of DI-Guy 13.

See set_use_linear_traversal_draw().

int diguyGraphicsLink::get_inverse_rotation_matrix ( float  matrix_array[4][4],
int  transpose = 0,
int  include_translation = 1 
)
int diguyGraphicsLink::get_inverse_rotation_matrix_4x4_ptr ( float *  matrix_array,
int  transpose = 0,
int  include_translation = 1 
)
int diguyGraphicsLink::get_is_base_link ( )

Deprecated as of 9.1.4; use diguyGraphicsLink::get_is_position_link() instead.

int diguyGraphicsLink::get_shader_matrix_index ( )

Deprecated as of 12.0.0 due to architecture change.

bdiLink* diguyGraphicsLink::get_scripted_object ( )
inline

Friends And Related Function Documentation

friend class bdiLink
friend
friend class bdiGraphicsFactory
friend

Member Data Documentation

bdiLink* diguyGraphicsLink::m_scripted_object
private

A pointer to internal data.


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