Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 330 vs 331 for /trunk/Source Code/Environment/Terrain/Terrain.cpp

Diff revisions: vs.
  @@ -21,7 +21,7 @@
21 21 _alphaTexturePresent(false),
22 22 _terrainWidth(0),
23 23 _terrainHeight(0),
24 - _terrainQuadtree(New Quadtree()),
24 + _terrainQuadtree(MemoryManager_NEW Quadtree()),
25 25 _plane(nullptr),
26 26 _drawBBoxes(false),
27 27 _vegetationGrassNode(nullptr),
  @@ -40,12 +40,8 @@
40 40 }
41 41
42 42 bool Terrain::unload() {
43 - MemoryManager::SAFE_DELETE( _terrainQuadtree );
44 -
45 - for ( TerrainTextureLayer*& terrainTextures : _terrainTextures ) {
46 - MemoryManager::SAFE_DELETE( terrainTextures );
47 - }
48 - _terrainTextures.clear();
43 + MemoryManager::DELETE( _terrainQuadtree );
44 + MemoryManager::DELETE_VECTOR(_terrainTextures);
49 45
50 46 RemoveResource( _vegDetails.grassBillboards );
51 47 return SceneNode::unload();
  @@ -70,7 +66,9 @@
70 66
71 67 Material* mat = getMaterialTpl();
72 68 for (U8 i = 0; i < 3; ++i){
73 - ShaderProgram* const drawShader = mat->getShaderInfo(i == 0 ? FINAL_STAGE : (i == 1 ? SHADOW_STAGE : Z_PRE_PASS_STAGE)).getProgram();
69 + ShaderProgram* const drawShader = mat->getShaderInfo(i == 0 ? FINAL_STAGE :
70 + (i == 1 ? SHADOW_STAGE :
71 + Z_PRE_PASS_STAGE)).getProgram();
74 72 drawShader->Uniform("dvd_waterHeight", GET_ACTIVE_SCENE()->state().getWaterLevel());
75 73 drawShader->Uniform("bbox_min", _boundingBox.getMin());
76 74 drawShader->Uniform("bbox_extent", _boundingBox.getExtent());
  @@ -119,19 +117,25 @@
119 117 SceneNode::sceneUpdate(deltaTime, sgn, sceneState);
120 118 }
121 119
122 - void Terrain::getDrawCommands(SceneGraphNode* const sgn, const RenderStage& currentRenderStage, SceneRenderState& sceneRenderState, vectorImpl<GenericDrawCommand>& drawCommandsOut) {
120 + void Terrain::getDrawCommands(SceneGraphNode* const sgn,
121 + const RenderStage& currentRenderStage,
122 + SceneRenderState& sceneRenderState,
123 + vectorImpl<GenericDrawCommand>& drawCommandsOut) {
123 124 size_t drawStateHash = 0;
124 125
125 126 if (bitCompare(currentRenderStage, DEPTH_STAGE)) {
126 - drawStateHash = bitCompare(currentRenderStage, Z_PRE_PASS_STAGE) ? _terrainRenderStateHash : _terrainDepthRenderStateHash;
127 + drawStateHash = bitCompare(currentRenderStage, Z_PRE_PASS_STAGE) ? _terrainRenderStateHash :
128 + _terrainDepthRenderStateHash;
127 129 }else{
128 - drawStateHash = bitCompare(currentRenderStage, REFLECTION_STAGE) ? _terrainReflectionRenderStateHash : _terrainRenderStateHash;
130 + drawStateHash = bitCompare(currentRenderStage, REFLECTION_STAGE) ? _terrainReflectionRenderStateHash :
131 + _terrainRenderStateHash;
129 132 }
130 133
131 134 RenderingComponent* const renderable = sgn->getComponent<RenderingComponent>();
132 135 assert(renderable != nullptr);
133 136
134 - ShaderProgram* drawShader = renderable->getDrawShader(bitCompare(currentRenderStage, REFLECTION_STAGE) ? FINAL_STAGE : currentRenderStage);
137 + ShaderProgram* drawShader = renderable->getDrawShader(bitCompare(currentRenderStage, REFLECTION_STAGE) ? FINAL_STAGE :
138 + currentRenderStage);
135 139
136 140 if (_terrainInView){
137 141 vectorImpl<GenericDrawCommand> tempCommands;