Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 868 vs 869 for /trunk/Source Code/Environment/Terrain/Quadtree/Quadtree.cpp

Diff revisions: vs.
  @@ -90,19 +90,17 @@
90 90 // Generate index buffer
91 91 const U32 terrainWidth = HMsize.x;
92 92 const U32 terrainHeight = HMsize.y;
93 - vec3<U32> firstTri, secondTri;
93 + vectorImpl<vec3<U32>>& triangles = terrain->getTriangles();
94 + triangles.reserve(terrainHeight * terrainWidth * 2);
95 +
94 96 I32 vertexIndex = -1;
95 97 for (U32 j = 0; j < (terrainHeight - 1); ++j) {
96 98 for (U32 i = 0; i < (terrainWidth - 1); ++i) {
97 99 vertexIndex = (j * terrainWidth) + i;
98 100 // Top triangle (T0)
99 - firstTri.set(vertexIndex, vertexIndex + terrainWidth + 1,
100 - vertexIndex + 1);
101 + triangles.emplace_back(vertexIndex, vertexIndex + terrainWidth + 1, vertexIndex + 1);
101 102 // Bottom triangle (T1)
102 - secondTri.set(vertexIndex, vertexIndex + terrainWidth,
103 - vertexIndex + terrainWidth + 1);
104 - terrain->addTriangle(firstTri);
105 - terrain->addTriangle(secondTri);
103 + triangles.emplace_back(vertexIndex, vertexIndex + terrainWidth, vertexIndex + terrainWidth + 1);
106 104 }
107 105 }
108 106 }