Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 259 vs 260 for /trunk/Source Code/Environment/Terrain/TerrainLoader.cpp

Diff revisions: vs.
  @@ -2,6 +2,7 @@
2 2 #include "Headers/TerrainDescriptor.h"
3 3
4 4 #include "Core/Headers/ParamHandler.h"
5 + #include "Rendering/Headers/Frustum.h"
5 6 #include "Quadtree/Headers/Quadtree.h"
6 7 #include "Managers/Headers/SceneManager.h"
7 8 #include "Geometry/Material/Headers/Material.h"
  @@ -15,9 +16,6 @@
15 16 bool Terrain::unload(){
16 17 SAFE_DELETE(_terrainQuadtree);
17 18 SAFE_DELETE(_groundVB);
18 - SAFE_DELETE(_terrainRenderState);
19 - SAFE_DELETE(_terrainDepthRenderState);
20 - SAFE_DELETE(_terrainReflectionRenderState);
21 19
22 20 assert(!_terrainTextures.empty());
23 21 FOR_EACH(TerrainTextureMap::value_type& it, _terrainTextures){
  @@ -37,11 +35,11 @@
37 35 //Generate a render state
38 36 RenderStateBlockDescriptor terrainDesc;
39 37 terrainDesc.setCullMode(CULL_MODE_CW);
40 - _terrainRenderState = GFX_DEVICE.createStateBlock(terrainDesc);
41 - _terrainReflectionRenderState = GFX_DEVICE.createStateBlock(terrainDesc);
38 + _terrainRenderState = GFX_DEVICE.getOrCreateStateBlock(terrainDesc);
39 + _terrainReflectionRenderState = GFX_DEVICE.getOrCreateStateBlock(terrainDesc);
42 40 //Generate a shadow render state
43 41 terrainDesc.setCullMode(CULL_MODE_CCW);
44 - _terrainDepthRenderState = GFX_DEVICE.createStateBlock(terrainDesc);
42 + _terrainDepthRenderState = GFX_DEVICE.getOrCreateStateBlock(terrainDesc);
45 43 }
46 44
47 45 bool Terrain::loadThreadedResources(TerrainDescriptor* const terrain){
  @@ -168,7 +166,7 @@
168 166 _plane = CreateResource<Quad3D>(infinitePlane);
169 167 F32 depth = GET_ACTIVE_SCENE()->state().getWaterDepth();
170 168 F32 height = GET_ACTIVE_SCENE()->state().getWaterLevel()- depth;
171 - _farPlane = 2.0f * ParamHandler::getInstance().getParam<F32>("runtime.zFar");
169 + _farPlane = 2.0f * Frustum::getInstance().getZPlanes().y;
172 170 _plane->setCorner(Quad3D::TOP_LEFT, vec3<F32>( -_farPlane, height, -_farPlane));
173 171 _plane->setCorner(Quad3D::TOP_RIGHT, vec3<F32>( _farPlane, height, -_farPlane));
174 172 _plane->setCorner(Quad3D::BOTTOM_LEFT, vec3<F32>(-_farPlane, height, _farPlane));