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