DI-Guy SDK Documentation  13.5
diguyGraphicsShaderTechnique Class Reference

This class implements shader lod system for use with DI-Guy character graphics. More...

#include <diguyGraphicsShaderTechnique.h>

Inheritance diagram for diguyGraphicsShaderTechnique:
diguyOglGraphicsShaderTechnique

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.

All functions are Callable From:

  • C++
  • Script
const char * get_name ()
 Returns: the name of the shader technique. More...
 
int get_num_shader_lod_programs (bool instanced=false)
 Returns the number of lod shaders the technique has. More...
 
diguyGraphicsShaderProgramget_shader_lod_program_at_index (int index, bool instanced=false)
 Returns the shader program at a lod index. More...
 
float get_shader_lod_range_at_index (int index)
 Returns the distance that a shader lod switches out at. More...
 
diguyGraphicsShaderProgramget_shader_by_distance (float distance, int max_quality_level, bool instanced=false)
 Returns a shader based on the rendering distance. More...
 
int get_program_index_by_distance (float distance, int max_quality_level)
 Returns the shader index based on the rendering distance. More...
 
diguyGraphicsShaderProgramget_intersection_shader ()
 Returns the shader specified for intersections. More...
 
diguyGraphicsShaderProgramget_shadow_pass_shader ()
 Returns the shader specified for shadow map generation. More...
 
diguyGraphicsShaderProgramget_instanced_shadow_pass_shader ()
 Returns the shader specified for shadow map generation for instanced objects. More...
 
Shader Creation Functions
diguyGraphicsShaderProgramfind_or_create_shader_variation (diguyGraphicsShaderProgram *program, const char *new_name)
 This function allows you create a new shader that uses the same vertex and pixel files as the one passed in. More...
 
void add_additional_shader (diguyGraphicsShaderProgram *program)
 Adds an additional shader program to the technique these will get automatically updated if any of the shader uniform functions are used. More...
 
int get_num_additional_shaders ()
 Returns: The number of shaders that have been procedurally added to the technique. More...
 
diguyGraphicsShaderProgramget_additional_shader_at_index (int index)
 Returns: A pointer to the procedural shaders that has been procedurally added to the technique. More...
 
Shader Uniform Functions
int set_variable_float (const char *name, float value, int set_current=1, int set_initial=0)
 Convenience functions. More...
 
int set_variable_vec2 (const char *name, float x, float y, int set_current=1, int set_initial=0)
 
int set_variable_vec3 (const char *name, float x, float y, float z, int set_current=1, int set_initial=0)
 
int set_variable_vec4 (const char *name, float x, float y, float z, float w, int set_current=1, int set_initial=0)
 
int set_variable_int (const char *name, int value, int set_current=1, int set_initial=0)
 
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 diguyGraphicsShaderProgrampick_shader_program (const diguyShaderPickDescription &desc)
 Allows users to use a subclass to override the default shader LOD system see diguyOglGraphicsShaderTechnique::pick_shader_program() for an example of it's usage. More...
 
virtual void build ()
 Allows users to do their own post shader load behavior. More...
 

Private Functions

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

No external access to them is expected or necessary.

bdiShaderTechniquem_internal_data
 A pointer to internal data. More...
 
class bdiShaderTechnique
 
class bdiGeometryFactory
 
bdiShaderTechniqueget_internal_data ()
 
 diguyGraphicsShaderTechnique (void *internal_data)
 A protected constructor. More...
 
virtual ~diguyGraphicsShaderTechnique ()
 A protected destructor. More...
 

Detailed Description

This class implements shader lod system for use with DI-Guy character graphics.

Represents the globally shared description of all the shaders need to fully render a object. Can be subclassed by filling out the diguy_graphics_set_shader_technique_create_func().

Shader Techniques are shared among all characters that use the shader Technique. Any variables used in a shader Technique should therefore apply to all characters using the shader.

Also see diguyGraphicsShaderInstance.

Constructor & Destructor Documentation

diguyGraphicsShaderTechnique::diguyGraphicsShaderTechnique ( void *  internal_data)
protected

A protected constructor.

Constructors are called automatically by DI-Guy.

virtual diguyGraphicsShaderTechnique::~diguyGraphicsShaderTechnique ( )
protectedvirtual

A protected destructor.

Destructors are called automatically by DI-Guy.

Member Function Documentation

const char* diguyGraphicsShaderTechnique::get_name ( )

Returns: the name of the shader technique.

