Shader generator system main interface. More...
#include <OgreShaderGenerator.h>
Classes | |
class | SGMaterial |
Shader generator material wrapper class. More... | |
class | SGPass |
Shader generator pass wrapper class. More... | |
class | SGRenderObjectListener |
Shader generator RenderObjectListener sub class. More... | |
class | SGSceneManagerListener |
Shader generator scene manager sub class. More... | |
class | SGScheme |
Shader generator scheme class. More... | |
class | SGScriptTranslatorManager |
Shader generator ScriptTranslatorManager sub class. More... | |
class | SGTechnique |
Shader generator technique wrapper class. More... | |
Public Member Functions | |
void | addSceneManager (SceneManager *sceneMgr) |
Add a scene manager to the shader generator scene managers list. More... | |
void | addSubRenderStateFactory (SubRenderStateFactory *factory) |
Add sub render state factory. More... | |
void | createScheme (const String &schemeName) |
Create a scheme. More... | |
bool | createShaderBasedTechnique (const String &materialName, const String &srcTechniqueSchemeName, const String &dstTechniqueSchemeName) |
Create shader based technique from a given technique. More... | |
SubRenderState * | createSubRenderState (const String &type) |
Create an instance of sub render state from a given type. More... | |
void | destroySubRenderState (SubRenderState *subRenderState) |
Destroy an instance of sub render state. More... | |
void | flushShaderCache () |
Flush the shader cache. More... | |
SceneManager * | getActiveSceneManager () |
Get the active scene manager that is doint the actual scene rendering. More... | |
size_t | getFragmentShaderCount () const |
Return the current number of generated fragment shaders. More... | |
const String & | getFragmentShaderProfiles () const |
Get the output fragment shader target profiles. More... | |
const StringVector & | getFragmentShaderProfilesList () const |
Get the output fragment shader target profiles as list of strings. More... | |
SGMaterialSerializerListener * | getMaterialSerializerListener () |
Return custom material Serializer of the shader generator. More... | |
RenderState * | getRenderState (const String &schemeName) |
Return a global render state associated with the given scheme name. More... | |
RenderState * | getRenderState (const String &schemeName, const String &materialName, unsigned short passIndex) |
Get render state of specific pass. More... | |
const String & | getShaderCachePath () const |
Get the output shader cache path. More... | |
const String & | getTargetLanguage () const |
Return the target shader language currently in use. More... | |
size_t | getVertexShaderCount () const |
Return the current number of generated vertex shaders. More... | |
VSOutputCompactPolicy | getVertexShaderOutputsCompactPolicy () const |
Get the vertex shader outputs compaction policy. More... | |
const String & | getVertexShaderProfiles () const |
Get the output vertex shader target profiles. More... | |
const StringVector & | getVertexShaderProfilesList () const |
Get the output vertex shader target profiles as list of strings. More... | |
void | invalidateMaterial (const String &schemeName, const String &materialName) |
Invalidate specific material scheme. More... | |
void | invalidateScheme (const String &schemeName) |
Invalidate a given scheme. More... | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info More... | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *ptr) |
placement operator new More... | |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info More... | |
void * | operator new[] (size_t sz) |
bool | removeAllShaderBasedTechniques (const String &materialName) |
Remove all shader based techniques of the given material. More... | |
void | removeAllShaderBasedTechniques () |
Remove all shader based techniques that created by this shader generator. More... | |
void | removeSceneManager (SceneManager *sceneMgr) |
Remove a scene manager from the shader generator scene managers list. More... | |
bool | removeShaderBasedTechnique (const String &materialName, const String &srcTechniqueSchemeName, const String &dstTechniqueSchemeName) |
Remove shader based technique from a given technique. More... | |
void | removeSubRenderStateFactory (SubRenderStateFactory *factory) |
Remove sub render state factory. More... | |
void | setFragmentShaderProfiles (const String &fragmentShaderProfiles) |
Set the output fragment shader target profiles. More... | |
void | setShaderCachePath (const String &cachePath) |
Set the output shader cache path. More... | |
void | setTargetLanguage (const String &shaderLanguage) |
Set the target shader language. More... | |
void | setVertexShaderOutputsCompactPolicy (VSOutputCompactPolicy policy) |
Set the vertex shader outputs compaction policy. More... | |
void | setVertexShaderProfiles (const String &vertexShaderProfiles) |
Set the output vertex shader target profiles. More... | |
bool | validateMaterial (const String &schemeName, const String &materialName) |
Validate specific material scheme. More... | |
bool | validateScheme (const String &schemeName) |
Validate a given scheme. More... | |
Static Public Member Functions | |
static void | finalize () |
Finalize the Shader Generator instance. More... | |
static ShaderGenerator & | getSingleton () |
Override standard Singleton retrieval. More... | |
static ShaderGenerator * | getSingletonPtr () |
Override standard Singleton retrieval. More... | |
static bool | initialize () |
Initialize the Shader Generator System. More... | |
Static Public Attributes | |
static String | DEFAULT_SCHEME_NAME |
Default material scheme of the shader generator. More... | |
Protected Types | |
typedef SceneManagerMap::const_iterator | SceneManagerConstIterator |
typedef SceneManagerMap::iterator | SceneManagerIterator |
typedef map< String, SceneManager * >::type | SceneManagerMap |
typedef SGMaterialMap::const_iterator | SGMaterialConstIterator |
typedef SGMaterialMap::iterator | SGMaterialIterator |
typedef map< String, SGMaterial * >::type | SGMaterialMap |
typedef SGPassList::const_iterator | SGPassConstIterator |
typedef SGPassList::iterator | SGPassIterator |
typedef vector< SGPass * >::type | SGPassList |
typedef SGMaterialMap::const_iterator | SGSchemeConstIterator |
typedef SGSchemeMap::iterator | SGSchemeIterator |
typedef map< String, SGScheme * > ::type | SGSchemeMap |
typedef SGScriptTranslatorMap::const_iterator | SGScriptTranslatorConstIterator |
typedef SGScriptTranslatorMap::iterator | SGScriptTranslatorIterator |
typedef map< String, ScriptTranslator * >::type | SGScriptTranslatorMap |
typedef SGTechniqueList::const_iterator | SGTechniqueConstIterator |
typedef SGTechniqueList::iterator | SGTechniqueIterator |
typedef vector< SGTechnique * > ::type | SGTechniqueList |
typedef map< SGTechnique *, SGTechnique * >::type | SGTechniqueMap |
typedef SGTechniqueMap::iterator | SGTechniqueMapIterator |
typedef SubRenderStateFactoryMap::const_iterator | SubRenderStateFactoryConstIterator |
typedef SubRenderStateFactoryMap::iterator | SubRenderStateFactoryIterator |
typedef map< String, SubRenderStateFactory * > ::type | SubRenderStateFactoryMap |
Protected Member Functions | |
ShaderGenerator () | |
Class default constructor. More... | |
~ShaderGenerator () | |
Class destructor. More... | |
void | _finalize () |
Finalize the shader generator instance. More... | |
bool | _initialize () |
Initialize the shader generator instance. More... | |
bool | addCustomScriptTranslator (const String &key, ScriptTranslator *translator) |
Add custom script translator. More... | |
SubRenderState * | createSubRenderState (ScriptCompiler *compiler, PropertyAbstractNode *prop, Pass *pass) |
Create an instance of the SubRenderState based on script properties using the current sub render state factories. More... | |
void | createSubRenderStateExFactories () |
Create sub render state core extensions factories. More... | |
void | destroySubRenderStateExFactories () |
Destroy sub render state core extensions factories. More... | |
Technique * | findSourceTechnique (const String &materialName, const String &srcTechniqueSchemeName) |
Find source technique to generate shader based technique based on it. More... | |
size_t | getNumTranslators () const |
Return number of script translators. More... | |
ScriptTranslator * | getTranslator (const AbstractNodePtr &node) |
Return a matching script translator. More... | |
void | notifyRenderSingleObject (Renderable *rend, const Pass *pass, const AutoParamDataSource *source, const LightList *pLightList, bool suppressRenderStateChanges) |
Called from the sub class of the RenderObjectLister when single object is rendered. More... | |
void | preFindVisibleObjects (SceneManager *source, SceneManager::IlluminationRenderStage irs, Viewport *v) |
Called from the sub class of the SceneManager::Listener when finding visible object process starts. More... | |
bool | removeCustomScriptTranslator (const String &key) |
Remove custom script translator. More... | |
void | serializePassAttributes (MaterialSerializer *ser, SGPass *passEntry) |
This method called by instance of SGMaterialSerializerListener and serialize a given pass entry attributes. More... | |
Static Protected Attributes | |
static ShaderGenerator * | ms_Singleton |
Friends | |
class | FFPRenderStateBuilder |
class | SGMaterialSerializerListener |
class | SGPass |
class | SGScriptTranslator |
class | SGScriptTranslatorManager |
Shader generator system main interface.
This singleton based class enables automatic generation of shader code based on existing material techniques.
Definition at line 52 of file OgreShaderGenerator.h.
|
protected |
Definition at line 677 of file OgreShaderGenerator.h.
|
protected |
Definition at line 676 of file OgreShaderGenerator.h.
|
protected |
Definition at line 675 of file OgreShaderGenerator.h.
|
protected |
Definition at line 362 of file OgreShaderGenerator.h.
|
protected |
Definition at line 361 of file OgreShaderGenerator.h.
|
protected |
Definition at line 360 of file OgreShaderGenerator.h.
|
protected |
Definition at line 351 of file OgreShaderGenerator.h.
|
protected |
Definition at line 350 of file OgreShaderGenerator.h.
|
protected |
Definition at line 347 of file OgreShaderGenerator.h.
|
protected |
Definition at line 366 of file OgreShaderGenerator.h.
|
protected |
Definition at line 365 of file OgreShaderGenerator.h.
|
protected |
Definition at line 364 of file OgreShaderGenerator.h.
|
protected |
Definition at line 370 of file OgreShaderGenerator.h.
|
protected |
Definition at line 369 of file OgreShaderGenerator.h.
|
protected |
Definition at line 368 of file OgreShaderGenerator.h.
|
protected |
Definition at line 355 of file OgreShaderGenerator.h.
|
protected |
Definition at line 354 of file OgreShaderGenerator.h.
|
protected |
Definition at line 353 of file OgreShaderGenerator.h.
|
protected |
Definition at line 357 of file OgreShaderGenerator.h.
|
protected |
Definition at line 358 of file OgreShaderGenerator.h.
|
protected |
Definition at line 672 of file OgreShaderGenerator.h.
|
protected |
Definition at line 671 of file OgreShaderGenerator.h.
|
protected |
Definition at line 670 of file OgreShaderGenerator.h.
|
protected |
Class default constructor.
|
protected |
Class destructor.
|
protected |
Finalize the shader generator instance.
|
protected |
Initialize the shader generator instance.
|
protected |
Add custom script translator.
Return true upon success.
key | The key name of the given translator. |
translator | The translator to associate with the given key. |
void Ogre::RTShader::ShaderGenerator::addSceneManager | ( | SceneManager * | sceneMgr | ) |
Add a scene manager to the shader generator scene managers list.
sceneMgr | The scene manager to add to the list. |
void Ogre::RTShader::ShaderGenerator::addSubRenderStateFactory | ( | SubRenderStateFactory * | factory | ) |
Add sub render state factory.
Plugins or 3d party applications may implement sub classes of SubRenderState interface. Add the matching factory will allow the application to create instances of these sub classes.
factory | The factory to add. |
void Ogre::RTShader::ShaderGenerator::createScheme | ( | const String & | schemeName | ) |
Create a scheme.
schemeName | The scheme name to create. |
bool Ogre::RTShader::ShaderGenerator::createShaderBasedTechnique | ( | const String & | materialName, |
const String & | srcTechniqueSchemeName, | ||
const String & | dstTechniqueSchemeName | ||
) |
Create shader based technique from a given technique.
Return true upon success. Failure may occur if the source technique is not FFP pure, or different source technique is mapped to the requested destination scheme.
materialName | The source material name. |
srcTechniqueSchemeName | The source technique scheme name. |
dstTechniqueSchemeName | The destination shader based technique scheme name. |
SubRenderState* Ogre::RTShader::ShaderGenerator::createSubRenderState | ( | const String & | type | ) |
Create an instance of sub render state from a given type.
type | The type of sub render state to create. |
|
protected |
Create an instance of the SubRenderState based on script properties using the current sub render state factories.
compiler | The compiler instance. |
prop | The abstract property node. |
pass | The pass that is the parent context of this node. |
|
protected |
Create sub render state core extensions factories.
void Ogre::RTShader::ShaderGenerator::destroySubRenderState | ( | SubRenderState * | subRenderState | ) |
Destroy an instance of sub render state.
subRenderState | The instance to destroy. |
|
protected |
Destroy sub render state core extensions factories.
|
static |
Finalize the Shader Generator instance.
|
protected |
Find source technique to generate shader based technique based on it.
void Ogre::RTShader::ShaderGenerator::flushShaderCache | ( | ) |
Flush the shader cache.
This operation will cause all active sachems to be invalidated and will destroy any CPU/GPU program that created by this shader generator.
SceneManager* Ogre::RTShader::ShaderGenerator::getActiveSceneManager | ( | ) |
Get the active scene manager that is doint the actual scene rendering.
This attribute will be update on the call to preFindVisibleObjects.
size_t Ogre::RTShader::ShaderGenerator::getFragmentShaderCount | ( | ) | const |
Return the current number of generated fragment shaders.
|
inline |
Get the output fragment shader target profiles.
Definition at line 161 of file OgreShaderGenerator.h.
|
inline |
Get the output fragment shader target profiles as list of strings.
Definition at line 166 of file OgreShaderGenerator.h.
SGMaterialSerializerListener* Ogre::RTShader::ShaderGenerator::getMaterialSerializerListener | ( | ) |
Return custom material Serializer of the shader generator.
This is useful when you'd like to export certain material that contains shader generator effects. I.E - when writing an exporter you may want mark your material as shader generated material so in the next time you will load it by your application it will automatically generate shaders with custom attributes you wanted. To do it you'll have to do the following steps:
|
protected |
Return number of script translators.
RenderState* Ogre::RTShader::ShaderGenerator::getRenderState | ( | const String & | schemeName | ) |
Return a global render state associated with the given scheme name.
Modifying this render state will affect all techniques that belongs to that scheme. This is the best way to apply global changes to all techniques. After altering the render state one should call invalidateScheme method in order to regenerate shaders.
schemeName | The destination scheme name. |
RenderState* Ogre::RTShader::ShaderGenerator::getRenderState | ( | const String & | schemeName, |
const String & | materialName, | ||
unsigned short | passIndex | ||
) |
Get render state of specific pass.
Using this method allows the user to customize the behavior of a specific pass.
schemeName | The destination scheme name. |
materialName | The specific material name. |
passIndex | The pass index. |
|
inline |
Get the output shader cache path.
Definition at line 179 of file OgreShaderGenerator.h.
|
static |
Override standard Singleton retrieval.
|
static |
Override standard Singleton retrieval.
|
inline |
Return the target shader language currently in use.
Definition at line 133 of file OgreShaderGenerator.h.
|
protected |
Return a matching script translator.
size_t Ogre::RTShader::ShaderGenerator::getVertexShaderCount | ( | ) | const |
Return the current number of generated vertex shaders.
|
inline |
Get the vertex shader outputs compaction policy.
Definition at line 337 of file OgreShaderGenerator.h.
|
inline |
Get the output vertex shader target profiles.
Definition at line 144 of file OgreShaderGenerator.h.
|
inline |
Get the output vertex shader target profiles as list of strings.
Definition at line 149 of file OgreShaderGenerator.h.
|
static |
Initialize the Shader Generator System.
Return true upon success.
sceneMgr | The scene manager that the shader generator will be bound to. |
void Ogre::RTShader::ShaderGenerator::invalidateMaterial | ( | const String & | schemeName, |
const String & | materialName | ||
) |
Invalidate specific material scheme.
This action will lead to shader regeneration of the technique belongs to the given scheme name.
schemeName | The scheme to invalidate. |
materialName | The material to invalidate. |
void Ogre::RTShader::ShaderGenerator::invalidateScheme | ( | const String & | schemeName | ) |
Invalidate a given scheme.
This action will lead to shader regeneration of all techniques belongs to the given scheme name.
schemeName | The scheme to invalidate. |
|
protected |
Called from the sub class of the RenderObjectLister when single object is rendered.
|
inlineinherited |
Definition at line 95 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 101 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 107 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 112 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 118 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
operator new, with debug line info
Definition at line 67 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 72 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
placement operator new
Definition at line 78 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
array operator new, with debug line info
Definition at line 85 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 90 of file OgreMemoryAllocatedObject.h.
|
protected |
Called from the sub class of the SceneManager::Listener when finding visible object process starts.
bool Ogre::RTShader::ShaderGenerator::removeAllShaderBasedTechniques | ( | const String & | materialName | ) |
Remove all shader based techniques of the given material.
Return true upon success.
materialName | The source material name. |
void Ogre::RTShader::ShaderGenerator::removeAllShaderBasedTechniques | ( | ) |
Remove all shader based techniques that created by this shader generator.
|
protected |
Remove custom script translator.
Return true upon success.
key | The key name of the translator to remove. |
void Ogre::RTShader::ShaderGenerator::removeSceneManager | ( | SceneManager * | sceneMgr | ) |
Remove a scene manager from the shader generator scene managers list.
sceneMgr | The scene manager to remove from the list. |
bool Ogre::RTShader::ShaderGenerator::removeShaderBasedTechnique | ( | const String & | materialName, |
const String & | srcTechniqueSchemeName, | ||
const String & | dstTechniqueSchemeName | ||
) |
Remove shader based technique from a given technique.
Return true upon success. Failure may occur if the given source technique was not previously registered successfully using the createShaderBasedTechnique method.
materialName | The source material name. |
srcTechniqueSchemeName | The source technique scheme name. |
dstTechniqueSchemeName | The destination shader based technique scheme name. |
void Ogre::RTShader::ShaderGenerator::removeSubRenderStateFactory | ( | SubRenderStateFactory * | factory | ) |
Remove sub render state factory.
factory | The factory to remove. |
|
protected |
This method called by instance of SGMaterialSerializerListener and serialize a given pass entry attributes.
ser | The material serializer. |
passEntry | The SGPass instance. |
void Ogre::RTShader::ShaderGenerator::setFragmentShaderProfiles | ( | const String & | fragmentShaderProfiles | ) |
Set the output fragment shader target profiles.
fragmentShaderProfile | The target profiles for the fragment shader. |
void Ogre::RTShader::ShaderGenerator::setShaderCachePath | ( | const String & | cachePath | ) |
Set the output shader cache path.
Generated shader code will be written to this path. In case of empty cache path shaders will be generated directly from system memory.
cachePath | The cache path of the shader. The default is empty cache path. |
void Ogre::RTShader::ShaderGenerator::setTargetLanguage | ( | const String & | shaderLanguage | ) |
Set the target shader language.
shaderLanguage | The output shader language to use. |
|
inline |
Set the vertex shader outputs compaction policy.
policy | The policy to set. |
Definition at line 332 of file OgreShaderGenerator.h.
void Ogre::RTShader::ShaderGenerator::setVertexShaderProfiles | ( | const String & | vertexShaderProfiles | ) |
Set the output vertex shader target profiles.
vertexShaderProfile | The target profiles for the vertex shader. |
bool Ogre::RTShader::ShaderGenerator::validateMaterial | ( | const String & | schemeName, |
const String & | materialName | ||
) |
Validate specific material scheme.
This action will generate shader programs for the technique of the given scheme name.
schemeName | The scheme to validate. |
materialName | The material to validate. |
bool Ogre::RTShader::ShaderGenerator::validateScheme | ( | const String & | schemeName | ) |
Validate a given scheme.
This action will generate shader programs for all techniques of the given scheme name.
schemeName | The scheme to validate. |
|
friend |
Definition at line 777 of file OgreShaderGenerator.h.
|
friend |
Definition at line 780 of file OgreShaderGenerator.h.
|
friend |
Definition at line 776 of file OgreShaderGenerator.h.
|
friend |
Definition at line 779 of file OgreShaderGenerator.h.
|
friend |
Definition at line 778 of file OgreShaderGenerator.h.
|
static |
Default material scheme of the shader generator.
Definition at line 340 of file OgreShaderGenerator.h.
|
protected |
Definition at line 749 of file OgreShaderGenerator.h.
|
protected |
Definition at line 771 of file OgreShaderGenerator.h.
|
protected |
Definition at line 756 of file OgreShaderGenerator.h.
|
protected |
Definition at line 765 of file OgreShaderGenerator.h.
|
protected |
Definition at line 760 of file OgreShaderGenerator.h.
|
protected |
Definition at line 761 of file OgreShaderGenerator.h.
|
protected |
Definition at line 772 of file OgreShaderGenerator.h.
|
protected |
Definition at line 766 of file OgreShaderGenerator.h.
|
protected |
Definition at line 754 of file OgreShaderGenerator.h.
|
protected |
Definition at line 763 of file OgreShaderGenerator.h.
|
protected |
Definition at line 764 of file OgreShaderGenerator.h.
|
protected |
Definition at line 751 of file OgreShaderGenerator.h.
|
staticprotectedinherited |
Definition at line 75 of file OgreSingleton.h.
|
protected |
Definition at line 752 of file OgreShaderGenerator.h.
|
protected |
Definition at line 750 of file OgreShaderGenerator.h.
|
protected |
Definition at line 767 of file OgreShaderGenerator.h.
|
protected |
Definition at line 753 of file OgreShaderGenerator.h.
|
protected |
Definition at line 755 of file OgreShaderGenerator.h.
|
protected |
Definition at line 762 of file OgreShaderGenerator.h.
|
protected |
Definition at line 757 of file OgreShaderGenerator.h.
|
protected |
Definition at line 770 of file OgreShaderGenerator.h.
|
protected |
Definition at line 769 of file OgreShaderGenerator.h.
|
protected |
Definition at line 768 of file OgreShaderGenerator.h.
|
protected |
Definition at line 758 of file OgreShaderGenerator.h.
|
protected |
Definition at line 759 of file OgreShaderGenerator.h.
|
protected |
Definition at line 773 of file OgreShaderGenerator.h.