1 | #pragma once
|
---|
2 | #include "CubeMapRenderTechnique.h"
|
---|
3 |
|
---|
4 | /**
|
---|
5 | @brief Base abstract class __declspec( dllexport ) of rendering a color cube map which will be reduced.
|
---|
6 |
|
---|
7 | This technique defines that the final rendering of an object needs a reduced sized cubmap of the colors of the surrounding environment.
|
---|
8 | This reduced sized cubemap is created with averaging the original cubemap.
|
---|
9 | This reduced cubemap can easily be convolved in the final shading to acheve special effects like diffuse reflections.
|
---|
10 | */
|
---|
11 | class __declspec( dllexport ) ConvolvedCubeMapRenderTechnique : virtual public CubeMapRenderTechnique
|
---|
12 | {
|
---|
13 | public:
|
---|
14 | /**
|
---|
15 | @brief Constructor.
|
---|
16 |
|
---|
17 | @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames
|
---|
18 | @param cubeMapUpdateInterval update frequency
|
---|
19 | @param cubeMapResolution color cubemap resolution
|
---|
20 | @param reducedCubeMapResolution the resolution of the reduced cube map
|
---|
21 | @param useDistCalc flag to skip cube face update if object is far away
|
---|
22 | @param useFaceAngleCalc flag to skip cube face update if face is neglible
|
---|
23 | @param distTolerance distance tolerance used in face skip
|
---|
24 | @param angleTolerance angle tolerance used in face skip
|
---|
25 | @param updateAllFace defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
26 | @param renderSelf sets if the object should be rendered to the cube map
|
---|
27 | @param renderEnvironment sets if the environment should be rendered to the cube map
|
---|
28 | @param parentRenderable the object to operate on
|
---|
29 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
30 | */
|
---|
31 | ConvolvedCubeMapRenderTechnique( unsigned long startFrame,
|
---|
32 | unsigned long cubeMapUpdateInterval,
|
---|
33 | unsigned int cubeMapResolution,
|
---|
34 | unsigned int reducedCubeMapResolution,
|
---|
35 | bool useDistCalc,
|
---|
36 | bool useFaceAngleCalc,
|
---|
37 | float distTolerance,
|
---|
38 | float angleTolerance,
|
---|
39 | bool updateAllFace,
|
---|
40 | bool renderSelf,
|
---|
41 | bool renderEnvironment,
|
---|
42 | ElementaryRenderable* parentRenderable,
|
---|
43 | TechniqueGroup* parentTechniqueGroup
|
---|
44 | );
|
---|
45 | virtual ~ConvolvedCubeMapRenderTechnique();
|
---|
46 |
|
---|
47 | /**
|
---|
48 | @brief Updates the resources in the given frame.
|
---|
49 |
|
---|
50 | @param frameNum the actual framenumber
|
---|
51 | */
|
---|
52 | virtual void update(unsigned long frameNum);
|
---|
53 |
|
---|
54 | //inherited
|
---|
55 | void runChanged(RenderingRunType runType, RenderingRun* run);
|
---|
56 |
|
---|
57 | protected:
|
---|
58 | /**
|
---|
59 | @brief The resolution of the downsampled cubemap created by this run.
|
---|
60 | */
|
---|
61 | unsigned int reducedCubeMapResolution;
|
---|
62 | /**
|
---|
63 | @brief Called if the changed run is a ReducedCubeMapRenderingRun.
|
---|
64 |
|
---|
65 | @param run pointer to the changed ReducedCubeMapRenderingRun
|
---|
66 | */
|
---|
67 | virtual void reducedCubeMapRunChanged(RenderingRun* run) = 0;
|
---|
68 | /**
|
---|
69 | @brief Called if the changed run is a CubeMapRenderingRun (containing colors of the environment).
|
---|
70 |
|
---|
71 | @param run pointer to the changed CubeMapRenderingRun
|
---|
72 | */
|
---|
73 | virtual void colorCubeMapRunChanged(RenderingRun* run) = 0;
|
---|
74 | /**
|
---|
75 | @brief Creates a ReducedCubeMapRenderingRun.
|
---|
76 |
|
---|
77 | @return the new ReducedCubeMapRenderingRun instance.
|
---|
78 | */
|
---|
79 | virtual RenderingRun* createReducedCubeMapRun() = 0;
|
---|
80 | }; |
---|