#pragma once //disable inheritance warning caused by multiple inheritance #if _WIN32 #if _MSC_VER #pragma warning(disable: 4250) #endif #endif #include "OgreRenderTechnique.h" #include "DepthShadowRecieverRenderTechnique.h" #include "Ogre.h" using namespace Ogre; /** @brief DepthShadowRecieverRenderTechnique used in an OGRE environment. This technique defines that the object will recieve shadows with the help of depth shadow maps. Each lightsource can have a depth map assigned to it. These are going to be refreshed only if shadow recievers are visible. It is the shadow reciever technique's resposibility to refresh them. The shadows from each light are calculated in separate passes. Each pass will modulate the shaded image, so thes should be the last passes (but before caustic passes). The given Pass* parameter n the constructor defines the pass after which new shadow recieving passes will be added by the technique. */ class OgreDepthShadowRecieverRenderTechnique : public OgreRenderTechnique, public DepthShadowRecieverRenderTechnique { public: /** @brief Constructor. @param maxlights the maximum number of light sources to recieve shadow from @param shadowVertexProgram the vertex program to be used in the shadowing passes @param shadowFragmentProgram the fragment program to be used in the shadowing passes It should have one pass and the depth map of a light will be bound to the first sampler unit. @param pass the pass after which shadowing passes should be added @param parentRenderable the object to operate on @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to */ OgreDepthShadowRecieverRenderTechnique( int maxlights, String shadowVertexProgram, String shadowFragmentProgram, Pass* pass, OgreRenderable* parentRenderable, OgreTechniqueGroup* parentTechniqueGroup ); /** @brief Destructor. */ ~OgreDepthShadowRecieverRenderTechnique(); //inherited virtual void update(unsigned long frameNum); protected: /** @brief the maximum number of light sources to recieve shadow from During update the nearest light sources will be found and used. */ int maxlights; /** @brief the vertex program to be used in the shadowing passes */ String shadowVertexProgram; /** @brief the fragment program to be used in the shadowing passes It should have one pass and the depth map of a light will be bound to the first sampler unit. */ String shadowFragmentProgram; /** @breif new passes created by this technique */ std::vector passes; }; class OgreDepthShadowRecieverRenderTechniqueFactory : public RenderTechniqueFactory { public: OgreDepthShadowRecieverRenderTechniqueFactory(); OgreRenderTechnique* createInstance(IllumTechniqueParams* params, Pass* pass, OgreRenderable* parentRenderable, OgreTechniqueGroup* parentTechniqueGroup); int maxlights; String shadowVertexProgram; String shadowFragmentProgram; };