![]() |
DI-Guy SDK Documentation
13.7
|
DI-Guy 'links' are essentially the same as 'bones' in other APIs. More...
#include <diguyOsgGraphicsLink.h>
Public Member Functions | |
| diguyOsgGraphicsLink (void *internal_data) | |
| virtual void | build () override |
| This function will be called by DI-Guy when it is time for renderer-specific link objects to be created. More... | |
| virtual void | unbuild () override |
| 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 | update () override |
| 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 | 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 is_instanced) override |
| virtual void | set_shader_instance (diguyGraphicsShaderInstance *shader_instance) override |
| This function will be called by DI-Guy when it a shader should be bound to this link. 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... | |
| osg::MatrixTransform * | get_dof_node () |
| osg::StateSet * | get_top_level_state_set () |
| osg::Geode * | get_bounding_sphere_visual () |
| static int s_transformation_mode; More... | |
Public Member Functions inherited from diguyGraphicsLink | |
| 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... | |
| diguyCharacter * | get_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... | |
| diguyGraphicsShape * | get_shape_at_index (int index) |
| Returns: pointer of type diguyGraphicsShape; NULL if no shape at the specified index. More... | |
| diguyGraphicsShape * | find_shape (const char *name) |
| This function returns a pointer to the specified shape. More... | |
| diguyGraphicsShape * | find_shape_by_class_type (const char *name) |
| This function returns a pointer to the specified shape. More... | |
| void | set_shape_switch_override (const char *switch_name, int value) |
| This function overrides the motion data driving the visibility child shapes. More... | |
| diguyGraphicsJointType | get_joint_type () |
| Returns the type of joint that attaches this link to 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... | |
| int | get_initial_translation (float *tx, float *ty, float *tz) |
| Returns in the passed variables the initial translation amount of the link's joint. 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... | |
| diguyGraphicsLink * | get_parent_link () |
| Returns a pointer to this link's parent link. More... | |
| diguyGraphicsLink * | get_position_link () |
| Returns a pointer to this character's base position link. More... | |
| diguyGraphicsLink * | get_position_link () const |
| diguyGraphicsLink * | get_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... | |
| diguyGraphicsLink * | get_child_link_at_index (int index) |
| Returns a pointer to this link's child link at the specified index. More... | |
| 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_local_translation (float *x, float *y, float *z) |
| 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_unique_color (unsigned char *r, unsigned char *g, unsigned char *b) |
| Returns in the passed pointers the unique color of this link. 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 | fill_out_tbo_position_matrix (diguyGraphicsShape *current_shape, int lod, float *tbo_data) const |
| This function will be called by DI-Guy while building instance groups (which occurs during diguyScenario::draw() or when manually invoked. More... | |
| virtual void | fill_out_tbo_additional_data (diguyGraphicsShape *current_shape, float *tbo_data) |
| This function will be called by DI-Guy while building instance groups (which occurs during diguyScenario::draw() or when manually invoked. More... | |
| 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) |
| Gets the inverse of the rotation matrix as a 4x4 float array. More... | |
| int | get_inverse_rotation_matrix_4x4_ptr (float *matrix_array, int transpose=0, int include_translation=1) |
| Gets the inverse of the rotation matrix as a 16-float array pointer. More... | |
| int | get_approximate_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) |
| Gets an approximation of the bounding box of this bone based on it's position in the skeleton. More... | |
| int | get_is_base_link () |
| Deprecated as of 9.1.4; use diguyGraphicsLink::get_is_position_link() instead. More... | |
| int | get_scale (float *sz, float *sx, float *sy) |
| Deprecated as of 12.0.0 due to architecture change. 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... | |
| 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... | |
| void | set_selected (bool value) |
| bool | get_selected () |
| bdiLink * | get_scripted_object () |
Static Public Member Functions | |
| static osg::Group * | get_instancing_attach_node () |
| static void | set_diguy_attach_ptr (diguyScenario *scenario, osg::Group *diguy_attach_pt) |
| static osgViewer::Viewer * | get_viewer () |
| static void | set_viewer (osgViewer::Viewer *viewer) |
Protected Member Functions | |
| osg::Geode * | make_bounding_sphere_visual (osg::Vec3 ¢er, float radius) |
Protected Member Functions inherited from diguyGraphicsLink | |
| diguyGraphicsLink (void *internal_data) | |
| A protected constructor. More... | |
| virtual | ~diguyGraphicsLink () |
| A protected destructor. More... | |
Protected Attributes | |
| osg::ref_ptr< osg::Uniform > | m_ufrm_link_matrix |
| osg::ref_ptr< osg::MatrixTransform > | m_dof_node |
| osg::ref_ptr< osg::Uniform > | m_ufrm_inverse_transform_matrix |
| osg::ref_ptr< osg::Uniform > | m_ufrm_eye_point_os |
| osg::ref_ptr< osg::Uniform > | m_ufrm_light_dir_os |
| osg::ref_ptr< osg::Uniform > | m_ufrm_emission_color |
| osg::ref_ptr< osg::Geode > | m_bounding_sphere_visual |
| diguyOsgGraphicsShaderInstance * | m_diguy_osg_shader_instance |
| diguyOsgGraphicsShaderProgram * | m_diguy_osg_shader_program |
| int | m_instanced |
Static Protected Attributes | |
| static osg::Group * | s_diguy_attach_pt = NULL |
| static osg::Group * | s_diguy_instancing_attach_pt = NULL |
| static osgViewer::Viewer * | s_viewer = NULL |
Friends | |
| class | diguyOsgGraphicsShape |
| class | diguyOsgRootNode |
DI-Guy 'links' are essentially the same as 'bones' in other APIs.
There are two primary purposes of links:
The class diguyOsgGraphicsLink is an example of a diguyGraphicsLink subclass for a scene graph environment using the DI-Guy Loader. The example subclass shows how to use the accessors of the diguyGraphicsLink class and which virtual functions should be overridden for a scene graph environment such as OSG.
The top-level position link is given the world space transform; this becomes the origin of the character's local coordinate system. All child link transforms are in that coordinate system.
| diguyOsgGraphicsLink::diguyOsgGraphicsLink | ( | void * | internal_data | ) |
|
overridevirtual |
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:
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:
Reimplemented from diguyGraphicsLink.
|
overridevirtual |
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:
Reimplemented from diguyGraphicsLink.
|
overridevirtual |
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:
Reimplemented from diguyGraphicsLink.
|
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:
Reimplemented from diguyGraphicsLink.
|
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:
Reimplemented from diguyGraphicsLink.
|
overridevirtual |
Reimplemented from diguyGraphicsLink.
|
overridevirtual |
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:
Reimplemented from diguyGraphicsLink.
|
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:
Reimplemented from diguyGraphicsLink.
|
inline |
| osg::StateSet* diguyOsgGraphicsLink::get_top_level_state_set | ( | ) |
|
inlinestatic |
|
static |
|
inlinestatic |
|
inlinestatic |
|
inline |
static int s_transformation_mode;
|
protected |
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
protected |