DI-Guy SDK Documentation  13.8
diguyOglGraphicsMesh Class Reference

This class is part of the DI-Guy Graphics API. More...

#include <diguyOglGraphicsMesh.h>

Inheritance diagram for diguyOglGraphicsMesh:
diguyGraphicsMesh diguyGraphicsMesh

Public Member Functions

 diguyOglGraphicsMesh (void *internal_data)
 
virtual void build () override
 This function will be called by DI-Guy when it is time for a renderer-specific mesh object to be created. More...
 
virtual void unbuild () override
 This function will be called by DI-Guy when it is time for a renderer-specific mesh object to be destroyed. More...
 
virtual void draw (diguyDrawCallData *draw_data) override
 This function will be called by DI-Guy when the mesh should be drawn. More...
 
 diguyOglGraphicsMesh (void *internal_data)
 
virtual void build ()
 This function will be called by DI-Guy when it is time for a renderer-specific mesh object to be created. More...
 
virtual void unbuild ()
 This function will be called by DI-Guy when it is time for a renderer-specific mesh object to be destroyed. More...
 
virtual void draw (diguyDrawCallData *draw_data)
 This function will be called by DI-Guy when the mesh should be drawn. More...
 
- Public Member Functions inherited from diguyGraphicsMesh
int get_num_switched_graphics_states () const
 This function returns the number of switched graphics states this mesh has. More...
 
int get_is_skinned_mesh ()
 This function returns whether or not the mesh is "skinned". More...
 
int get_is_blend_shape ()
 This function returns whether or not the mesh is actually a morph object. More...
 
void free_loader_memory ()
 This function frees most memory allocated by the DI-Guy geometry loader for this object. More...
 
const char * get_name ()
 Returns the name of the mesh. More...
 
long get_uid ()
 All meshes are assigned a unique identifier (uid) This function returns the uid of the mesh. More...
 
diguyGraphicsStateget_state (int graphics_state_switch_index=0)
 This function returns the graphics state with which faces in this mesh should be drawn. More...
 
const diguyGraphicsStateget_state (int graphics_state_switch_index=0) const
 
diguyGraphicsShaderProgramget_shader_program ()
 This function returns a pointer to the shader program designated for this mesh, if any. More...
 
diguyGraphicsShaderInstanceget_shader_instance ()
 If this mesh has a shader program specified (see get_shader_program()), this function returns a pointer to the shader instance object specific to this mesh. More...
 
diguyGraphicsVertexFormat get_vertex_format ()
 Returns: vertex format that describes the format of the data returned by the get_vertex_buffer_data() function. More...
 
int get_vertex_count ()
 Returns: how many vertices this mesh has. More...
 
int get_vertex_buffer_size ()
 Returns: size, in bytes, of the data buffer returned by get_vertex_buffer_data() More...
 
diguyGraphicsMeshget_blend_shape (int index)
 Returns: Pointer to a blend shape mesh that represents the offsets from this mesh, currently we only have 1 of these which we use to adjust the weight of the character. More...
 
int get_num_blend_shapes ()
 Returns: Number of blend shapes associated with this mesh, currently max of 1. More...
 
float * get_data_as_blend_shape_verts ()
 this is necessary for the new SSBO based implementation of blend shapes that has a specific layout More...
 
int get_blend_shape_vertex_buffer_size ()
 this is necessary for the new SSBO based implementation of blend shapes that has a specific layout More...
 
void * get_vertex_buffer_data ()
 This function returns a pointer to the raw vertex buffer data of this mesh. More...
 
float * get_first_vertex ()
 This function returns a pointer to vertex position data of the first vertex in the raw vertex buffer data returned by get_vertex_buffer_data(). More...
 
int get_vertex_offset ()
 This function returns how many bytes the first vertex position is into the raw vertex buffer data returned by get_vertex_buffer_data(). More...
 
int get_vertex_stride ()
 This function returns how many bytes there are between each vertex position in the raw data returned by get_vertex_buffer_data(). More...
 
