1 | #pragma once
|
---|
2 |
|
---|
3 | //disable inheritance warning caused by multiple inheritance
|
---|
4 | #if _WIN32
|
---|
5 | #if _MSC_VER
|
---|
6 | #pragma warning(disable: 4250)
|
---|
7 | #endif
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | #include "CubeMapRenderTechnique.h"
|
---|
11 | #include "OgreRenderTechnique.h"
|
---|
12 | #include "Ogre.h"
|
---|
13 |
|
---|
14 | using namespace Ogre;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | @brief CubeMapRenderTechnique used in an Ogre environment.
|
---|
18 | */
|
---|
19 | class OgreCubeMapRenderTechnique : virtual public CubeMapRenderTechnique,
|
---|
20 | public OgreRenderTechnique
|
---|
21 | {
|
---|
22 | public:
|
---|
23 |
|
---|
24 | /**
|
---|
25 | @brief Constructor.
|
---|
26 |
|
---|
27 | @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames
|
---|
28 | @param cubeMapUpdateInterval update frequency
|
---|
29 | @param cubeMapResolution color cubemap resolution
|
---|
30 | @param texID the id of the texture unit state the resulting cubemap should be bound to
|
---|
31 | @param useDistCalc flag to skip cube face update if object is far away
|
---|
32 | @param useFaceAngleCalc flag to skip cube face update if face is neglible
|
---|
33 | @param distTolerance distance tolerance used in face skip
|
---|
34 | @param angleTolerance angle tolerance used in face skip
|
---|
35 | @param updateAllFace defines if all cubemap faces should be updated in a frame or only one face per frame
|
---|
36 | @param pass the pass to operate on
|
---|
37 | @param parentRenderable the object to operate on
|
---|
38 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
39 | */
|
---|
40 | OgreCubeMapRenderTechnique( unsigned long startFrame,
|
---|
41 | unsigned long cubeMapUpdateInterval,
|
---|
42 | unsigned int cubeMapResolution,
|
---|
43 | unsigned char texID,
|
---|
44 | bool useDistCalc,
|
---|
45 | bool useFaceAngleCalc,
|
---|
46 | float distTolerance,
|
---|
47 | float angleTolerance,
|
---|
48 | bool updateAllFace,
|
---|
49 | bool renderSelf,
|
---|
50 | bool renderEnvironment,
|
---|
51 | String selfMaterial,
|
---|
52 | String environmentMaterial,
|
---|
53 | int layer,
|
---|
54 | bool getMinMax,
|
---|
55 | bool attachToTexUnit,
|
---|
56 | String minVariableName,
|
---|
57 | String maxVariableName,
|
---|
58 | Pass* pass,
|
---|
59 | OgreRenderable* parentRenderable,
|
---|
60 | OgreTechniqueGroup* parentTechniqueGroup,
|
---|
61 | bool createCubeRun = false
|
---|
62 | );
|
---|
63 | /**
|
---|
64 | @brief Destructor.
|
---|
65 | */
|
---|
66 | ~OgreCubeMapRenderTechnique();
|
---|
67 |
|
---|
68 |
|
---|
69 | protected:
|
---|
70 |
|
---|
71 | /**
|
---|
72 | @brief the id of the texture unit state the resulting cubemap should be bound to
|
---|
73 | */
|
---|
74 | unsigned char texID;
|
---|
75 | String selfMaterial;
|
---|
76 | String environmentMaterial;
|
---|
77 | String texturePostFix;
|
---|
78 |
|
---|
79 | bool getMinMax;
|
---|
80 | bool attachToTexUnit;
|
---|
81 | String minVariableName;
|
---|
82 | String maxVariableName;
|
---|
83 |
|
---|
84 | RenderingRun* createCubeMapRun();
|
---|
85 | void cubeMapRunChanged(RenderingRun* run);
|
---|
86 | void cubeMapRunUpdated(RenderingRun* run);
|
---|
87 | };
|
---|
88 |
|
---|
89 | class OgreCubeMapRenderTechniqueFactory : public RenderTechniqueFactory
|
---|
90 | {
|
---|
91 | public:
|
---|
92 |
|
---|
93 | OgreCubeMapRenderTechniqueFactory();
|
---|
94 |
|
---|
95 | OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
|
---|
96 | Pass* pass,
|
---|
97 | OgreRenderable* parentRenderable,
|
---|
98 | OgreTechniqueGroup* parentTechniqueGroup);
|
---|
99 |
|
---|
100 | void resetParams();
|
---|
101 |
|
---|
102 | unsigned long startFrame;
|
---|
103 | unsigned long cubeMapUpdateInterval;
|
---|
104 | unsigned int cubeMapResolution;
|
---|
105 | unsigned char texID;
|
---|
106 | bool useDistCalc;
|
---|
107 | bool useFaceAngleCalc;
|
---|
108 | float distTolerance;
|
---|
109 | float angleTolerance;
|
---|
110 | bool updateAllFace;
|
---|
111 | bool renderSelf;
|
---|
112 | bool renderEnvironment;
|
---|
113 | String selfMaterial;
|
---|
114 | String environmentMaterial;
|
---|
115 | int layer;
|
---|
116 |
|
---|
117 | bool getMinMax;
|
---|
118 | bool attachToTexUnit;
|
---|
119 | String minVariableName;
|
---|
120 | String maxVariableName;
|
---|
121 | }; |
---|