[790] | 1 | #pragma once
|
---|
| 2 |
|
---|
| 3 | //disable inheritance warning caused by multiple inheritance
|
---|
| 4 | #if _WIN32
|
---|
| 5 | #if _MSC_VER
|
---|
| 6 | #pragma warning(disable: 4250)
|
---|
| 7 | #endif
|
---|
| 8 | #endif
|
---|
| 9 |
|
---|
| 10 | #include "OgreRenderTechnique.h"
|
---|
| 11 | #include "DepthShadowRecieverRenderTechnique.h"
|
---|
| 12 | #include "Ogre.h"
|
---|
| 13 |
|
---|
| 14 | using namespace Ogre;
|
---|
| 15 |
|
---|
| 16 | /**
|
---|
| 17 | @brief DepthShadowRecieverRenderTechnique used in an OGRE environment.
|
---|
| 18 |
|
---|
| 19 | This technique defines that the object will recieve shadows with the help of depth shadow maps.
|
---|
| 20 | Each lightsource can have a depth map assigned to it. These are going to be refreshed only
|
---|
| 21 | if shadow recievers are visible. It is the shadow reciever technique's resposibility
|
---|
| 22 | to refresh them.
|
---|
| 23 |
|
---|
| 24 | The shadows from each light are calculated in separate passes. Each pass will
|
---|
| 25 | modulate the shaded image, so thes should be the last passes (but before caustic passes).
|
---|
| 26 | The given Pass* parameter n the constructor defines the pass after which new
|
---|
| 27 | shadow recieving passes will be added by the technique.
|
---|
| 28 |
|
---|
| 29 | */
|
---|
| 30 | class OgreDepthShadowRecieverRenderTechnique : public OgreRenderTechnique,
|
---|
| 31 | public DepthShadowRecieverRenderTechnique
|
---|
| 32 | {
|
---|
| 33 | public:
|
---|
| 34 | /**
|
---|
| 35 | @brief Constructor.
|
---|
| 36 |
|
---|
| 37 | @param maxlights the maximum number of light sources to recieve shadow from
|
---|
| 38 | @param shadowVertexProgram the vertex program to be used in the shadowing passes
|
---|
| 39 | @param shadowFragmentProgram the fragment program to be used in the shadowing passes
|
---|
| 40 | It should have one pass and the depth map of a light will be bound to the first sampler unit.
|
---|
| 41 | @param pass the pass after which shadowing passes should be added
|
---|
| 42 | @param parentRenderable the object to operate on
|
---|
| 43 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
| 44 | */
|
---|
| 45 | OgreDepthShadowRecieverRenderTechnique(
|
---|
| 46 | int maxlights,
|
---|
| 47 | String shadowVertexProgram,
|
---|
| 48 | String shadowFragmentProgram,
|
---|
| 49 | Pass* pass,
|
---|
| 50 | OgreRenderable* parentRenderable,
|
---|
| 51 | OgreTechniqueGroup* parentTechniqueGroup
|
---|
| 52 | );
|
---|
| 53 | /**
|
---|
| 54 | @brief Destructor.
|
---|
| 55 | */
|
---|
| 56 | ~OgreDepthShadowRecieverRenderTechnique();
|
---|
| 57 |
|
---|
| 58 | //inherited
|
---|
| 59 | virtual void update(unsigned long frameNum);
|
---|
| 60 |
|
---|
| 61 | protected:
|
---|
| 62 | /**
|
---|
| 63 | @brief the maximum number of light sources to recieve shadow from
|
---|
| 64 |
|
---|
| 65 | During update the nearest light sources will be found and used.
|
---|
| 66 | */
|
---|
| 67 | int maxlights;
|
---|
| 68 | /**
|
---|
| 69 | @brief the vertex program to be used in the shadowing passes
|
---|
| 70 | */
|
---|
| 71 | String shadowVertexProgram;
|
---|
| 72 | /**
|
---|
| 73 | @brief the fragment program to be used in the shadowing passes
|
---|
| 74 |
|
---|
| 75 | It should have one pass and the depth map of a light will be bound to the first sampler unit.
|
---|
| 76 | */
|
---|
| 77 | String shadowFragmentProgram;
|
---|
| 78 | /**
|
---|
| 79 | @breif new passes created by this technique
|
---|
| 80 | */
|
---|
| 81 | std::vector<Pass*> passes;
|
---|
| 82 | };
|
---|
[836] | 83 |
|
---|
| 84 |
|
---|
| 85 | class OgreDepthShadowRecieverRenderTechniqueFactory : public RenderTechniqueFactory
|
---|
| 86 | {
|
---|
| 87 | public:
|
---|
| 88 |
|
---|
| 89 | OgreDepthShadowRecieverRenderTechniqueFactory();
|
---|
| 90 |
|
---|
| 91 | OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
|
---|
| 92 | Pass* pass,
|
---|
| 93 | OgreRenderable* parentRenderable,
|
---|
| 94 | OgreTechniqueGroup* parentTechniqueGroup);
|
---|
| 95 |
|
---|
| 96 |
|
---|
| 97 | int maxlights;
|
---|
| 98 | String shadowVertexProgram;
|
---|
| 99 | String shadowFragmentProgram;
|
---|
| 100 |
|
---|
| 101 | };
|
---|
| 102 |
|
---|