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

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