#pragma once #include "RenderTechnique.h" #include "OgreRenderable.h" #include "OgreSharedRuns.h" class OgreTechniqueGroup; /** @brief Event handler class. The derived calsses of this class can register task that should be done before and/or after updating all RenderTechniques. UpdateListeners can be registered to the OgreIlluminationMager. @see addUpdateListener */ class UpdateListener { public: /** @brief Called before RenderTechnique updates */ virtual void preAllUpdates(){} /** @brief Called after RenderTechnique updates */ virtual void postAllUpdates(){} }; /** @brief Class of RenderTechniques used in an OGRE environment. */ class OgreRenderTechnique : virtual public RenderTechnique { public: /** @brief Constructor. @param the pass to operate on @param parentRenderable the object to operate on @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to */ OgreRenderTechnique( Pass* pass, OgreRenderable* parentRenderable, OgreTechniqueGroup* parentTechniqueGroup); ~OgreRenderTechnique( ); //inherited virtual OgreRenderTechnique* asOgreRenderTechnique(){return this;} protected: /** @brief a OgreRenderable pointer to the renderable this technique operates on. */ OgreRenderable* parentOgreRenderable; /** @brief a OgreTechniqueGroup pointer to the TechniqueGroup this technique is attached to. */ OgreTechniqueGroup* parentOgreTechniqueGroup; /** @brief a pointer to the pass this technique operates on. */ Pass* pass; }; /** @brief Base abstract class for creating RenderTechnique instances. */ class RenderTechniqueFactory { protected: /** @brief function for parsing RenderTechnique attributes @param params attribute value stored in a String */ typedef void (*ILLUM_ATTRIBUTE_PARSER)(String& params, RenderTechniqueFactory* factory); /** @brief Keyword-mapped attribute parsers. */ typedef std::map AttribParserList; /** @brief map of parser functions */ AttribParserList attributeParsers; /** @brief factoryname */ String typeName; public: /** @brief Returns if this factory can create a RenderTechnique of the given type. @param type RenderTechnique type */ bool isType(String type) { return typeName == type; } /** @brief Creates a RenderTechnique of the factory type. @param params containes constructor parameters as NameValuePairList @param pass the Pass to use in RenderTechnique constructor @param pass the parentRenderable to pass to RenderTechnique constructor @param pass the parentTechniqueGroup to pass to RenderTechnique constructor */ virtual OgreRenderTechnique* createInstance(IllumTechniqueParams* params, Pass* pass, OgreRenderable* parentRenderable, OgreTechniqueGroup* parentTechniqueGroup) = 0; /** @brief parses parameters from the material file. The parsed parameters will be passed to the new RenderTechnique's constructor. @param params pointer to the IllumTechniqueParams structure that was read from the material script and containes the parameters to be parsed. */ virtual void parseParams(IllumTechniqueParams* params); };