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 "OgreRenderingRun.h"
|
---|
11 | #include "CausticCubeMapRenderingRun.h"
|
---|
12 | #include "OgreSharedRuns.h"
|
---|
13 |
|
---|
14 |
|
---|
15 | /**
|
---|
16 | @brief CausticCubeMapRenderingRun used in an OGRE environment.
|
---|
17 | */
|
---|
18 | class OgreCausticCubeMapRenderingRun : public OgreRenderingRun,
|
---|
19 | public CausticCubeMapRenderingRun
|
---|
20 | {
|
---|
21 | public:
|
---|
22 |
|
---|
23 | /**
|
---|
24 | @brief Constructor.
|
---|
25 |
|
---|
26 | @param sharedRuns a pointer to the OgreSharedRuns this run belongs to
|
---|
27 | @param name the name of the cubemap texture to be created
|
---|
28 | @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames
|
---|
29 | @param updateInterval update frequency
|
---|
30 | @param resolution cubemap resolution
|
---|
31 | @param materialName the name of the material that should be used when rendering the caustic cubemap
|
---|
32 | @param photonMapTexId the texture unit state id of the caustic map generation material where the photonhit map should be bound to
|
---|
33 | @param updateAllFace defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
34 | @param attenuation attenuation distance of the caustic
|
---|
35 | @param useTriangles sets if triangles should be rendered into the caustic cubemap instead of sprites
|
---|
36 | @param blurMap sets if the caustic cubemap should be blurred (recommended if rendering caustic triangles)
|
---|
37 | */
|
---|
38 | OgreCausticCubeMapRenderingRun(OgreSharedRuns* sharedRuns,
|
---|
39 | String name,
|
---|
40 | unsigned long startFrame,
|
---|
41 | unsigned long updateInterval,
|
---|
42 | unsigned int resolution,
|
---|
43 | String materialName,
|
---|
44 | unsigned char photonMapTexId,
|
---|
45 | bool updateAllFace,
|
---|
46 | float attenuation,
|
---|
47 | bool useTriangles,
|
---|
48 | bool blurMap
|
---|
49 | );
|
---|
50 |
|
---|
51 | virtual ~OgreCausticCubeMapRenderingRun(){}
|
---|
52 | /**
|
---|
53 | @brief returns the name of the resulting caustic cubemap texture
|
---|
54 | */
|
---|
55 | const String& getCausticCubeMapTextureName()
|
---|
56 | {
|
---|
57 | if(blurMap)
|
---|
58 | return bluredCausticCubemapTexture->getName();
|
---|
59 | else
|
---|
60 | return name;
|
---|
61 | }
|
---|
62 |
|
---|
63 | //inherited
|
---|
64 | void photonMapChanged(RenderingRun* run);
|
---|
65 | /**
|
---|
66 | @see attenuation
|
---|
67 | */
|
---|
68 | float getAttenuation(){return attenuation;}
|
---|
69 | //inherited
|
---|
70 | bool canJoin(RenderingRun* run)
|
---|
71 | {
|
---|
72 | OgreCausticCubeMapRenderingRun* r = (OgreCausticCubeMapRenderingRun*) run->asOgreRenderingRun();
|
---|
73 | if(r->materialName == materialName)
|
---|
74 | return true;
|
---|
75 | return false;
|
---|
76 | }
|
---|
77 | /**
|
---|
78 | @see blurMap
|
---|
79 | */
|
---|
80 | void setBlurMap(bool blur){blurMap = blur;}
|
---|
81 |
|
---|
82 | void freeAllResources();
|
---|
83 |
|
---|
84 | protected:
|
---|
85 | /**
|
---|
86 | @brief the texture unit state id of the caustic map generation material where the photonhit map should be bound to
|
---|
87 | */
|
---|
88 | unsigned char photonMapTexId;
|
---|
89 | /**
|
---|
90 | @brief a pointer to the OgreSharedRuns this run belongs to
|
---|
91 | */
|
---|
92 | OgreSharedRuns* sharedRuns;
|
---|
93 | /**
|
---|
94 | @brief the name of the cubemap texture that was created by this run
|
---|
95 | */
|
---|
96 | String name;
|
---|
97 | /**
|
---|
98 | @brief a pointer to the cubemap texture that was created by this run
|
---|
99 | */
|
---|
100 | Texture* causticCubemapTexture;
|
---|
101 | /**
|
---|
102 | @brief a pointer to the blurred cubemap texture that was created by this run
|
---|
103 | */
|
---|
104 | Texture* bluredCausticCubemapTexture;
|
---|
105 | /**
|
---|
106 | @brief the name of the material that should be used when rendering the caustic cubemap
|
---|
107 | */
|
---|
108 | String materialName;
|
---|
109 | /**
|
---|
110 | @brief attenuation distance of the caustic
|
---|
111 | */
|
---|
112 | float attenuation;
|
---|
113 | /**
|
---|
114 | @brief sets if triangles should be rendered into the caustic cubemap instead of sprites
|
---|
115 | */
|
---|
116 | bool useTriangles;
|
---|
117 | /**
|
---|
118 | @brief sets if the caustic cubemap should be blurred (recommended if rendering caustic triangles)
|
---|
119 | */
|
---|
120 | bool blurMap;
|
---|
121 |
|
---|
122 | //inherited
|
---|
123 | inline void createCausticCubeMap();
|
---|
124 | //inherited
|
---|
125 | inline void updateCubeFace(int facenum);
|
---|
126 | //inherited
|
---|
127 | bool faceNeedsUpdate(int facenum);
|
---|
128 |
|
---|
129 | };
|
---|