Project

General

Profile

SO3Engine
SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE > Class Template Referenceabstract

#include <SO3MaterialGenerator.h>

Public Types

typedef PERMUTATION_TYPE Perm
 Bitfield used to signify a material permutations.
 

Public Member Functions

virtual ~SMaterialGenerator ()
 
const Ogre::MaterialPtr & GetMaterial (SGBuffer *gbuffer, PERMUTATION_CLASS permutation)
 
unsigned int GetDeferredMaterialNumber (SGBuffer *gbuffer)
 
unsigned int GetDeferredMaterialTemplateNumber (SGBuffer *gbuffer)
 
unsigned int GetDeferredVertexShaderNumber (SGBuffer *gbuffer)
 
unsigned int GetDeferredPixelShaderNumber (SGBuffer *gbuffer)
 
void ResetResources (SGBuffer *gbuffer)
 

Protected Member Functions

 SMaterialGenerator (const Ogre::String &typeName)
 
const Ogre::GpuProgramPtr & GetVertexShader (SGBuffer *gbuffer, PERMUTATION_TYPE permutationValue)
 
const Ogre::GpuProgramPtr & GetFragmentShader (SGBuffer *gbuffer, PERMUTATION_TYPE permutationValue)
 
const Ogre::MaterialPtr & GetTemplateMaterial (SGBuffer *gbuffer, PERMUTATION_TYPE permutationValue)
 
virtual Ogre::GpuProgramPtr GenerateVertexShader (SGBuffer *gbuffer, PERMUTATION_TYPE permutationValue)=0
 
virtual Ogre::GpuProgramPtr GenerateFragmentShader (SGBuffer *gbuffer, PERMUTATION_TYPE permutationValue)=0
 
virtual Ogre::MaterialPtr GenerateTemplateMaterial (SGBuffer *gbuffer, PERMUTATION_TYPE permutationValue)=0
 

Protected Attributes

const Ogre::String materialBaseName
 Base name of materials generated by this.
 

Detailed Description

template<class PERMUTATION_CLASS, typename PERMUTATION_TYPE>
class SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >

Caching, on-the-fly material generator. This is a class that automatically generates and stores different permutations of a material, and its shaders. It can be used if you have a material that has lots of slightly different variations, like whether to use a specular light, skinning, normal mapping and other options. Writing all these out is a tedious job. Of course it is possible to always use the material with all features, but that might result in large, slow shader programs. This class provides an efficient solution to that.

Definition at line 45 of file SO3MaterialGenerator.h.

Member Typedef Documentation

◆ Perm

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
typedef PERMUTATION_TYPE SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::Perm

Bitfield used to signify a material permutations.

Definition at line 48 of file SO3MaterialGenerator.h.

Constructor & Destructor Documentation

◆ ~SMaterialGenerator()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::~SMaterialGenerator ( )
virtual

Definition at line 143 of file SO3MaterialGenerator.h.

◆ SMaterialGenerator()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::SMaterialGenerator ( const Ogre::String &  typeName)
protected

The constructor is protected as this base class should never be constructed as-is. It is meant to be subclassed so that values can be assigned to the various fields controlling material generator.

Definition at line 134 of file SO3MaterialGenerator.h.

Member Function Documentation

◆ GenerateFragmentShader()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
virtual Ogre::GpuProgramPtr SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GenerateFragmentShader ( SGBuffer gbuffer,
PERMUTATION_TYPE  permutationValue 
)
protectedpure virtual

◆ GenerateTemplateMaterial()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
virtual Ogre::MaterialPtr SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GenerateTemplateMaterial ( SGBuffer gbuffer,
PERMUTATION_TYPE  permutationValue 
)
protectedpure virtual

◆ GenerateVertexShader()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
virtual Ogre::GpuProgramPtr SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GenerateVertexShader ( SGBuffer gbuffer,
PERMUTATION_TYPE  permutationValue 
)
protectedpure virtual

◆ GetDeferredMaterialNumber()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
unsigned int SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GetDeferredMaterialNumber ( SGBuffer gbuffer)

Definition at line 164 of file SO3MaterialGenerator.h.

◆ GetDeferredMaterialTemplateNumber()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
unsigned int SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GetDeferredMaterialTemplateNumber ( SGBuffer gbuffer)

Definition at line 173 of file SO3MaterialGenerator.h.

◆ GetDeferredPixelShaderNumber()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
unsigned int SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GetDeferredPixelShaderNumber ( SGBuffer gbuffer)

Function to get statistic on how many fragment shader resources where created by this deferred material generator.

Definition at line 191 of file SO3MaterialGenerator.h.

◆ GetDeferredVertexShaderNumber()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
unsigned int SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GetDeferredVertexShaderNumber ( SGBuffer gbuffer)

Function to get statistic on how many vertex shader resources where created by this deferred material generator.

Definition at line 182 of file SO3MaterialGenerator.h.

◆ GetFragmentShader()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
const Ogre::GpuProgramPtr & SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GetFragmentShader ( SGBuffer gbuffer,
PERMUTATION_TYPE  permutationValue 
)
protected

Definition at line 354 of file SO3MaterialGenerator.h.

◆ GetMaterial()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
const Ogre::MaterialPtr & SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GetMaterial ( SGBuffer gbuffer,
PERMUTATION_CLASS  permutation 
)

Get or create a material corresponding to the given permutation flags.

Definition at line 275 of file SO3MaterialGenerator.h.

◆ GetTemplateMaterial()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
const Ogre::MaterialPtr & SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GetTemplateMaterial ( SGBuffer gbuffer,
PERMUTATION_TYPE  permutationValue 
)
protected

Definition at line 385 of file SO3MaterialGenerator.h.

◆ GetVertexShader()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
const Ogre::GpuProgramPtr & SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::GetVertexShader ( SGBuffer gbuffer,
PERMUTATION_TYPE  permutationValue 
)
protected

Definition at line 323 of file SO3MaterialGenerator.h.

◆ ResetResources()

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
void SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::ResetResources ( SGBuffer gbuffer)

Removes all the resources generated by this deferred material generator.

Remarks
: use with caution!

Definition at line 200 of file SO3MaterialGenerator.h.

Member Data Documentation

◆ materialBaseName

template<class PERMUTATION_CLASS , typename PERMUTATION_TYPE >
const Ogre::String SO3::SMaterialGenerator< PERMUTATION_CLASS, PERMUTATION_TYPE >::materialBaseName
protected

Base name of materials generated by this.

Definition at line 50 of file SO3MaterialGenerator.h.


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