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 "CausticRecieverRenderTechnique.h"
|
---|
12 | #include "Ogre.h"
|
---|
13 |
|
---|
14 | using namespace Ogre;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | @brief CausticRecieverRenderTechnique 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 reciever 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 | */
|
---|
29 | class OgreCausticRecieverRenderTechnique : public OgreRenderTechnique,
|
---|
30 | public CausticRecieverRenderTechnique
|
---|
31 | {
|
---|
32 | public:
|
---|
33 | /**
|
---|
34 | @brief Constructor.
|
---|
35 |
|
---|
36 | @param maxcasters the maximum number of caustic casters from which this reciever 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 pass the pass after which caustic gathering passes should be added
|
---|
41 | @param parentRenderable the object to operate on
|
---|
42 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
43 | */
|
---|
44 | OgreCausticRecieverRenderTechnique(
|
---|
45 | int maxcasters,
|
---|
46 | String causticVertexProgram,
|
---|
47 | String causticFragmentProgram,
|
---|
48 | Pass* pass,
|
---|
49 | OgreRenderable* parentRenderable,
|
---|
50 | OgreTechniqueGroup* parentTechniqueGroup
|
---|
51 | );
|
---|
52 | /**
|
---|
53 | @brief Destructor.
|
---|
54 | */
|
---|
55 | ~OgreCausticRecieverRenderTechnique();
|
---|
56 |
|
---|
57 | //inherited
|
---|
58 | virtual void update(unsigned long frameNum);
|
---|
59 |
|
---|
60 | protected:
|
---|
61 | /**
|
---|
62 | @brief the maximum number of caustic casters from which this reciever can recieve caustic light
|
---|
63 | */
|
---|
64 | int maxcasters;
|
---|
65 | /**
|
---|
66 | @brief the vertex program to be used in the caustic gathering passes
|
---|
67 | */
|
---|
68 | String causticVertexProgram;
|
---|
69 | /**
|
---|
70 | @brief the fragment program to be used in the caustic gathering passes
|
---|
71 |
|
---|
72 | It should have one pass and the caustic cubemap of a caster will be bound to the first sampler unit.
|
---|
73 | */
|
---|
74 | String causticFragmentProgram;
|
---|
75 | /**
|
---|
76 | @breif new passes created by this technique
|
---|
77 | */
|
---|
78 | std::vector<Pass*> passes;
|
---|
79 | /**
|
---|
80 | @brief the nearest caustic casters found during update
|
---|
81 | */
|
---|
82 | std::vector<OgreSharedRuns*> causticCasters;
|
---|
83 |
|
---|
84 | };
|
---|
85 |
|
---|
86 | class OgreCausticRecieverRenderTechniqueFactory : public RenderTechniqueFactory
|
---|
87 | {
|
---|
88 | public:
|
---|
89 |
|
---|
90 | OgreCausticRecieverRenderTechniqueFactory();
|
---|
91 |
|
---|
92 | OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
|
---|
93 | Pass* pass,
|
---|
94 | OgreRenderable* parentRenderable,
|
---|
95 | OgreTechniqueGroup* parentTechniqueGroup);
|
---|
96 |
|
---|
97 |
|
---|
98 | int maxcasters;
|
---|
99 | String causticVertexProgram;
|
---|
100 | String causticFragmentProgram;
|
---|
101 |
|
---|
102 | };
|
---|
103 |
|
---|