1 | #pragma once
|
---|
2 | #include "RenderTechnique.h"
|
---|
3 |
|
---|
4 | /**
|
---|
5 | @brief Base abstract class __declspec( dllexport ) of rendering a cube map.
|
---|
6 |
|
---|
7 | This technique defines that the final rendering of an object needs a cubmap of the surrounding environment and/or the object itself.
|
---|
8 | */
|
---|
9 | class __declspec( dllexport ) CubeMapRenderTechnique : virtual public RenderTechnique
|
---|
10 | {
|
---|
11 | public:
|
---|
12 | /**
|
---|
13 | @brief Constructor.
|
---|
14 |
|
---|
15 | @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames
|
---|
16 | @param cubeMapUpdateInterval update frequency
|
---|
17 | @param cubeMapResolution color cubemap resolution
|
---|
18 | @param useDistCalc flag to skip cube face update if object is far away
|
---|
19 | @param useFaceAngleCalc flag to skip cube face update if face is neglible
|
---|
20 | @param distTolerance distance tolerance used in face skip
|
---|
21 | @param angleTolerance angle tolerance used in face skip
|
---|
22 | @param updateAllFace defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
23 | @param renderSelf sets if the object should be rendered to the cube map
|
---|
24 | @param renderEnvironment sets if the environment should be rendered to the cube map
|
---|
25 | @param layer the layer of this cubemap
|
---|
26 | @param parentRenderable the object to operate on
|
---|
27 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
28 | */
|
---|
29 | CubeMapRenderTechnique( unsigned long startFrame,
|
---|
30 | unsigned long cubeMapUpdateInterval,
|
---|
31 | unsigned int cubeMapResolution,
|
---|
32 | bool useDistCalc,
|
---|
33 | bool useFaceAngleCalc,
|
---|
34 | float distTolerance,
|
---|
35 | float angleTolerance,
|
---|
36 | bool updateAllFace,
|
---|
37 | bool renderSelf,
|
---|
38 | bool renderEnvironment,
|
---|
39 | int layer,
|
---|
40 | ElementaryRenderable* parentRenderable,
|
---|
41 | TechniqueGroup* parentTechniqueGroup
|
---|
42 | );
|
---|
43 | virtual ~CubeMapRenderTechnique();
|
---|
44 |
|
---|
45 | //inherited
|
---|
46 | void runChanged(RenderingRunType runType, RenderingRun* run);
|
---|
47 | //inherited
|
---|
48 | void runUpdated(RenderingRunType runType, RenderingRun* run);
|
---|
49 |
|
---|
50 | protected:
|
---|
51 | /**
|
---|
52 | @brief a flag to skip cube face update if object is far away or too small.
|
---|
53 |
|
---|
54 | @see distTolerance
|
---|
55 | */
|
---|
56 | bool useDistCalc;
|
---|
57 | /**
|
---|
58 | @brief a flag to skip cube face update the face is neglible.
|
---|
59 |
|
---|
60 | @see angleTolerance
|
---|
61 | */
|
---|
62 | bool useFaceAngleCalc;
|
---|
63 | /**
|
---|
64 | @brief A value used in face skip test.
|
---|
65 |
|
---|
66 | The higher this value gets the more precise, but slower the method will be.
|
---|
67 | */
|
---|
68 | float distTolerance;
|
---|
69 | /**
|
---|
70 | @brief A value used in face skip test.
|
---|
71 |
|
---|
72 | The higher this value gets the more precise, but slower the method will be.
|
---|
73 | */
|
---|
74 | float angleTolerance;
|
---|
75 | /**
|
---|
76 | @brief defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
77 | */
|
---|
78 | bool updateAllFace;
|
---|
79 | /**
|
---|
80 | @brief color-cubemap update frequency
|
---|
81 | */
|
---|
82 | unsigned long cubeMapUpdateInterval;
|
---|
83 | /**
|
---|
84 | @brief color-cubemap resolution
|
---|
85 | */
|
---|
86 | unsigned int cubeMapResolution;
|
---|
87 | /**
|
---|
88 | @brief offset in frame number used during update
|
---|
89 | */
|
---|
90 | unsigned long startFrame;
|
---|
91 | /**
|
---|
92 | @brief Sets if the object should be rendered to the cube map
|
---|
93 | */
|
---|
94 | bool renderSelf;
|
---|
95 | /**
|
---|
96 | @brief Sets if the environment should be rendered to the cube map
|
---|
97 | */
|
---|
98 | bool renderEnvironment;
|
---|
99 | /**
|
---|
100 | @brief The layer of the cubemap.
|
---|
101 |
|
---|
102 | This extension was created to achieve effect such as multiple reflections and refractions
|
---|
103 | that require more complete sampling of the scene.
|
---|
104 | With this extension we can render the environment into several cubemap layers eg. with depth peeling.
|
---|
105 | */
|
---|
106 | int layer;
|
---|
107 | /**
|
---|
108 | @brief The exact run type of this run (according to the actual layer).
|
---|
109 | */
|
---|
110 | RenderingRunType cubemapLayer;
|
---|
111 | /**
|
---|
112 | @brief Creates a CubeMapRenderingRun.
|
---|
113 |
|
---|
114 | @return the new CubeMapRenderingRun instance.
|
---|
115 | */
|
---|
116 | virtual RenderingRun* createCubeMapRun() = 0;
|
---|
117 | /**
|
---|
118 | @brief Called if the changed run is a CubeMapRenderingRun.
|
---|
119 |
|
---|
120 | @param run pointer to the new CubeMapRenderingRun
|
---|
121 | */
|
---|
122 | virtual void cubeMapRunChanged(RenderingRun* run) = 0;
|
---|
123 | /**
|
---|
124 | @brief Called if the updated run is a CubeMapRenderingRun.
|
---|
125 |
|
---|
126 | @param run pointer to the updated CubeMapRenderingRun
|
---|
127 | */
|
---|
128 | virtual void cubeMapRunUpdated(RenderingRun* run) = 0;
|
---|
129 | }; |
---|