source: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreCausticReceiverRenderTechnique.h @ 2366

Revision 2366, 4.2 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 "CausticReceiverRenderTechnique.h"
12#include "Ogre.h"
13
14using namespace Ogre;
15
16/**
17        @brief CausticReceiverRenderTechnique used in an OGRE environment.
18
19        This technique defines that the object will recieve caustic lighting from caustic caster objects.
20        The caustic light spots will be calculated by the caustic caster's RenderingRuns.
21        These runs will only be updated if caustic redievers are visible, so it is the receiver technique's
22        responsibility to update them.
23
24        Each caustic caster's light contribution will be added in separate passes. Each pass
25        will add some light to the shaded image, so these passes should be the last passes.
26        In the constructor the given Pass* parameter will be the pass after which the caustic lighting
27        passes will be added by the technique.
28*/
29class OgreCausticReceiverRenderTechnique : public OgreRenderTechnique,
30                                                                                public CausticReceiverRenderTechnique
31{
32public:
33        /**
34                @brief Constructor.
35
36                @param maxcasters                               the maximum number of caustic casters from which this receiver can recieve caustic light
37                @param causticVertexProgram             the vertex program to be used in the caustic gathering passes
38                @param causticFragmentProgram   the fragment program to be used in the caustic gathering passes.
39                                                                                It should have one pass and the caustic cubemap of a caster will be bound to the first sampler unit.
40                @param passBlendingSRC                          source blend factor of the new passes
41                @param passBlendingDEST                         destination blend factor of the new passes
42                @param pass                                             the pass after which caustic gathering passes should be added
43                @param parentRenderable                 the object to operate on
44                @param parentTechniqueGroup             the TechniqueGroup this RenderedTechnique is attached to
45        */
46        OgreCausticReceiverRenderTechnique(
47                                                        int maxcasters,
48                                                        String causticVertexProgram,
49                                                        String causticFragmentProgram,
50                                                        SceneBlendFactor passBlendingSRC,
51                                                        SceneBlendFactor passBlendingDEST,
52                                                        bool createNewPasses,
53                                                        int startTextureUnitID,
54                                                        String casterCenterVariableName,
55                                                        String attenuationVariableName,
56                                                        Pass* pass,
57                                                        OgreRenderable* parentRenderable,
58                                                        OgreTechniqueGroup* parentTechniqueGroup
59                                                        );
60        /**
61                @brief Destructor.
62        */
63        virtual ~OgreCausticReceiverRenderTechnique();
64       
65        //inherited
66        virtual void update(unsigned long frameNum);
67       
68protected:
69        /**
70                @brief the maximum number of caustic casters from which this receiver can recieve caustic light
71        */
72        int maxcasters;
73        /**
74                @brief the vertex program to be used in the caustic gathering passes
75        */
76        String causticVertexProgram;
77        /**
78                @brief the fragment program to be used in the caustic gathering passes
79
80                It should have one pass and the caustic cubemap of a caster will be bound to the first sampler unit.
81        */
82        String causticFragmentProgram;
83        /**
84                @breif new passes created by this technique
85        */
86        std::vector<Pass*> passes;
87        /**
88                @brief the nearest caustic casters found during update
89        */
90        std::vector<OgreSharedRuns*> causticCasters;
91        /**
92                @brief source blend factor of the new passes
93        */
94        SceneBlendFactor passBlendingSRC;
95        /**
96                @brief destination blend factor of the new passes
97        */
98        SceneBlendFactor passBlendingDEST;
99        bool createNewPasses;
100        int startTextureUnitID;
101        String casterCenterVariableName;
102        String attenuationVariableName;
103};
104
105/**
106        @brief RenderTechniqueFactory to create OgreCausticReceiverRenderTechnique instances.
107*/
108class OgreCausticReceiverRenderTechniqueFactory : public RenderTechniqueFactory
109{
110public:
111       
112        OgreCausticReceiverRenderTechniqueFactory();
113
114        OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
115                                                                                Pass* pass,
116                                                                                OgreRenderable* parentRenderable,
117                                                                                OgreTechniqueGroup* parentTechniqueGroup);
118
119
120        int maxcasters;
121        String causticVertexProgram;
122        String causticFragmentProgram;
123        SceneBlendFactor passBlendingSRC;
124        SceneBlendFactor passBlendingDEST;
125        bool createNewPasses;
126        int startTextureUnitID;
127        String casterCenterVariableName;
128        String attenuationVariableName;
129};
130
Note: See TracBrowser for help on using the repository browser.