float * get_first_normal ()
 Returns: pointer to normal of first vertex in vertex buffer data; see get_first_vertex() for more information. More...
 
int get_normal_offset ()
 Returns: offset in bytes of the first normal in raw vertex buffer data; see get_vertex_offset() for more information. More...
 
float * get_first_texture_indices ()
 Returns: pointer to texture indices of first vertex in vertex buffer data. More...
 
int get_texture_indices_offset ()
 Returns: offset in bytes of the first texture indices in raw vertex buffer data; see get_vertex_offset() for more information. More...
 
float * get_first_link_index ()
 Returns: pointer to link index of first vertex in vertex buffer data, in float form. More...
 
int get_link_index_offset ()
 Returns: offset in bytes of the first link index in raw vertex buffer data; see get_vertex_offset() for more information. More...
 
float * get_first_link_weight ()
 Returns: pointer to link weight of first vertex in vertex buffer data. More...
 
int get_link_weight_offset ()
 Returns: offset in bytes of the first link weight offset in raw vertex buffer data; see get_vertex_offset() for more information. More...
 
float * get_first_tangent ()
 Returns a pointer to the UV tangent and flip bit of first vertex in the vertex buffer data. More...
 
int get_tangent_offset ()
 Returns: offset in bytes of the first tangent in raw vertex buffer data; see get_vertex_offset() for more information. More...
 
diguyGraphicsIndexType get_index_type ()
 Returns: index type used in data returned by the get_index_buffer_data() function. More...
 
int get_index_count ()
 This function returns how many indices there are in this mesh. More...
 
int get_index_buffer_size ()
 Returns: size, in bytes, of the data buffer returned by get_index_buffer_data() More...
 
void * get_index_buffer_data ()
 This function returns a pointer to the raw index buffer data of this mesh. 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)
 
int get_normal_stride ()
 deprecated as of 13.2.0 since we've always laid out data with vnt/vnt/vnt type layouts, strides are always the same. More...
 
int get_texture_indices_stride ()
 
int get_tangent_stride ()
 
int get_link_weight_stride ()
 
int get_link_index_stride ()
 
int get_is_deformable ()
 This function returns whether or not the mesh is deformable. More...
 
bdiGeometryMeshget_internal_data ()
 

Static Public Attributes

static int s_nverts
 
static int s_ntris
 
static int s_nvbos
 
static int s_ntris_drawn
 
static int s_nverts_drawn
 
static int s_nvbos_drawn
 
static int s_skinned_vbos_drawn
 
static int s_rigid_vbos_drawn
 

Protected Member Functions

void download_to_gpu ()
 helper function for sending data during draw More...
 
virtual void draw_fixed_function_mesh ()
 
- Protected Member Functions inherited from diguyGraphicsMesh
 diguyGraphicsMesh (void *internal_data)
 A protected constructor. More...
 
virtual ~diguyGraphicsMesh ()
 A protected destructor. More...
 

Protected Attributes

int m_is_skinned_mesh
 Variables for data generated during the Build Stage. More...
 
int m_has_tangents
 
GLuint m_vertex_buffer
 
GLuint m_index_buffer
 
GLuint m_vertex_array_object
 
GLuint m_blend_shape_ssbo_object
 
GLenum m_gl_index_type
 

Detailed Description

This class is part of the DI-Guy Graphics API.

It subclasses a diguyGraphicsMesh. Meshes contain the visual geometry of a DI-Guy character. They are attached to shapes, and are associated with materials and textures.

The class diguyOglGraphicsMesh is an example of a diguyGraphicsMesh subclass for an immediate mode renderer using the DI-Guy Loader. The example subclass shows how to use the accessors of the diguyGraphicsMesh class and which virtual functions should be overridden for an immediate mode renderer such as OpenGL. Additional documentation is in the implementation file documentation here.

Constructor & Destructor Documentation

