1 | #pragma once
|
---|
2 | #include "RenderingRun.h"
|
---|
3 |
|
---|
4 | /**
|
---|
5 | @brief Base abstract class __declspec( dllexport ) that defines a rendering process of a downsampled color-cubemap.
|
---|
6 |
|
---|
7 | The resulting cubemap is a lower resolution variation of the color cube map. It is created with averaging the original cubemap.
|
---|
8 | The lower resolution cubemap can be convolved faster and can efficiently be used in effects like diffuse reflection.
|
---|
9 | */
|
---|
10 | class __declspec( dllexport ) ReducedCubeMapRenderingRun : virtual public RenderingRun
|
---|
11 | {
|
---|
12 | public:
|
---|
13 | /**
|
---|
14 | @brief Constructor.
|
---|
15 |
|
---|
16 | @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames
|
---|
17 | @param updateInterval update frequency
|
---|
18 | @param resolution reduced cubemap resolution
|
---|
19 | @param useDistCalc flag to skip cube face update if object is far away
|
---|
20 | @param useFaceAngleCalc flag to skip cube face update if face is neglible
|
---|
21 | @param distTolerance distance tolerance used in face skip
|
---|
22 | @param angleTolerance angle tolerance used in face skip
|
---|
23 | @param updateAllFace defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
24 | */
|
---|
25 | ReducedCubeMapRenderingRun(unsigned long startFrame,
|
---|
26 | unsigned long updateInterval,
|
---|
27 | unsigned int resolution,
|
---|
28 | bool useDistCalc,
|
---|
29 | bool useFaceAngleCalc,
|
---|
30 | float distTolerance,
|
---|
31 | float angleTolerance,
|
---|
32 | bool updateAllFace);
|
---|
33 |
|
---|
34 |
|
---|
35 | virtual ~ReducedCubeMapRenderingRun(){}
|
---|
36 |
|
---|
37 | protected:
|
---|
38 | /**
|
---|
39 | @brief defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
40 | */
|
---|
41 | bool updateAllFace;
|
---|
42 | /**
|
---|
43 | @brief the number of the face to be updated
|
---|
44 | */
|
---|
45 | unsigned char currentFace;
|
---|
46 | /**
|
---|
47 | @brief the resolution of the cubemap texture that was created by this run
|
---|
48 | */
|
---|
49 | unsigned int resolution;
|
---|
50 | /**
|
---|
51 | @brief a flag to skip cube face update if object is far away or too small.
|
---|
52 |
|
---|
53 | @see distTolerance
|
---|
54 | */
|
---|
55 | bool useDistCalc;
|
---|
56 | /**
|
---|
57 | @brief a flag to skip cube face update the face is neglible.
|
---|
58 |
|
---|
59 | @see angleTolerance
|
---|
60 | */
|
---|
61 | bool useFaceAngleCalc;
|
---|
62 | /**
|
---|
63 | @brief A value used in face skip test.
|
---|
64 |
|
---|
65 | The higher this value gets the more precise, but slower the method will be.
|
---|
66 | */
|
---|
67 | float distTolerance;
|
---|
68 | /**
|
---|
69 | @brief A value used in face skip test.
|
---|
70 |
|
---|
71 | The higher this value gets the more precise, but slower the method will be.
|
---|
72 | */
|
---|
73 | float angleTolerance;
|
---|
74 |
|
---|
75 | /**
|
---|
76 | @brief Creates the reduced size cubemap texture.
|
---|
77 | */
|
---|
78 | virtual inline void createReducedCubeMap() = 0;
|
---|
79 | /**
|
---|
80 | @brief Updates one face of the cubemap.
|
---|
81 |
|
---|
82 | @param facenum the number of the face to be updated
|
---|
83 | */
|
---|
84 | virtual inline void updateCubeFace(int facenum) = 0;
|
---|
85 | /**
|
---|
86 | @brief Checks if a cubemap face needs to be updated.
|
---|
87 |
|
---|
88 | If the object we are updating the cubemap for is far from the camera, or too small, or
|
---|
89 | the given cubemapface does not have significant effect on the rendering the face can be skipped.
|
---|
90 |
|
---|
91 | @param facenum the number of the face to be checked
|
---|
92 | */
|
---|
93 | virtual bool faceNeedsUpdate(int facenum) = 0;
|
---|
94 | //inherited
|
---|
95 | virtual void updateFrame(unsigned long frameNum);
|
---|
96 |
|
---|
97 | };
|
---|