Go to the documentation of this file.
27 #ifndef _ShaderGenerator_
28 #define _ShaderGenerator_
62 static bool initialize();
67 static void destroy();
128 void setTargetLanguage(
const String& shaderLanguage);
139 void setVertexShaderProfiles(
const String& vertexShaderProfiles);
156 void setFragmentShaderProfiles(
const String& fragmentShaderProfiles);
174 void setShaderCachePath(
const String& cachePath);
185 void flushShaderCache();
210 bool hasRenderState(
const String& schemeName)
const;
243 size_t getNumSubRenderStateFactories()
const;
283 bool hasShaderBasedTechnique(
const String& materialName,
const String& srcTechniqueSchemeName,
const String& dstTechniqueSchemeName)
const;
293 bool hasShaderBasedTechnique(
const String& materialName,
const String& groupName,
const String& srcTechniqueSchemeName,
const String& dstTechniqueSchemeName)
const;
304 bool createShaderBasedTechnique(
const String& materialName,
const String& srcTechniqueSchemeName,
const String& dstTechniqueSchemeName,
bool overProgrammable =
false);
316 bool createShaderBasedTechnique(
const String& materialName,
const String& groupName,
const String& srcTechniqueSchemeName,
const String& dstTechniqueSchemeName,
bool overProgrammable =
false);
327 bool removeShaderBasedTechnique(
const String& materialName,
const String& srcTechniqueSchemeName,
const String& dstTechniqueSchemeName);
338 bool removeShaderBasedTechnique(
const String& materialName,
const String& groupName,
const String& srcTechniqueSchemeName,
const String& dstTechniqueSchemeName);
359 bool cloneShaderBasedTechniques(
const String& srcMaterialName,
360 const String& srcGroupName,
const String& dstMaterialName,
const String& dstGroupName);
365 void removeAllShaderBasedTechniques();
371 void createScheme(
const String& schemeName);
378 void invalidateScheme(
const String& schemeName);
385 bool validateScheme(
const String& schemeName);
421 size_t getVertexShaderCount()
const;
425 size_t getFragmentShaderCount()
const;
456 size_t getRTShaderSchemeCount()
const;
460 const String& getRTShaderScheme(
size_t index)
const;
478 int cmpVal = strcmp(p1.first.c_str(),p2.first.c_str());
479 return (cmpVal < 0) || ((cmpVal == 0) && (strcmp(p1.second.c_str(),p2.second.c_str()) < 0));
516 void buildTargetRenderState();
519 void acquirePrograms();
522 void releasePrograms();
583 void buildTargetRenderState();
586 void acquirePrograms();
589 void releasePrograms();
600 RenderState* getRenderState(
unsigned short passIndex);
602 bool hasRenderState(
unsigned short passIndex);
610 void createSGPasses();
613 void destroySGPasses();
676 bool empty()
const {
return mTechniqueEntries.empty(); }
717 void synchronizeWithLightSettings();
720 void synchronizeWithFogSettings();
754 const LightList* pLightList,
bool suppressRenderStateChanges)
756 mOwner->notifyRenderSingleObject(rend, pass, source, pLightList, suppressRenderStateChanges);
778 mOwner->preFindVisibleObjects(source, irs, v);
793 Camera* camera,
size_t iteration)
821 return mOwner->getNumTranslators();
827 return mOwner->getTranslator(node);
859 Technique* findSourceTechnique(
const String& materialName,
const String& groupName,
const String& srcTechniqueSchemeName,
bool allowProgrammable);
862 bool isProgrammable(
Technique* tech)
const;
871 void createSubRenderStateExFactories();
874 void destroySubRenderStateExFactories();
909 bool removeCustomScriptTranslator(
const String& key);
912 size_t getNumTranslators()
const;
949 bool getIsFinalizing()
const;
1011 friend class FFPRenderStateBuilder;
const String & getFragmentShaderProfiles() const
Get the output fragment shader target profiles.
Technique * mDstTechnique
SGTechniqueList mTechniqueEntries
bool mCreateShaderOverProgrammablePass
This utility class is used to hold the information used to generate the matrices and other informatio...
FileSystemLayer * mFSLayer
Class representing the state of a single texture unit during a Pass of a Technique,...
const String & getGroupName() const
Get the group name.
SGTechniqueList mTechniqueEntries
const String & getDestinationTechniqueSchemeName() const
Get the destination technique scheme name.
map< SGTechnique *, SGTechnique * >::type SGTechniqueMap
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
IlluminationRenderStage
Describes the stage of rendering when performing complex illumination.
SGScriptTranslatorMap::iterator SGScriptTranslatorIterator
This class translates script AST (abstract syntax tree) into Ogre resources.
SceneManager * mActiveSceneMgr
map< String, SGScheme * >::type SGSchemeMap
SGSceneManagerListener * mSceneManagerListener
Class that allows listening in on the various stages of SceneManager processing, so that custom behav...
SGPassList::iterator SGPassIterator
This class is the base interface of sub part from a shader based rendering pipeline.
SGScriptTranslatorMap mScriptTranslatorsMap
SGScriptTranslatorManager(ShaderGenerator *owner)
const String & getMaterialName() const
Get the material name.
std::pair< RenderState *, bool > RenderStateCreateOrRetrieveResult
A viewpoint from which the scene will be rendered.
map< String, ScriptTranslator * >::type SGScriptTranslatorMap
SGSceneManagerListener(ShaderGenerator *owner)
vector< String >::type StringVector
const StringVector & getVertexShaderProfilesList() const
Get the output vertex shader target profiles as list of strings.
SGMaterialSerializerListener * mMaterialSerializerListener
Shader generator technique wrapper class.
ProgramManager * mProgramManager
SubRenderStateFactoryMap mSubRenderStateFactories
SubRenderStateFactoryMap::const_iterator SubRenderStateFactoryConstIterator
Representation of a dynamic light source in the scene.
virtual size_t getNumTranslators() const
Returns the number of translators being managed.
const StringVector & getFragmentShaderProfilesList() const
Get the output fragment shader target profiles as list of strings.
RenderStateList mCustomRenderStates
SGTechniqueList & getTechniqueList()
Get the techniques list of this material.
SGMaterial(const String &materialName, const String &groupName)
Class constructor.
String mFragmentShaderProfiles
SGPassList::const_iterator SGPassConstIterator
Technique * mSrcTechnique
Pass * getDstPass()
Get destination pass.
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
map< MatGroupPair, SGMaterial *, MatGroupPair_less >::type SGMaterialMap
SGSchemeMap mSchemeEntriesMap
const SGTechniqueList & getTechniqueList() const
Get the const techniques list of this material.
Abstract factory interface for creating SubRenderState implementation instances.
bool getBuildDestinationTechnique() const
Tells if the destination technique should be build.
SGScriptTranslatorMap::const_iterator SGScriptTranslatorConstIterator
Class defining a single pass of a Technique (of a Material), i.e.
Class representing an approach to rendering this particular Material.
virtual ScriptTranslator * getTranslator(const AbstractNodePtr &node)
Returns a manager for the given object abstract node, or null if it is not supported.
TargetRenderState * mTargetRenderState
bool getCreateShaderOverProgrammablePass() const
Returns whether shaders are created for passes with shaders.
const String & getShaderCachePath() const
Get the output shader cache path.
SGScriptTranslator mCoreScriptTranslator
ProgramWriterManager * mProgramWriterManager
Abstract interface which classes must implement if they wish to receive events from the scene manager...
StringVector mFragmentShaderProfilesList
virtual void notifyRenderSingleObject(Renderable *rend, const Pass *pass, const AutoParamDataSource *source, const LightList *pLightList, bool suppressRenderStateChanges)
Listener overridden function notify the shader generator when rendering single object.
SGSchemeMap::const_iterator SGSchemeConstIterator
vector< SGPass * >::type SGPassList
bool empty() const
Return true if this scheme dose not contains any techniques.
RenderState * getCustomRenderState()
Get custom render state of this pass.
Shader generator scene manager sub class.
Manages the organisation and rendering of a 'scene' i.e.
virtual void shadowTexturesUpdated(size_t numberOfShadowTextures)
Event raised after all shadow textures have been rendered into for all queues / targets but before an...
An abstraction of a viewport, i.e.
This is the main class for the compiler.
SGRenderObjectListener * mRenderObjectListener
The ScriptTranslatorManager manages the lifetime and access to script translators.
This is a container class for sub render state class.
Technique * getDestinationTechnique()
Get the destination technique.
StringVector mVertexShaderProfilesList
Class for serializing Materials to / from a .material script.
String mDstTechniqueSchemeName
Template class for creating single-instance global classes.
SGSchemeMap::iterator SGSchemeIterator
virtual void shadowTextureCasterPreViewProj(Light *light, Camera *camera, size_t iteration)
This event occurs just before the view & projection matrices are set for rendering into a shadow text...
const SGMaterial * getParent() const
Get the parent SGMaterial.
SceneManagerMap mSceneManagerMap
bool mActiveViewportValid
void setBuildDestinationTechnique(bool buildTechnique)
Tells the technique that it needs to generate shader code.
void setCreateShaderOverProgrammablePass(bool value)
Sets whether shaders are created for passes with shaders.
A frustum represents a pyramid, capped at the near and far end which is used to represent either a vi...
Shader generator RenderObjectListener sub class.
std::pair< SGScheme *, bool > SchemeCreateOrRetrieveResult
void setVertexShaderOutputsCompactPolicy(VSOutputCompactPolicy policy)
Set the vertex shader outputs compaction policy.
Reference-counted shared pointer, used for objects where implicit destruction is required.
void setCustomRenderState(RenderState *customRenderState)
Set the custom render state of this pass.
SGTechniqueList::iterator SGTechniqueIterator
SGTechniqueMap::iterator SGTechniqueMapIterator
Shader generator scheme class.
Shader generator ScriptTranslatorManager sub class.
const String & getVertexShaderProfiles() const
Get the output vertex shader target profiles.
A singleton manager class that manages shader based programs.
SGMaterialMap::const_iterator SGMaterialConstIterator
SGMaterialMap::iterator SGMaterialIterator
VSOutputCompactPolicy getVertexShaderOutputsCompactPolicy() const
Get the vertex shader outputs compaction policy.
virtual void preFindVisibleObjects(SceneManager *source, SceneManager::IlluminationRenderStage irs, Viewport *v)
Listener overridden function notify the shader generator when finding visible objects process started...
SubRenderStateFactoryMap::iterator SubRenderStateFactoryIterator
String mVertexShaderProfiles
virtual void postFindVisibleObjects(SceneManager *source, SceneManager::IlluminationRenderStage irs, Viewport *v)
Called after searching for visible objects in this SceneManager.
Shader generator pass wrapper class.
SGTechniqueMap mTechniqueEntriesMap
Abstract class defining the interface all renderable objects must implement.
const String & getTargetLanguage() const
Return the target shader language currently in use.
Provides methods to find out where the Ogre config files are stored and where logs and settings files...
This is the target render state.
static String DEFAULT_SCHEME_NAME
Default material scheme of the shader generator.
map< String, SceneManager * >::type SceneManagerMap
SGTechniqueList::const_iterator SGTechniqueConstIterator
SGRenderObjectListener(ShaderGenerator *owner)
vector< SGTechnique * >::type SGTechniqueList
Shader generator material wrapper class.
RenderState * mCustomRenderState
VSOutputCompactPolicy mVSOutputCompactPolicy
This abstract node represents a script property.
virtual void shadowTextureReceiverPreViewProj(Light *light, Frustum *frustum)
This event occurs just before the view & projection matrices are set for re-rendering a shadow receiv...
Technique * getSourceTechnique()
Get the source technique.
vector< RenderState * >::type RenderStateList
This class responsible for translating core features of the RT Shader System for Ogre material script...
This class responsible for translating core features of the RT Shader System for Ogre material script...
Shader generator system main interface.
SGMaterialMap mMaterialEntriesMap
FFPRenderStateBuilder * mFFPRenderStateBuilder
map< String, SubRenderStateFactory * >::type SubRenderStateFactoryMap
std::pair< String, String > MatGroupPair
SceneManagerMap::iterator SceneManagerIterator
RenderState * mRenderState
SceneManagerMap::const_iterator SceneManagerConstIterator
Pass * getSrcPass()
Get source pass.
SubRenderStateFactoryMap mSubRenderStateExFactories
bool operator()(const MatGroupPair &p1, const MatGroupPair &p2) const
SGScriptTranslatorManager * mScriptTranslatorManager
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Apr 13 2021 08:53:15