Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 880 vs 881 for /trunk/Source Code/Environment/Terrain/TerrainChunk.cpp

Diff revisions: vs.
  @@ -19,7 +19,8 @@
19 19 QuadtreeNode* const parentNode)
20 20 : _parentNode(parentNode),
21 21 _parentTerrain(parentTerrain),
22 - _vegetation(nullptr)
22 + _vegetation(nullptr),
23 + _lodIndCount(0)
23 24 {
24 25 _ID = _chunkID++;
25 26
  @@ -31,9 +32,8 @@
31 32 _terrain = parentTerrain;
32 33
33 34 VegetationDetails& vegDetails = Attorney::TerrainChunk::vegetationDetails(*parentTerrain);
34 - vegDetails.name += "_chunk_" + to_stringImpl(_chunkID);
35 35 //<Deleted by the sceneGraph on "unload"
36 - _vegetation = MemoryManager_NEW Vegetation(context, parentTerrain->parentResourceCache(), parentTerrain->getDescriptorHash() + _chunkID, vegDetails);
36 + _vegetation = MemoryManager_NEW Vegetation(context, parentTerrain->parentResourceCache(), parentTerrain->getDescriptorHash(), _chunkID, vegDetails);
37 37 _vegetation->renderState().useDefaultMaterial(false);
38 38 _vegetation->setMaterialTpl(nullptr);
39 39 assert(_vegetation != nullptr);
  @@ -61,11 +61,13 @@
61 61 F32 height = 0.0f;
62 62 F32 tempMin = std::numeric_limits<F32>::max();
63 63 F32 tempMax = std::numeric_limits<F32>::min();
64 +
64 65 for (U32 i = 0; i < _lodIndCount; ++i) {
65 66 U32 idx = indices[i];
66 67 if (idx == Config::PRIMITIVE_RESTART_INDEX_L) {
67 68 continue;
68 69 }
70 +
69 71 height = _terrain->_physicsVerts[idx]._position.y;
70 72
71 73 if (height > tempMax) {
  @@ -77,7 +79,6 @@
77 79 }
78 80
79 81 _heightBounds.set(tempMin, tempMax);
80 -
81 82 _vegetation->initialize(this);
82 83
83 84 Attorney::TerrainChunk::registerTerrainChunk(*_parentTerrain, this);
  @@ -88,6 +89,7 @@
88 89 const vec2<U32>& heightMapSize) {
89 90 U32 offset = to_U32(std::pow(2.0f, to_F32(0.0f)));
90 91 U32 div = to_U32(std::pow(2.0f, to_F32(depth)));
92 +
91 93 vec2<U32> heightmapDataSize = heightMapSize / (div);
92 94
93 95 U32 nHMWidth = heightmapDataSize.x + 1;
  @@ -118,12 +120,12 @@
118 120 assert(nIndice == _lodIndCount);
119 121 }
120 122
121 - U8 TerrainChunk::getLoD(const SceneRenderState& sceneRenderState) const {
122 - return _parentNode->getLoD(sceneRenderState);
123 - }
124 -
125 123 F32 TerrainChunk::waterHeight() const {
126 124 return Attorney::TerrainChunk::waterHeight(*_parentTerrain);
127 125 }
128 126
127 + U8 TerrainChunk::getLoD(const vec3<F32>& eyePos) const {
128 + return _parentNode->getLoD(eyePos);
129 + }
130 +
129 131 };