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 "CausticCasterRenderTechnique.h"
|
---|
12 |
|
---|
13 | /**
|
---|
14 | @brief CausticCasterRenderTechnique used in an OGRE environment.
|
---|
15 | */
|
---|
16 | class OgreCausticCasterRenderTechnique : public OgreRenderTechnique,
|
---|
17 | public CausticCasterRenderTechnique
|
---|
18 | {
|
---|
19 | public:
|
---|
20 | /**
|
---|
21 | @brief Constructor.
|
---|
22 |
|
---|
23 | @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames
|
---|
24 | @param photonMapUpdateInterval photon map and caustic cubemap update frequency
|
---|
25 | @param photonMapResolution photon map resolution
|
---|
26 | @param causticCubeMapResolution caustic cubemap resolution
|
---|
27 | @param photonMapMaterialName the name of the material should be used when rendering the photon hit map
|
---|
28 | @param causticMapMaterialName the name of the material that should be used when rendering the caustic cubemap
|
---|
29 | @param photonMapTexID the texture unit state id of the caustic map generation material where the photonhit map should be bound to
|
---|
30 | @param updateAllFace defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
31 | @param useDistance tells if a distance cubemap impostor should be used in photon hit calculation (recommended)
|
---|
32 | @param attenuation attenuation distance of the caustic
|
---|
33 | @param useTriangles sets if triangles should be rendered into the caustic cubemap instead of sprites
|
---|
34 | @param blurCauCubeMap sets if the caustic cubemap should be blurred (recommended if rendering caustic triangles)
|
---|
35 | @param pass the pass to operate on
|
---|
36 | @param parentRenderable the object to operate on
|
---|
37 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
38 | */
|
---|
39 | OgreCausticCasterRenderTechnique( unsigned long startFrame,
|
---|
40 | unsigned long photonMapUpdateInterval,
|
---|
41 | unsigned int photonMapResolution,
|
---|
42 | unsigned int causticCubeMapResolution,
|
---|
43 | String photonMapMaterialName,
|
---|
44 | String causticMapMaterialName,
|
---|
45 | unsigned char photonMapTexID,
|
---|
46 | bool updateAllFace,
|
---|
47 | bool useDistance,
|
---|
48 | float attenuation,
|
---|
49 | bool useTriangles,
|
---|
50 | bool blurCauCubeMap,
|
---|
51 | Pass* pass,
|
---|
52 | OgreRenderable* parentRenderable,
|
---|
53 | OgreTechniqueGroup* parentTechniqueGroup
|
---|
54 | );
|
---|
55 | /**
|
---|
56 | @brief Destructor.
|
---|
57 | */
|
---|
58 | virtual ~OgreCausticCasterRenderTechnique();
|
---|
59 | /**
|
---|
60 | @brief Returns the name of the created caustic cubemap.
|
---|
61 |
|
---|
62 | @return name of the caustic cubemap texture
|
---|
63 | */
|
---|
64 | const String& getCausticCubeMapName();
|
---|
65 | /**
|
---|
66 | @see attenuation
|
---|
67 | */
|
---|
68 | float getAttenuation(){return attenuation;}
|
---|
69 |
|
---|
70 | protected:
|
---|
71 |
|
---|
72 | /**
|
---|
73 | @brief name of the created photon hit map texture
|
---|
74 | */
|
---|
75 | String photonMapMaterialName;
|
---|
76 | /**
|
---|
77 | @brief name of the created caustic cubemap texture
|
---|
78 | */
|
---|
79 | String causticMapMaterialName;
|
---|
80 | /**
|
---|
81 | @brief the texture unit state id of the caustic map generation material where the photonhit map should be bound to.
|
---|
82 | */
|
---|
83 | unsigned char photonMapTexID;
|
---|
84 | /**
|
---|
85 | @brief attenuation distance of the caustic
|
---|
86 | */
|
---|
87 | float attenuation;
|
---|
88 | /**
|
---|
89 | @brief sets if triangles should be rendered into the caustic cubemap instead of sprites
|
---|
90 | */
|
---|
91 | bool useTriangles;
|
---|
92 | /**
|
---|
93 | @brief sets if the caustic cubemap should be blurred (recommended if rendering caustic triangles)
|
---|
94 | */
|
---|
95 | bool blurCauCubeMap;
|
---|
96 |
|
---|
97 | //inherited
|
---|
98 | void photonMapRunChanged(RenderingRun* run);
|
---|
99 | //inherited
|
---|
100 | void causticCubeMapRunChanged(RenderingRun* run);
|
---|
101 | //inherited
|
---|
102 | void distanceCubeMapRunChanged(RenderingRun* run);
|
---|
103 | //inherited
|
---|
104 | void distanceCubeMapRunUpdated(RenderingRun* run);
|
---|
105 | //inherited
|
---|
106 | RenderingRun* createPhotonMapRun();
|
---|
107 | //inherited
|
---|
108 | RenderingRun* createCausticCubeMapRun();
|
---|
109 | //inherited
|
---|
110 | RenderingRun* createDistanceCubeMapRun();
|
---|
111 | };
|
---|
112 |
|
---|
113 | /**
|
---|
114 | @brief RenderTechniqueFactory to create OgreCausticCasterRenderTechnique instances.
|
---|
115 | */
|
---|
116 | class OgreCausticCasterRenderTechniqueFactory : public RenderTechniqueFactory
|
---|
117 | {
|
---|
118 | public:
|
---|
119 |
|
---|
120 | OgreCausticCasterRenderTechniqueFactory();
|
---|
121 |
|
---|
122 | OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
|
---|
123 | Pass* pass,
|
---|
124 | OgreRenderable* parentRenderable,
|
---|
125 | OgreTechniqueGroup* parentTechniqueGroup);
|
---|
126 |
|
---|
127 |
|
---|
128 | float attenuation;
|
---|
129 | unsigned long startFrame;
|
---|
130 | unsigned long photonMapUpdateInterval;
|
---|
131 | unsigned int photonMapResolution;
|
---|
132 | unsigned int causticCubeMapResolution;
|
---|
133 | String photonMapMaterialName;
|
---|
134 | String causticMapMaterialName;
|
---|
135 | unsigned char photonMapTexID;
|
---|
136 | bool updateAllFace;
|
---|
137 | bool useDistance;
|
---|
138 | bool useTriangles;
|
---|
139 | bool blurCauCubeMap;
|
---|
140 | };
|
---|