DI-Guy SDK Documentation  13.7.1
diguyOglGraphicsShaderInstance Class Reference

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

#include <diguyOglGraphicsShaderInstance.h>

Inheritance diagram for diguyOglGraphicsShaderInstance:
diguyGraphicsShaderInstance

Public Member Functions

 diguyOglGraphicsShaderInstance (void *internal_data)
 
virtual int bind () override
 This function will be called by DI-Guy when it is time for the object that this shader instance is attached to to be rendered. More...
 
virtual int unbind () override
 This function will be called by DI-Guy when the object this shader is attached to is done being rendered. More...
 
- Public Member Functions inherited from diguyGraphicsShaderInstance
diguyGraphicsShaderTechniqueget_shader_technique ()
 This function returns the shader technique this shader instance is associated with. More...
 
diguyCharacterget_character ()
 This function returns a pointer to the character that this shader instance is associated with. More...
 
int get_num_variables ()
 
const char * get_variable_name_at_index (int index)
 
int has_variable (const char *name)
 
const char * get_variable_type (const char *name)
 
void reset_variables_to_initial_values ()
 
void reset_variables_to_program_defaults ()
 
int set_variable_float (const char *name, float value, int set_current=1, int set_initial=0, float blend_time=0.0f)
 
int set_variable_vec2 (const char *name, float x, float y, int set_current=1, int set_initial=0, float blend_time=0.0f)
 
int set_variable_vec3 (const char *name, float x, float y, float z, int set_current=1, int set_initial=0, float blend_time=0.0f)
 
int set_variable_vec4 (const char *name, float x, float y, float z, float w, int set_current=1, int set_initial=0, float blend_time=0.0f)
 
int set_variable_int (const char *name, int value, int set_current=1, int set_initial=0)
 
int get_variable_float (const char *name, float *value, int get_current=1)
 
int get_variable_vec2 (const char *name, float *x, float *y, int get_current=1)
 
int get_variable_vec3 (const char *name, float *x, float *y, float *z, int get_current=1)
 
int get_variable_vec4 (const char *name, float *r, float *g, float *b, float *a, int get_current=1)
 
int get_variable_int (const char *name, int *value, int get_current=1)
 
diguyGraphicsShaderProgramget_shader_program ()
  Deprecated Functions: changed due to API restructuring More...
 
bdiShaderProgramInstanceget_internal_data ()
 

Public Attributes

diguyOglGraphicsShaderTechniquem_shader_technique
 

Additional Inherited Members

- Protected Member Functions inherited from diguyGraphicsShaderInstance
 diguyGraphicsShaderInstance (void *internal_data)
 A protected constructor. More...
 
virtual ~diguyGraphicsShaderInstance ()
 A protected destructor. More...
 

Detailed Description

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

It subclasses diguyGraphicsShaderInstance. Unlike /shader programs/, which are shared by many characters, shader instances allow non-shared, character-specific shader state to be maintained. An example is having different uniform variable values for different characters, such as a highlight color that is applied during shading.

See /diguyOglGraphicsShaderProgram/ for information on shader programs.

The class diguyOglGraphicsShaderInstance is an example of a diguyGraphicsShaderInstance subclass for an immediate mode renderer using the DI-Guy Loader. The example subclass shows how to use the accessors of the diguyGraphicsShaderInstance 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

diguyOglGraphicsShaderInstance::diguyOglGraphicsShaderInstance ( void *  internal_data)

Member Function Documentation

int diguyOglGraphicsShaderInstance::bind ( )
overridevirtual

This function will be called by DI-Guy when it is time for the object that this shader instance is attached to to be rendered.

This happens during the Draw Stage, just before the geometry of a character or scene object is to be rendered.

Any instance level shader control variables should be set in this function. Instance level variables will affect only shader operations in which this instance is active. Variables that should affect the overall program of a shader should be set in diguyGraphicsShaderProgram::bind().

Immediate Mode:

Immediate mode renderers usually do override this function.

Scene Graph:

Scene graph renderers usually do not override this function; the renderer will typically do this internally. If shader variables need to be bound, however, this function should be overridden.

Callable From:

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

Reimplemented from diguyGraphicsShaderInstance.

int diguyOglGraphicsShaderInstance::unbind ( )
overridevirtual

This function will be called by DI-Guy when the object this shader is attached to is done being rendered.

This happens during the Draw Stage, just after the geometry of a character has been rendered.

Any shader variables bound in bind() should be unbound here.

Immediate Mode:

Immediate mode renderers usually do override this function.

Scene Graph:

Scene graph renderers usually do not override this function; the renderer will typically do this internally. If the bind() function was overridden, however, this function probably should be, too.

Callable From:

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

Reimplemented from diguyGraphicsShaderInstance.

Member Data Documentation

diguyOglGraphicsShaderTechnique* diguyOglGraphicsShaderInstance::m_shader_technique

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