1 | #pragma once
|
---|
2 | #include "RenderingRun.h"
|
---|
3 |
|
---|
4 | /**
|
---|
5 | @brief Base abstract class that defines a rendering process of a color-cubemap.
|
---|
6 |
|
---|
7 | A color cubemap is a cubemap of the colors of the surrounding environment.
|
---|
8 | */
|
---|
9 | class ColorCubeMapRenderingRun : virtual public RenderingRun
|
---|
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 updateInterval update frequency
|
---|
17 | @param resolution 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 |
|
---|
24 | */
|
---|
25 | ColorCubeMapRenderingRun(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 | protected:
|
---|
36 | /**
|
---|
37 | @brief defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
38 | */
|
---|
39 | bool updateAllFace;
|
---|
40 | /**
|
---|
41 | @brief the number of the face to be updated
|
---|
42 | */
|
---|
43 | unsigned char currentFace;
|
---|
44 | /**
|
---|
45 | @brief the resolution of the cubemap texture that was created by this run
|
---|
46 | */
|
---|
47 | unsigned int resolution;
|
---|
48 | /**
|
---|
49 | @brief a flag to skip cube face update if object is far away or too small.
|
---|
50 |
|
---|
51 | @see distTolerance
|
---|
52 | */
|
---|
53 | bool useDistCalc;
|
---|
54 | /**
|
---|
55 | @brief a flag to skip cube face update the face is neglible.
|
---|
56 |
|
---|
57 | @see angleTolerance
|
---|
58 | */
|
---|
59 | bool useFaceAngleCalc;
|
---|
60 | /**
|
---|
61 | @brief A value used in face skip test.
|
---|
62 |
|
---|
63 | The higher this value gets the more precise, but slower the method will be.
|
---|
64 | */
|
---|
65 | float distTolerance;
|
---|
66 | /**
|
---|
67 | @brief A value used in face skip test.
|
---|
68 |
|
---|
69 | The higher this value gets the more precise, but slower the method will be.
|
---|
70 | */
|
---|
71 | float angleTolerance;
|
---|
72 |
|
---|
73 | /**
|
---|
74 | @brief Creates a cubemap texture used for the color-cubemap.
|
---|
75 | */
|
---|
76 | virtual inline void createColorCubeMap() = 0;
|
---|
77 | /**
|
---|
78 | @brief Updates one face of the cubemap.
|
---|
79 |
|
---|
80 | @param facenum the number of the face to be updated
|
---|
81 | */
|
---|
82 | virtual inline void updateCubeFace(int facenum) = 0;
|
---|
83 | /**
|
---|
84 | @brief Checks if a cubemap face needs to be updated.
|
---|
85 |
|
---|
86 | If the object we are updating the cubemap for is far from the camera, or too small, or
|
---|
87 | the given cubemapface does not have significant effect on the rendering the face can be skipped.
|
---|
88 |
|
---|
89 | @param facenum the number of the face to be checked
|
---|
90 | */
|
---|
91 | virtual bool faceNeedsUpdate(int facenum) = 0;
|
---|
92 | //inherited
|
---|
93 | virtual void updateFrame(unsigned long frameNum);
|
---|
94 | };
|
---|