1 | #pragma once
|
---|
2 | #include "RenderingRun.h"
|
---|
3 |
|
---|
4 | /**
|
---|
5 | @brief Base abstract class __declspec( dllexport ) that defines a rendering process of a cubemap.
|
---|
6 | */
|
---|
7 | class __declspec( dllexport ) CubeMapRenderingRun : virtual public RenderingRun
|
---|
8 | {
|
---|
9 | public:
|
---|
10 | /**
|
---|
11 | @brief Constructor.
|
---|
12 |
|
---|
13 | @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames
|
---|
14 | @param updateInterval update frequency
|
---|
15 | @param resolution color cubemap resolution
|
---|
16 | @param useDistCalc flag to skip cube face update if object is far away
|
---|
17 | @param useFaceAngleCalc flag to skip cube face update if face is neglible
|
---|
18 | @param distTolerance distance tolerance used in face skip
|
---|
19 | @param angleTolerance angle tolerance used in face skip
|
---|
20 | @param updateAllFace defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
21 | @param renderSelf sets if the object should be rendered to the cube map
|
---|
22 | @param renderEnvironment sets if the environment should be rendered to the cube map
|
---|
23 | */
|
---|
24 | CubeMapRenderingRun(unsigned long startFrame,
|
---|
25 | unsigned long updateInterval,
|
---|
26 | unsigned int resolution,
|
---|
27 | bool useDistCalc,
|
---|
28 | bool useFaceAngleCalc,
|
---|
29 | float distTolerance,
|
---|
30 | float angleTolerance,
|
---|
31 | bool updateAllFace,
|
---|
32 | bool renderSelf,
|
---|
33 | bool renderEnvironment);
|
---|
34 |
|
---|
35 | virtual ~CubeMapRenderingRun(){}
|
---|
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 | @brief sets if the object should be rendered to the cube map
|
---|
76 | */
|
---|
77 | bool renderSelf;
|
---|
78 | /**
|
---|
79 | @brief sets if the environment should be rendered to the cube map
|
---|
80 | */
|
---|
81 | bool renderEnvironment;
|
---|
82 |
|
---|
83 | /**
|
---|
84 | @brief Creates a cubemap texture used for the color-cubemap.
|
---|
85 | */
|
---|
86 | virtual inline void createCubeMap() = 0;
|
---|
87 | /**
|
---|
88 | @brief Updates one face of the cubemap.
|
---|
89 |
|
---|
90 | @param facenum the number of the face to be updated
|
---|
91 | */
|
---|
92 | virtual inline void updateCubeFace(int facenum) = 0;
|
---|
93 | /**
|
---|
94 | @brief Checks if a cubemap face needs to be updated.
|
---|
95 |
|
---|
96 | If the object we are updating the cubemap for is far from the camera, or too small, or
|
---|
97 | the given cubemapface does not have significant effect on the rendering the face can be skipped.
|
---|
98 |
|
---|
99 | @param facenum the number of the face to be checked
|
---|
100 | */
|
---|
101 | virtual bool faceNeedsUpdate(int facenum) = 0;
|
---|
102 | //inherited
|
---|
103 | virtual void updateFrame(unsigned long frameNum);
|
---|
104 | };
|
---|