#pragma once //disable inheritance warning caused by multiple inheritance #if _WIN32 #if _MSC_VER #pragma warning(disable: 4250) #endif #endif #include "OgreRenderTechnique.h" #include "CausticReceiverRenderTechnique.h" #include "Ogre.h" using namespace Ogre; /** @brief CausticReceiverRenderTechnique used in an OGRE environment. This technique defines that the object will recieve caustic lighting from caustic caster objects. The caustic light spots will be calculated by the caustic caster's RenderingRuns. These runs will only be updated if caustic redievers are visible, so it is the receiver technique's responsibility to update them. Each caustic caster's light contribution will be added in separate passes. Each pass will add some light to the shaded image, so these passes should be the last passes. In the constructor the given Pass* parameter will be the pass after which the caustic lighting passes will be added by the technique. */ class OgreCausticReceiverRenderTechnique : public OgreRenderTechnique, public CausticReceiverRenderTechnique { public: /** @brief Constructor. @param maxcasters the maximum number of caustic casters from which this receiver can recieve caustic light @param causticVertexProgram the vertex program to be used in the caustic gathering passes @param causticFragmentProgram the fragment program to be used in the caustic gathering passes. It should have one pass and the caustic cubemap of a caster will be bound to the first sampler unit. @param passBlendingSRC source blend factor of the new passes @param passBlendingDEST destination blend factor of the new passes @param pass the pass after which caustic gathering passes should be added @param parentRenderable the object to operate on @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to */ OgreCausticReceiverRenderTechnique( int maxcasters, String causticVertexProgram, String causticFragmentProgram, SceneBlendFactor passBlendingSRC, SceneBlendFactor passBlendingDEST, Pass* pass, OgreRenderable* parentRenderable, OgreTechniqueGroup* parentTechniqueGroup ); /** @brief Destructor. */ ~OgreCausticReceiverRenderTechnique(); //inherited virtual void update(unsigned long frameNum); protected: /** @brief the maximum number of caustic casters from which this receiver can recieve caustic light */ int maxcasters; /** @brief the vertex program to be used in the caustic gathering passes */ String causticVertexProgram; /** @brief the fragment program to be used in the caustic gathering passes It should have one pass and the caustic cubemap of a caster will be bound to the first sampler unit. */ String causticFragmentProgram; /** @breif new passes created by this technique */ std::vector passes; /** @brief the nearest caustic casters found during update */ std::vector causticCasters; /** @brief source blend factor of the new passes */ SceneBlendFactor passBlendingSRC; /** @brief destination blend factor of the new passes */ SceneBlendFactor passBlendingDEST; }; /** @brief RenderTechniqueFactory to create OgreCausticReceiverRenderTechnique instances. */ class OgreCausticReceiverRenderTechniqueFactory : public RenderTechniqueFactory { public: OgreCausticReceiverRenderTechniqueFactory(); OgreRenderTechnique* createInstance(IllumTechniqueParams* params, Pass* pass, OgreRenderable* parentRenderable, OgreTechniqueGroup* parentTechniqueGroup); int maxcasters; String causticVertexProgram; String causticFragmentProgram; SceneBlendFactor passBlendingSRC; SceneBlendFactor passBlendingDEST; };