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/Environment/Vegetation/Vegetation.cpp

Diff revisions: vs.
  @@ -41,7 +41,7 @@
41 41 _grassVBO->getTexcoord().reserve( size );
42 42 _grassVBOBillboardIndice.resize(_billboardCount,0);
43 43
44 - assert(_map.data);
44 + assert(_map.data() != NULL);
45 45 _success = generateGrass(_billboardCount,size);
46 46
47 47 _grassShader->Uniform("lod_metric", 100.0f);
  @@ -60,20 +60,19 @@
60 60 _render = true;
61 61 }
62 62
63 - void Vegetation::sceneUpdate(const U32 sceneTime,SceneGraphNode* const sgn){
63 + void Vegetation::sceneUpdate(const U32 sceneTime, SceneGraphNode* const sgn, SceneState& sceneState){
64 64 if(!_render || !_success) return;
65 65 ///Query shadow state every "_stateRefreshInterval" milliseconds
66 66 if (sceneTime - _stateRefreshIntervalBuffer >= _stateRefreshInterval){
67 - Scene* activeScene = GET_ACTIVE_SCENE();
68 - _windX = activeScene->state()->getWindDirX();
69 - _windZ = activeScene->state()->getWindDirZ();
70 - _windS = activeScene->state()->getWindSpeed();
67 + _windX = sceneState.getWindDirX();
68 + _windZ = sceneState.getWindDirZ();
69 + _windS = sceneState.getWindSpeed();
71 70 _shadowMapped = ParamHandler::getInstance().getParam<bool>("rendering.enableShadows");
72 71 _grassShader->bind();
73 72 _grassShader->Uniform("windDirection",vec2<F32>(_windX,_windZ));
74 73 _grassShader->Uniform("windSpeed", _windS);
75 74 _grassShader->Uniform("dvd_enableShadowMapping", _shadowMapped);
76 - _grassShader->Uniform("worldHalfExtent", GET_ACTIVE_SCENE()->getSceneGraph()->getRoot()->getBoundingBox().getWidth() * 0.5f);
75 + _grassShader->Uniform("worldHalfExtent", GET_ACTIVE_SCENEGRAPH()->getRoot()->getBoundingBox().getWidth() * 0.5f);
77 76 _grassShader->unbind();
78 77 _stateRefreshIntervalBuffer += _stateRefreshInterval;
79 78 }
  @@ -130,13 +129,13 @@
130 129 F32 y = random(1.0f);
131 130
132 131 const vec3<F32>& P = _terrain->getPosition(x, y);
133 - if(P.y < GET_ACTIVE_SCENE()->state()->getWaterLevel()){
132 + if(P.y < GET_ACTIVE_SCENE()->state().getWaterLevel()){
134 133 k--;
135 134 continue;
136 135 }
137 136
138 137 uv_offset.y = random(3)==0 ? 0.0f : 0.5f;
139 - map_color.set(_map.getColor((U16)(x * _map.w), (U16)(y * _map.h)));
138 + map_color.set(_map.getColor((U16)(x * _map.dimensions().width), (U16)(y * _map.dimensions().height)));
140 139
141 140 if(map_color.g < 150) {
142 141 k--;
  @@ -202,17 +201,17 @@
202 201 PRINT_FN(Locale::get("CREATE_TREE_START"), _treeDensity);
203 202
204 203 for(U16 k=0; k<(U16)_treeDensity; k++) {
205 - I16 map_x = (I16)random((F32)_map.w);
206 - I16 map_y = (I16)random((F32)_map.h);
204 + I16 map_x = (I16)random((F32)_map.dimensions().width);
205 + I16 map_y = (I16)random((F32)_map.dimensions().height);
207 206 vec3<I32> map_color = _map.getColor(map_x, map_y);
208 207 if(map_color.g < 55) {
209 208 k--;
210 209 continue;
211 210 }
212 211
213 - vec3<F32> P = _terrain->getPosition(((F32)map_x)/_map.w, ((F32)map_y)/_map.h);
212 + vec3<F32> P = _terrain->getPosition(((F32)map_x)/_map.dimensions().width, ((F32)map_y)/_map.dimensions().height);
214 213 P.y -= 0.2f;
215 - if(P.y < GET_ACTIVE_SCENE()->state()->getWaterLevel()){
214 + if(P.y < GET_ACTIVE_SCENE()->state().getWaterLevel()){
216 215 k--;
217 216 continue;
218 217 }