DI-Guy SDK Documentation  13.2
diguyOsgGraphicsLink Class Reference

DI-Guy 'links' are essentially the same as 'bones' in other APIs. More...

#include <diguyOsgGraphicsLink.h>

Inheritance diagram for diguyOsgGraphicsLink:
diguyGraphicsLink

Public Member Functions

 diguyOsgGraphicsLink (void *internal_data)
 
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 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 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 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)
 
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...
 
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...
 

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 &center, float radius)
 

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::Uniform > m_ufrm_body_weight
 
osg::ref_ptr< osg::Geode > m_bounding_sphere_visual
 
diguyOsgGraphicsShaderInstancem_diguy_osg_shader_instance
 
diguyOsgGraphicsShaderProgramm_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
 

Detailed Description

DI-Guy 'links' are essentially the same as 'bones' in other APIs.

There are two primary purposes of links:

  • to form a skeleton that can be animated using motion data, and
  • to serve as attachment points for shapes.

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.

Constructor & Destructor Documentation

diguyOsgGraphicsLink::diguyOsgGraphicsLink ( void *  internal_data)

Member Function Documentation

void diguyOsgGraphicsLink::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 from diguyGraphicsLink.

void diguyOsgGraphicsLink::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 from diguyGraphicsLink.

void diguyOsgGraphicsLink::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 from diguyGraphicsLink.

void diguyOsgGraphicsLink::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 from diguyGraphicsLink.

void diguyOsgGraphicsLink::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 from diguyGraphicsLink.

void diguyOsgGraphicsLink::instancing_state_changed ( int  is_instanced)
virtual

Reimplemented from diguyGraphicsLink.

void diguyOsgGraphicsLink::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 from diguyGraphicsLink.

void diguyOsgGraphicsLink::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 from diguyGraphicsLink.

osg::MatrixTransform* diguyOsgGraphicsLink::get_dof_node ( )
inline
osg::StateSet* diguyOsgGraphicsLink::get_top_level_state_set ( )
static osg::Group* diguyOsgGraphicsLink::get_instancing_attach_node ( )
inlinestatic
void diguyOsgGraphicsLink::set_diguy_attach_ptr ( diguyScenario scenario,
osg::Group *  diguy_attach_pt 
)
static
static osgViewer::Viewer* diguyOsgGraphicsLink::get_viewer ( )
inlinestatic
static void diguyOsgGraphicsLink::set_viewer ( osgViewer::Viewer *  viewer)
inlinestatic
osg::Geode* diguyOsgGraphicsLink::get_bounding_sphere_visual ( )
inline

static int s_transformation_mode;

osg::Geode * diguyOsgGraphicsLink::make_bounding_sphere_visual ( osg::Vec3 &  center,
float  radius 
)
protected

Friends And Related Function Documentation

friend class diguyOsgGraphicsShape
friend
friend class diguyOsgRootNode
friend

Member Data Documentation

osg::ref_ptr<osg::Uniform> diguyOsgGraphicsLink::m_ufrm_link_matrix
protected
osg::ref_ptr<osg::MatrixTransform> diguyOsgGraphicsLink::m_dof_node
protected
osg::ref_ptr<osg::Uniform> diguyOsgGraphicsLink::m_ufrm_inverse_transform_matrix
protected
osg::ref_ptr<osg::Uniform> diguyOsgGraphicsLink::m_ufrm_eye_point_os
protected
osg::ref_ptr<osg::Uniform> diguyOsgGraphicsLink::m_ufrm_light_dir_os
protected
osg::ref_ptr<osg::Uniform> diguyOsgGraphicsLink::m_ufrm_emission_color
protected
osg::ref_ptr<osg::Uniform> diguyOsgGraphicsLink::m_ufrm_body_weight
protected
osg::ref_ptr<osg::Geode> diguyOsgGraphicsLink::m_bounding_sphere_visual
protected
diguyOsgGraphicsShaderInstance* diguyOsgGraphicsLink::m_diguy_osg_shader_instance
protected
diguyOsgGraphicsShaderProgram* diguyOsgGraphicsLink::m_diguy_osg_shader_program
protected
osg::Group * diguyOsgGraphicsLink::s_diguy_attach_pt = NULL
staticprotected
osg::Group * diguyOsgGraphicsLink::s_diguy_instancing_attach_pt = NULL
staticprotected
osgViewer::Viewer * diguyOsgGraphicsLink::s_viewer = NULL
staticprotected
int diguyOsgGraphicsLink::m_instanced
protected

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