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 choton 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 pass the pass to operate on
|
---|
33 | @param parentRenderable the object to operate on
|
---|
34 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
35 | */
|
---|
36 | OgreCausticCasterRenderTechnique( unsigned long startFrame,
|
---|
37 | unsigned long photonMapUpdateInterval,
|
---|
38 | unsigned int photonMapResolution,
|
---|
39 | unsigned int custicCubeMapResolution,
|
---|
40 | String photonMapMaterialName,
|
---|
41 | String causticMapMaterialName,
|
---|
42 | unsigned char photonMapTexID,
|
---|
43 | bool updateAllFace,
|
---|
44 | bool useDistance,
|
---|
45 | float attenuation,
|
---|
46 | bool useTriangles,
|
---|
47 | bool blurCauCubeMap,
|
---|
48 | Pass* pass,
|
---|
49 | OgreRenderable* parentRenderable,
|
---|
50 | OgreTechniqueGroup* parentTechniqueGroup
|
---|
51 | );
|
---|
52 | /**
|
---|
53 | @brief Destructor.
|
---|
54 | */
|
---|
55 | ~OgreCausticCasterRenderTechnique();
|
---|
56 | /**
|
---|
57 | @brief Returns the name of the created caustic cubemap.
|
---|
58 |
|
---|
59 | @return name of the caustic cubemap texture
|
---|
60 | */
|
---|
61 | const String& getCausticCubeMapName();
|
---|
62 | float getAttenuation(){return attenuation;}
|
---|
63 |
|
---|
64 | protected:
|
---|
65 |
|
---|
66 | /**
|
---|
67 | @brief name of the created photon hit map texture
|
---|
68 | */
|
---|
69 | String photonMapMaterialName;
|
---|
70 | /**
|
---|
71 | @brief name of the created caustic cubemap texture
|
---|
72 | */
|
---|
73 | String causticMapMaterialName;
|
---|
74 | /**
|
---|
75 | @brief the texture unit state id of the caustic map generation material where the photonhit map should be bound to.
|
---|
76 | */
|
---|
77 | unsigned char photonMapTexID;
|
---|
78 | float attenuation;
|
---|
79 | bool useTriangles;
|
---|
80 | bool blurCauCubeMap;
|
---|
81 |
|
---|
82 | //inherited
|
---|
83 | void photonMapRunChanged(RenderingRun* run);
|
---|
84 | //inherited
|
---|
85 | void causticCubeMapRunChanged(RenderingRun* run);
|
---|
86 | //inherited
|
---|
87 | void distanceCubeMapRunChanged(RenderingRun* run);
|
---|
88 | //inherited
|
---|
89 | void distanceCubeMapRunUpdated(RenderingRun* run);
|
---|
90 | //inherited
|
---|
91 | RenderingRun* createPhotonMapRun();
|
---|
92 | //inherited
|
---|
93 | RenderingRun* createCausticCubeMapRun();
|
---|
94 | //inherited
|
---|
95 | RenderingRun* createDistanceCubeMapRun();
|
---|
96 | };
|
---|
97 |
|
---|
98 |
|
---|
99 | class OgreCausticCasterRenderTechniqueFactory : public RenderTechniqueFactory
|
---|
100 | {
|
---|
101 | public:
|
---|
102 |
|
---|
103 | OgreCausticCasterRenderTechniqueFactory();
|
---|
104 |
|
---|
105 | OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
|
---|
106 | Pass* pass,
|
---|
107 | OgreRenderable* parentRenderable,
|
---|
108 | OgreTechniqueGroup* parentTechniqueGroup);
|
---|
109 |
|
---|
110 |
|
---|
111 | float attenuation;
|
---|
112 | unsigned long startFrame;
|
---|
113 | unsigned long photonMapUpdateInterval;
|
---|
114 | unsigned int photonMapResolution;
|
---|
115 | unsigned int causticCubeMapResolution;
|
---|
116 | String photonMapMaterialName;
|
---|
117 | String causticMapMaterialName;
|
---|
118 | unsigned char photonMapTexID;
|
---|
119 | bool updateAllFace;
|
---|
120 | bool useDistance;
|
---|
121 | bool useTriangles;
|
---|
122 | bool blurCauCubeMap;
|
---|
123 |
|
---|
124 |
|
---|
125 | };
|
---|