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();
203 RenderStateCreateOrRetrieveResult createOrRetrieveRenderState(
const String& schemeName);
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;
476 bool operator()(
const MatGroupPair& p1,
const MatGroupPair& p2)
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;
937 SGMaterialIterator findMaterialEntryIt(
const String& materialName,
const String& groupName);
938 SGMaterialConstIterator findMaterialEntryIt(
const String& materialName,
const String& groupName)
const;
946 SchemeCreateOrRetrieveResult createOrRetrieveScheme(
const String& schemeName);
949 bool getIsFinalizing()
const;
1011 friend class FFPRenderStateBuilder;
const StringVector & getVertexShaderProfilesList() const
Get the output vertex shader target profiles as list of strings.
map< String, SubRenderStateFactory * >::type SubRenderStateFactoryMap
bool getBuildDestinationTechnique() const
Tells if the destination technique should be build.
std::pair< String, String > MatGroupPair
SGScriptTranslatorMap::iterator SGScriptTranslatorIterator
SGSceneManagerListener * mSceneManagerListener
SGMaterialSerializerListener * mMaterialSerializerListener
SGTechniqueList & getTechniqueList()
Get the techniques list of this material.
Abstract class defining the interface all renderable objects must implement.
Shader generator scheme class.
Class for serializing Materials to / from a .material script.
Class defining a single pass of a Technique (of a Material), i.e.
Technique * mDstTechnique
The ScriptTranslatorManager manages the lifetime and access to script translators.
FileSystemLayer * mFSLayer
This is the target render state.
SGPassList::const_iterator SGPassConstIterator
SGTechniqueList mTechniqueEntries
VSOutputCompactPolicy getVertexShaderOutputsCompactPolicy() const
Get the vertex shader outputs compaction policy.
This class is the base interface of sub part from a shader based rendering pipeline.
map< MatGroupPair, SGMaterial *, MatGroupPair_less >::type SGMaterialMap
SGSchemeMap mSchemeEntriesMap
Shader generator ScriptTranslatorManager sub class.
TargetRenderState * mTargetRenderState
RenderState * mRenderState
SGPassList::iterator SGPassIterator
void setBuildDestinationTechnique(bool buildTechnique)
Tells the technique that it needs to generate shader code.
SubRenderStateFactoryMap::const_iterator SubRenderStateFactoryConstIterator
std::pair< RenderState *, bool > RenderStateCreateOrRetrieveResult
SGScriptTranslatorMap::const_iterator SGScriptTranslatorConstIterator
SGMaterial(const String &materialName, const String &groupName)
Class constructor.
IlluminationRenderStage
Describes the stage of rendering when performing complex illumination.
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.
bool mCreateShaderOverProgrammablePass
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
String mFragmentShaderProfiles
bool empty() const
Return true if this scheme dose not contains any techniques.
SceneManager * mActiveSceneMgr
const SGMaterial * getParent() const
Get the parent SGMaterial.
vector< String >::type StringVector
Shader generator system main interface.
Provides methods to find out where the Ogre config files are stored and where logs and settings files...
This class translates script AST (abstract syntax tree) into Ogre resources.
ProgramManager * mProgramManager
map< String, ScriptTranslator * >::type SGScriptTranslatorMap
An abstraction of a viewport, i.e.
virtual void shadowTextureReceiverPreViewProj(Light *light, Frustum *frustum)
This event occurs just before the view & projection matrices are set for re-rendering a shadow receiv...
SGSceneManagerListener(ShaderGenerator *owner)
SGScriptTranslator mCoreScriptTranslator
Class that allows listening in on the various stages of SceneManager processing, so that custom behav...
Technique * getSourceTechnique()
Get the source technique.
bool operator()(const MatGroupPair &p1, const MatGroupPair &p2) const
const String & getFragmentShaderProfiles() const
Get the output fragment shader target profiles.
SGSchemeMap::const_iterator SGSchemeConstIterator
SubRenderStateFactoryMap mSubRenderStateFactories
SGSchemeMap::iterator SGSchemeIterator
const String & getVertexShaderProfiles() const
Get the output vertex shader target profiles.
Pass * getDstPass()
Get destination pass.
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...
Class representing the state of a single texture unit during a Pass of a Technique, of a Material.
ProgramWriterManager * mProgramWriterManager
This is a container class for sub render state class.
bool mActiveViewportValid
StringVector mFragmentShaderProfilesList
SGScriptTranslatorManager(ShaderGenerator *owner)
SGRenderObjectListener * mRenderObjectListener
StringVector mVertexShaderProfilesList
virtual void shadowTexturesUpdated(size_t numberOfShadowTextures)
Event raised after all shadow textures have been rendered into for all queues / targets but before an...
This class responsible for translating core features of the RT Shader System for Ogre material script...
vector< SGPass * >::type SGPassList
Shader generator RenderObjectListener sub class.
const String & getShaderCachePath() const
Get the output shader cache path.
This abstract node represents a script property.
A singleton manager class that manages shader based programs.
Abstract interface which classes must implement if they wish to receive events from the scene manager...
Shader generator scene manager sub class.
SGMaterialMap::iterator SGMaterialIterator
void setCreateShaderOverProgrammablePass(bool value)
Sets whether shaders are created for passes with shaders.
SubRenderStateFactoryMap::iterator SubRenderStateFactoryIterator
void setCustomRenderState(RenderState *customRenderState)
Set the custom render state of this pass.
Pass * getSrcPass()
Get source pass.
SGTechniqueMap::iterator SGTechniqueMapIterator
Shader generator pass wrapper class.
A viewpoint from which the scene will be rendered.
map< String, SceneManager * >::type SceneManagerMap
RenderState * mCustomRenderState
Shader generator technique wrapper class.
RenderState * getCustomRenderState()
Get custom render state of this pass.
const String & getTargetLanguage() const
Return the target shader language currently in use.
Technique * mSrcTechnique
VSOutputCompactPolicy mVSOutputCompactPolicy
std::pair< SGScheme *, bool > SchemeCreateOrRetrieveResult
const String & getMaterialName() const
Get the material name.
Abstract factory interface for creating SubRenderState implementation instances.
SGTechniqueList::iterator SGTechniqueIterator
virtual void preFindVisibleObjects(SceneManager *source, SceneManager::IlluminationRenderStage irs, Viewport *v)
Listener overridden function notify the shader generator when finding visible objects process started...
static String DEFAULT_SCHEME_NAME
Default material scheme of the shader generator.
SceneManagerMap mSceneManagerMap
Shader generator material wrapper class.
const StringVector & getFragmentShaderProfilesList() const
Get the output fragment shader target profiles as list of strings.
SGMaterialMap::const_iterator SGMaterialConstIterator
SGTechniqueList::const_iterator SGTechniqueConstIterator
Reference-counted shared pointer, used for objects where implicit destruction is required.
vector< SGTechnique * >::type SGTechniqueList
const SGTechniqueList & getTechniqueList() const
Get the const techniques list of this material.
SGTechniqueList mTechniqueEntries
virtual void postFindVisibleObjects(SceneManager *source, SceneManager::IlluminationRenderStage irs, Viewport *v)
Called after searching for visible objects in this SceneManager.
String mVertexShaderProfiles
void setVertexShaderOutputsCompactPolicy(VSOutputCompactPolicy policy)
Set the vertex shader outputs compaction policy.
bool getCreateShaderOverProgrammablePass() const
Returns whether shaders are created for passes with shaders.
Template class for creating single-instance global classes.
SubRenderStateFactoryMap mSubRenderStateExFactories
Class representing an approach to rendering this particular Material.
const String & getGroupName() const
Get the group name.
const String & getDestinationTechniqueSchemeName() const
Get the destination technique scheme name.
This utility class is used to hold the information used to generate the matrices and other informatio...
virtual ScriptTranslator * getTranslator(const AbstractNodePtr &node)
Returns a manager for the given object abstract node, or null if it is not supported.
A frustum represents a pyramid, capped at the near and far end which is used to represent either a vi...
Manages the organisation and rendering of a 'scene' i.e.
map< SGTechnique *, SGTechnique * >::type SGTechniqueMap
SceneManagerMap::iterator SceneManagerIterator
RenderStateList mCustomRenderStates
SceneManagerMap::const_iterator SceneManagerConstIterator
vector< RenderState * >::type RenderStateList
map< String, SGScheme * >::type SGSchemeMap
SGTechniqueMap mTechniqueEntriesMap
virtual size_t getNumTranslators() const
Returns the number of translators being managed.
This class responsible for translating core features of the RT Shader System for Ogre material script...
SGScriptTranslatorMap mScriptTranslatorsMap
SGScriptTranslatorManager * mScriptTranslatorManager
Representation of a dynamic light source in the scene.
String mDstTechniqueSchemeName
This is the main class for the compiler.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
SGRenderObjectListener(ShaderGenerator *owner)
Technique * getDestinationTechnique()
Get the destination technique.
SGMaterialMap mMaterialEntriesMap
FFPRenderStateBuilder * mFFPRenderStateBuilder