Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 167 vs 168 for /trunk/Source Code/Scenes/Headers/SceneState.h

Diff revisions: vs.
  @@ -42,64 +42,6 @@
42 42 vec3<F32> _fogColor;
43 43 };
44 44
45 - class SceneState{
46 - public:
47 - SceneState() :
48 - _moveFB(0.0f),
49 - _moveLR(0.0f),
50 - _angleUD(0.0f),
51 - _angleLR(0.0f),
52 - _isRunning(false)
53 - {
54 - _fog._fogColor = vec3<F32>(0.2f, 0.2f, 0.2f);
55 - _fog._fogDensity = 0.01f;
56 - _fog._fogMode = FOG_EXP2;
57 - _fog._fogStartDist = 10;
58 - _fog._fogEndDist = 1000;
59 - }
60 -
61 - virtual ~SceneState(){
62 - for_each(MusicPlaylist::value_type& it, _backgroundMusic){
63 - if(it.second){
64 - RemoveResource(it.second);
65 - }
66 - }
67 - _backgroundMusic.clear();
68 - }
69 - inline FogDescriptor& getFogDesc() {return _fog;}
70 - inline F32& getWindSpeed() {return _windSpeed;}
71 - inline F32& getWindDirX() {return _windDirX;}
72 - inline F32& getWindDirZ() {return _windDirZ;}
73 - inline F32& getGrassVisibility() {return _grassVisibility;}
74 - inline F32& getTreeVisibility() {return _treeVisibility;}
75 - inline F32& getGeneralVisibility() {return _generalVisibility;}
76 - inline F32& getWaterLevel() {return _waterHeight;}
77 - inline F32& getWaterDepth() {return _waterDepth;}
78 - inline bool getRunningState() {return _isRunning;}
79 - inline void toggleRunningState(bool state) {_isRunning = state;}
80 -
81 - F32 _moveFB; ///< forward-back move change detected
82 - F32 _moveLR; ///< left-right move change detected
83 - F32 _angleUD; ///< up-down angle change detected
84 - F32 _angleLR; ///< left-right angle change detected
85 -
86 - F32 _waterHeight;
87 - F32 _waterDepth;
88 - ///Background music map
89 - typedef Unordered_map<std::string /*trackName*/, AudioDescriptor* /*track*/> MusicPlaylist;
90 - MusicPlaylist _backgroundMusic;
91 -
92 - protected:
93 - friend class Scene;
94 - FogDescriptor _fog;
95 - bool _isRunning;
96 - F32 _grassVisibility;
97 - F32 _treeVisibility;
98 - F32 _generalVisibility;
99 - F32 _windSpeed;
100 - F32 _windDirX;
101 - F32 _windDirZ;
102 - };
103 45
104 46 class Camera;
105 47 ///Contains all the information needed to render the scene:
  @@ -114,9 +56,9 @@
114 56 {
115 57 }
116 58
117 - inline bool drawBBox() {return _drawBB;}
118 - inline bool drawSkeletons() {return _drawSkeletons;}
119 - inline bool drawObjects() {return _drawObjects;}
59 + inline bool drawBBox() const {return _drawBB;}
60 + inline bool drawSkeletons() const {return _drawSkeletons;}
61 + inline bool drawObjects() const {return _drawObjects;}
120 62 inline void drawBBox(bool visibility) {_drawBB = visibility;}
121 63 inline void drawSkeletons(bool visibility) {_drawSkeletons = visibility;}
122 64 inline void drawObjects(bool visibility) {_drawObjects=visibility;}
  @@ -138,12 +80,16 @@
138 80 drawObjects(true);
139 81 }
140 82 }
141 - inline Camera* getCamera() {return _camera;}
83 +
84 + inline Camera& getCamera() {return *_camera;}
85 + inline const Camera& getCameraConst() const {return *_camera;}
142 86 /// Update current camera (simple, fast, inlined poitner swap)
143 87 inline void updateCamera(Camera* const camera) {_camera = camera;}
144 88 inline vec2<U16>& cachedResolution() {return _cachedResolution;}
145 89 ///This can be dinamically controlled in case scene rendering needs it
146 - inline F32& shadowMapResolutionFactor() {return _shadowMapResolutionFactor;}
90 + inline F32 shadowMapResolutionFactor() const {return _shadowMapResolutionFactor;}
91 + inline void shadowMapResolutionFactor(F32 factor) {_shadowMapResolutionFactor = factor;}
92 +
147 93 protected:
148 94 friend class Scene;
149 95 bool _drawBB;
  @@ -155,4 +101,72 @@
155 101 ///cached shadowmap resolution factor
156 102 F32 _shadowMapResolutionFactor;
157 103 };
104 +
105 + class SceneState{
106 + public:
107 + SceneState() :
108 + _moveFB(0),
109 + _moveLR(0),
110 + _angleUD(0),
111 + _angleLR(0),
112 + _roll(0),
113 + _isRunning(false)
114 + {
115 + _fog._fogColor = vec3<F32>(0.2f, 0.2f, 0.2f);
116 + _fog._fogDensity = 0.01f;
117 + _fog._fogMode = FOG_EXP2;
118 + _fog._fogStartDist = 10;
119 + _fog._fogEndDist = 1000;
120 + }
121 +
122 + virtual ~SceneState(){
123 + for_each(MusicPlaylist::value_type& it, _backgroundMusic){
124 + if(it.second){
125 + RemoveResource(it.second);
126 + }
127 + }
128 + _backgroundMusic.clear();
129 + }
130 +
131 + inline FogDescriptor& getFogDesc() {return _fog;}
132 + inline SceneRenderState& getRenderState() {return _renderState;}
133 +
134 + inline F32& getWindSpeed() {return _windSpeed;}
135 + inline F32& getWindDirX() {return _windDirX;}
136 + inline F32& getWindDirZ() {return _windDirZ;}
137 + inline F32& getGrassVisibility() {return _grassVisibility;}
138 + inline F32& getTreeVisibility() {return _treeVisibility;}
139 + inline F32& getGeneralVisibility() {return _generalVisibility;}
140 + inline F32& getWaterLevel() {return _waterHeight;}
141 + inline F32& getWaterDepth() {return _waterDepth;}
142 + inline bool getRunningState() const {return _isRunning;}
143 + inline void toggleRunningState(bool state) {_isRunning = state;}
144 +
145 +
146 + I32 _moveFB; ///< forward-back move change detected
147 + I32 _moveLR; ///< left-right move change detected
148 + I32 _angleUD; ///< up-down angle change detected
149 + I32 _angleLR; ///< left-right angle change detected
150 + I32 _roll; ///< roll left or right change detected
151 +
152 + F32 _waterHeight;
153 + F32 _waterDepth;
154 + ///Background music map
155 + typedef Unordered_map<std::string /*trackName*/, AudioDescriptor* /*track*/> MusicPlaylist;
156 + MusicPlaylist _backgroundMusic;
157 +
158 + protected:
159 + friend class Scene;
160 + FogDescriptor _fog;
161 + ///saves all the rendering information for the scene (camera position, light info, draw states)
162 + SceneRenderState _renderState;
163 + bool _isRunning;
164 + F32 _grassVisibility;
165 + F32 _treeVisibility;
166 + F32 _generalVisibility;
167 + F32 _windSpeed;
168 + F32 _windDirX;
169 + F32 _windDirZ;
170 + };
171 +
158 172 #endif