source: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreDepthShadowReceiverRenderTechnique.h @ 2299

Revision 2299, 6.1 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 "DepthShadowReceiverRenderTechnique.h"
12#include "Ogre.h"
13
14using namespace Ogre;
15
16/**
17        @brief DepthShadowReceiverRenderTechnique 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 receivers are visible. It is the shadow receiver 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 OgreDepthShadowReceiverRenderTechnique : public OgreRenderTechnique,
31                                                                                public DepthShadowReceiverRenderTechnique
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 WorldViewProjParamName   the name of the gpu program parameter the world-view-projection matrix should be bound to
42                @param WorldParamName                   the name of the gpu program parameter the world matrix should be bound to
43                @param setLightViewMatrix               bound light space view matrix to a gpu program parameter
44                @param setLightViewProjMatrix   bound light space view-projection matrix to a gpu program parameter
45                @param setLightProjFarPlane             bound light space projection far plane to a gpu program parameter
46                @param lightViewProjParamName   the name of the gpu program parameter the light space view-projection matrix should be bound to
47                @param lightViewParamName       the name of the gpu program parameter the light space view matrix should be bound to
48                @param lightFarPlaneParamName   the name of the gpu program parameter the light space projection far plane should be bound to
49                @param passBlendingSRC                          source blend factor of the new passes
50                @param passBlendingDEST                         destination blend factor of the new passes
51                @param pass                                             the pass after which shadowing passes should be added
52                @param parentRenderable                 the object to operate on
53                @param parentTechniqueGroup             the TechniqueGroup this RenderedTechnique is attached to
54        */
55        OgreDepthShadowReceiverRenderTechnique(
56                                                        int maxlights,
57                                                        String shadowVertexProgram,
58                                                        String shadowFragmentProgram,
59                                                        String WorldViewProjParamName,
60                                                        String WorldParamName,
61                                                        bool setLightViewMatrix,
62                                                        bool setLightViewProjMatrix,
63                                                        bool setLightProjFarPlane,
64                                                        String lightViewProjParamName,
65                                                        String lightViewParamName,
66                                                        String lightFarPlaneParamName,
67                                                        SceneBlendFactor passBlendingSRC,
68                                                        SceneBlendFactor passBlendingDEST,
69                                                        Pass* pass,
70                                                        OgreRenderable* parentRenderable,
71                                                        OgreTechniqueGroup* parentTechniqueGroup
72                                                        );
73        /**
74                @brief Destructor.
75        */
76        ~OgreDepthShadowReceiverRenderTechnique();
77       
78        //inherited
79        virtual void update(unsigned long frameNum);
80       
81protected:     
82        /**
83                @brief  the maximum number of light sources to recieve shadow from
84
85                During update the nearest light sources will be found and used.
86        */
87        int maxlights;
88        /**
89                @brief the vertex program to be used in the shadowing passes
90        */
91        String shadowVertexProgram;
92        /**
93                @brief the fragment program to be used in the shadowing passes
94                                                                               
95                It should have one pass and the depth map of a light will be bound to the first sampler unit.
96        */
97        String shadowFragmentProgram;
98        /**
99                @breif new passes created by this technique
100        */
101        std::vector<Pass*> passes;
102        /**
103                @brief bound light space view matrix to a gpu program parameter
104        */
105        bool setLightViewMatrix;
106        /**
107                @brief bound light space view-projection matrix to a gpu program parameter
108        */
109        bool setLightViewProjMatrix;
110        /**
111                @brief bound light space projection far plane to a gpu program parameter
112        */
113        bool setLightProjFarPlane;
114        /**
115                @brief the name of the gpu program parameter the light space view-projection matrix should be bound to
116        */
117        String lightViewProjParamName;
118        /**
119                @brief the name of the gpu program parameter the light space view matrix should be bound to
120        */
121        String lightViewParamName;
122        /**
123                @brief the name of the gpu program parameter the light space projection far plane should be bound to
124        */
125        String lightFarPlaneParamName;
126        /**
127                @brief the name of the gpu program parameter the world-view-projection matrix should be bound to
128        */     
129        String WorldViewProjParamName;
130        /**
131                @brief the name of the gpu program parameter the world matrix should be bound to
132        */
133        String WorldParamName;
134        /**
135                @brief source blend factor of the new passes
136        */
137        SceneBlendFactor passBlendingSRC;
138        /**
139                @brief destination blend factor of the new passes
140        */
141        SceneBlendFactor passBlendingDEST;                                                                                     
142};
143
144/**
145        @brief RenderTechniqueFactory to create OgreDepthShadowReceiverRenderTechnique instances.
146*/
147class OgreDepthShadowReceiverRenderTechniqueFactory : public RenderTechniqueFactory
148{
149public:
150       
151        OgreDepthShadowReceiverRenderTechniqueFactory();
152
153        OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
154                                                                                Pass* pass,
155                                                                                OgreRenderable* parentRenderable,
156                                                                                OgreTechniqueGroup* parentTechniqueGroup);
157
158
159        int maxlights;
160        String shadowVertexProgram;
161        String shadowFragmentProgram;
162        bool setLightViewMatrix;
163        bool setLightViewProjMatrix;
164        bool setLightProjFarPlane;
165        String lightViewProjParamName;
166        String lightViewParamName;
167        String lightFarPlaneParamName;
168        String WorldViewProjParamName;
169        String WorldParamName;
170        SceneBlendFactor passBlendingSRC;
171        SceneBlendFactor passBlendingDEST;
172};
173
Note: See TracBrowser for help on using the repository browser.