This pointer will never be NULL.

int diguyGraphicsShaderTechnique::get_num_shader_lod_programs ( bool  instanced = false)

Returns the number of lod shaders the technique has.

diguyGraphicsShaderProgram* diguyGraphicsShaderTechnique::get_shader_lod_program_at_index ( int  index,
bool  instanced = false 
)

Returns the shader program at a lod index.

float diguyGraphicsShaderTechnique::get_shader_lod_range_at_index ( int  index)

Returns the distance that a shader lod switches out at.

diguyGraphicsShaderProgram* diguyGraphicsShaderTechnique::get_shader_by_distance ( float  distance,
int  max_quality_level,
bool  instanced = false 
)

Returns a shader based on the rendering distance.

int diguyGraphicsShaderTechnique::get_program_index_by_distance ( float  distance,
int  max_quality_level 
)

Returns the shader index based on the rendering distance.

diguyGraphicsShaderProgram* diguyGraphicsShaderTechnique::get_intersection_shader ( )

Returns the shader specified for intersections.

diguyGraphicsShaderProgram* diguyGraphicsShaderTechnique::get_shadow_pass_shader ( )

Returns the shader specified for shadow map generation.

diguyGraphicsShaderProgram* diguyGraphicsShaderTechnique::get_instanced_shadow_pass_shader ( )

Returns the shader specified for shadow map generation for instanced objects.

diguyGraphicsShaderProgram* diguyGraphicsShaderTechnique::find_or_create_shader_variation ( diguyGraphicsShaderProgram program,
const char *  new_name 
)

This function allows you create a new shader that uses the same vertex and pixel files as the one passed in.

The user is then able modify the subclassed shader before calling load(). This function should allow end users to create an arbitrary number of shader permutations and then return them via overriding pick_shader_program(). See diguyOglGraphicsShaderTechnique::build() for an example of it's usage. Override pick_shader_program() to return a procedurally created shader.

void diguyGraphicsShaderTechnique::add_additional_shader ( diguyGraphicsShaderProgram program)

Adds an additional shader program to the technique these will get automatically updated if any of the shader uniform functions are used.

These are mostly for convenience. Users will probably want their own data structures to store shader lookup tables.

int diguyGraphicsShaderTechnique::get_num_additional_shaders ( )

Returns: The number of shaders that have been procedurally added to the technique.

diguyGraphicsShaderProgram* diguyGraphicsShaderTechnique::get_additional_shader_at_index ( int  index)

Returns: A pointer to the procedural shaders that has been procedurally added to the technique.

int diguyGraphicsShaderTechnique::set_variable_float ( const char *  name,
float  value,
int  set_current = 1,
int  set_initial = 0 
)

Convenience functions.

Loops through all shaders in this technique and sets uniform variables if they exist.

Callable From:

  • C++
  • Script
int diguyGraphicsShaderTechnique::set_variable_vec2 ( const char *  name,
float  x,
float  y,
int  set_current = 1,
int  set_initial = 0 
)
int diguyGraphicsShaderTechnique::set_variable_vec3 ( const char *  name,
float  x,
float  y,
float  z,
int  set_current = 1,
int  set_initial = 0 
)
int diguyGraphicsShaderTechnique::set_variable_vec4 ( const char *  name,
float  x,
float  y,
float  z,
float  w,
int  set_current = 1,
int  set_initial = 0 
)
int diguyGraphicsShaderTechnique::set_variable_int ( const char *  name,
int  value,
int  set_current = 1,
int  set_initial = 0 
)
virtual diguyGraphicsShaderProgram* diguyGraphicsShaderTechnique::pick_shader_program ( const diguyShaderPickDescription desc)
virtual

Allows users to use a subclass to override the default shader LOD system see diguyOglGraphicsShaderTechnique::pick_shader_program() for an example of it's usage.

Reimplemented in diguyOglGraphicsShaderTechnique.

virtual void diguyGraphicsShaderTechnique::build ( )
virtual

Allows users to do their own post shader load behavior.

Reimplemented in diguyOglGraphicsShaderTechnique.

bdiShaderTechnique* diguyGraphicsShaderTechnique::get_internal_data ( )
inline

Friends And Related Function Documentation

friend class bdiShaderTechnique
friend
friend class bdiGeometryFactory
friend

Member Data Documentation

bdiShaderTechnique* diguyGraphicsShaderTechnique::m_internal_data
private

A pointer to internal data.


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