source: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreDepthShadowRecieverRenderTechnique.h @ 2180

Revision 2180, 3.9 KB checked in by szirmay, 17 years ago (diff)
Line 
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
14using 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*/
30class OgreDepthShadowRecieverRenderTechnique : public OgreRenderTechnique,
31                                                                                public DepthShadowRecieverRenderTechnique
32{
33public:
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                                                        String WorldViewProjParamName,
50                                                        String WorldParamName,
51                                                        bool setLightViewMatrix,
52                                                        bool setLightViewProjMatrix,
53                                                        bool setLightProjFarPlane,
54                                                        String lightViewProjParamName,
55                                                        String lightViewParamName,
56                                                        String lightFarPlaneParamName,
57                                                        Pass* pass,
58                                                        OgreRenderable* parentRenderable,
59                                                        OgreTechniqueGroup* parentTechniqueGroup
60                                                        );
61        /**
62                @brief Destructor.
63        */
64        ~OgreDepthShadowRecieverRenderTechnique();
65       
66        //inherited
67        virtual void update(unsigned long frameNum);
68       
69protected:     
70        /**
71                @brief  the maximum number of light sources to recieve shadow from
72
73                During update the nearest light sources will be found and used.
74        */
75        int maxlights;
76        /**
77                @brief the vertex program to be used in the shadowing passes
78        */
79        String shadowVertexProgram;
80        /**
81                @brief the fragment program to be used in the shadowing passes
82                                                                               
83                It should have one pass and the depth map of a light will be bound to the first sampler unit.
84        */
85        String shadowFragmentProgram;
86        /**
87                @breif new passes created by this technique
88        */
89        std::vector<Pass*> passes;
90        bool setLightViewMatrix;
91        bool setLightViewProjMatrix;
92        bool setLightProjFarPlane;
93        String lightViewProjParamName;
94        String lightViewParamName;
95        String lightFarPlaneParamName;
96        String WorldViewProjParamName;
97        String WorldParamName;
98                                                                                               
99};
100
101
102class OgreDepthShadowRecieverRenderTechniqueFactory : public RenderTechniqueFactory
103{
104public:
105       
106        OgreDepthShadowRecieverRenderTechniqueFactory();
107
108        OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
109                                                                                Pass* pass,
110                                                                                OgreRenderable* parentRenderable,
111                                                                                OgreTechniqueGroup* parentTechniqueGroup);
112
113
114        int maxlights;
115        String shadowVertexProgram;
116        String shadowFragmentProgram;
117        bool setLightViewMatrix;
118        bool setLightViewProjMatrix;
119        bool setLightProjFarPlane;
120        String lightViewProjParamName;
121        String lightViewParamName;
122        String lightFarPlaneParamName;
123        String WorldViewProjParamName;
124        String WorldParamName;
125};
126
Note: See TracBrowser for help on using the repository browser.