diguyOglGraphicsMesh::diguyOglGraphicsMesh ( void *  internal_data)
diguyOglGraphicsMesh::diguyOglGraphicsMesh ( void *  internal_data)

Member Function Documentation

virtual void diguyOglGraphicsMesh::build ( )
overridevirtual

This function will be called by DI-Guy when it is time for a renderer-specific mesh object to be created.

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

Immediate Mode:

Immediate mode renderers may override this function, to create an object that may be invoked by draw().

Scene Graph:

Scene graph renderers usually do override this function, to create a geometry object that gets associated with a diguyGraphicsState object obtained by calling get_state().

Callable From:

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

Reimplemented from diguyGraphicsMesh.

virtual void diguyOglGraphicsMesh::unbuild ( )
overridevirtual

This function will be called by DI-Guy when it is time for a renderer-specific mesh object to be destroyed.

Immediate Mode:

Immediate mode renderers may override this function, to destroy any object that may have been created by build().

Scene Graph:

Scene graph renderers usually do override this function, to destroy any object that may have been created by build().

Callable From:

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

Reimplemented from diguyGraphicsMesh.

virtual void diguyOglGraphicsMesh::draw ( diguyDrawCallData draw_data)
overridevirtual

This function will be called by DI-Guy when the mesh should be drawn.

For scene graph renderers, most likely nothing more needs to be done by this function.

Callable From:

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

Reimplemented from diguyGraphicsMesh.

void diguyOglGraphicsMesh::download_to_gpu ( )
protected

helper function for sending data during draw

virtual void diguyOglGraphicsMesh::draw_fixed_function_mesh ( )
protectedvirtual
virtual void diguyOglGraphicsMesh::build ( )
virtual

This function will be called by DI-Guy when it is time for a renderer-specific mesh object to be created.

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

Immediate Mode:

Immediate mode renderers may override this function, to create an object that may be invoked by draw().

Scene Graph:

Scene graph renderers usually do override this function, to create a geometry object that gets associated with a diguyGraphicsState object obtained by calling get_state().

Callable From:

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

Reimplemented from diguyGraphicsMesh.

virtual void diguyOglGraphicsMesh::unbuild ( )
virtual

This function will be called by DI-Guy when it is time for a renderer-specific mesh object to be destroyed.

Immediate Mode:

Immediate mode renderers may override this function, to destroy any object that may have been created by build().

Scene Graph:

Scene graph renderers usually do override this function, to destroy any object that may have been created by build().

Callable From:

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

Reimplemented from diguyGraphicsMesh.

virtual void diguyOglGraphicsMesh::draw ( diguyDrawCallData draw_data)
virtual

This function will be called by DI-Guy when the mesh should be drawn.

For scene graph renderers, most likely nothing more needs to be done by this function.

Callable From:

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

Reimplemented from diguyGraphicsMesh.

Member Data Documentation

int diguyOglGraphicsMesh::s_nverts
static
int diguyOglGraphicsMesh::s_ntris
static
int diguyOglGraphicsMesh::s_nvbos
static
int diguyOglGraphicsMesh::s_ntris_drawn
static
int diguyOglGraphicsMesh::s_nverts_drawn
static
int diguyOglGraphicsMesh::s_nvbos_drawn
static
int diguyOglGraphicsMesh::s_skinned_vbos_drawn
static
int diguyOglGraphicsMesh::s_rigid_vbos_drawn
static
int diguyOglGraphicsMesh::m_is_skinned_mesh
protected

Variables for data generated during the Build Stage.

int diguyOglGraphicsMesh::m_has_tangents
protected
GLuint diguyOglGraphicsMesh::m_vertex_buffer
protected
GLuint diguyOglGraphicsMesh::m_index_buffer
protected
GLuint diguyOglGraphicsMesh::m_vertex_array_object
protected
GLuint diguyOglGraphicsMesh::m_blend_shape_ssbo_object
protected
GLenum diguyOglGraphicsMesh::m_gl_index_type
protected

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