1 | #ifndef _SKYPREETHAM_H__
|
---|
2 | #define _SKYPREETHAM_H__
|
---|
3 |
|
---|
4 | #include "common.h"
|
---|
5 | #include "ShaderProgram.h"
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 | namespace CHCDemoEngine {
|
---|
10 | class Vector3;
|
---|
11 | class SceneEntity;
|
---|
12 | class RenderState;
|
---|
13 | class Camera;
|
---|
14 | class ShaderProgram;
|
---|
15 | }
|
---|
16 |
|
---|
17 | class SkyPreetham
|
---|
18 | {
|
---|
19 | public:
|
---|
20 | /// Constructor taking sky turbitity as parameter and the sky dome geometry
|
---|
21 | SkyPreetham(float turbitity, CHCDemoEngine::SceneEntity *skyDome);
|
---|
22 |
|
---|
23 | ~SkyPreetham();
|
---|
24 |
|
---|
25 | void RenderSkyDome(const CHCDemoEngine::Vector3 &sunDir,
|
---|
26 | CHCDemoEngine::Camera *camera,
|
---|
27 | CHCDemoEngine::RenderState *state,
|
---|
28 | bool scaleToRange);
|
---|
29 |
|
---|
30 | void ComputeFactors(const CHCDemoEngine::Vector3 &sunDir,
|
---|
31 | CHCDemoEngine::Vector3 &zenithColor,
|
---|
32 | std::vector<CHCDemoEngine::Vector3> &ABCDE,
|
---|
33 | std::pair<float, float> &sunThetha) const;
|
---|
34 |
|
---|
35 | void ComputeSunColor(const CHCDemoEngine::Vector3 &sunDir,
|
---|
36 | CHCDemoEngine::Vector3 &ambient,
|
---|
37 | CHCDemoEngine::Vector3 &diffuse,
|
---|
38 | bool scaleToRange) const;
|
---|
39 |
|
---|
40 | void InitCG();
|
---|
41 |
|
---|
42 |
|
---|
43 | protected:
|
---|
44 |
|
---|
45 | void RenderSunDisk(const CHCDemoEngine::Vector3 &lightDir, CHCDemoEngine::Camera *camera);
|
---|
46 | void CreateSunQuad();
|
---|
47 |
|
---|
48 |
|
---|
49 | //////////
|
---|
50 |
|
---|
51 | /* FEffect* mEffect;
|
---|
52 |
|
---|
53 | FEffect* mSunEffect;
|
---|
54 | FTexture2D* mSunTexture;
|
---|
55 | FVertexBuffer* mSunQuad;
|
---|
56 | */
|
---|
57 |
|
---|
58 | CHCDemoEngine::SceneEntity *mSkyDome;
|
---|
59 |
|
---|
60 | /// the turbidity of the sky
|
---|
61 | float mTurbidity;
|
---|
62 |
|
---|
63 | CHCDemoEngine::ShaderProgram *mSkyVtxProgram;
|
---|
64 | CHCDemoEngine::ShaderProgram *mSkyFragProgram;
|
---|
65 | };
|
---|
66 |
|
---|
67 | #endif //_SKYPREETHAM_H__
|
---|
68 |
|
---|