Mapblock mesh: Eliminate meshgen lags
authorRealBadAngel <maciej.kasatkin@o2.pl>
Tue, 16 Feb 2016 02:51:57 +0000 (03:51 +0100)
committerparamat <mat.gregory@virginmedia.com>
Tue, 16 Feb 2016 08:23:32 +0000 (08:23 +0000)
src/mapblock_mesh.cpp

index 8b3d3c0dd1f8d8552a9c4cb5881d8ea3bfaa3931..42e84b75eca20783090d1fc77d0b83ecdedfab28 100644 (file)
@@ -1425,7 +1425,6 @@ void MeshCollector::append(const TileSpec &tile,
        u32 vertex_count;
        if (m_use_tangent_vertices) {
                vertex_count = p->tangent_vertices.size();
-               p->tangent_vertices.reserve(vertex_count + numVertices);
                for (u32 i = 0; i < numVertices; i++) {
                        video::S3DVertexTangents vert(vertices[i].Pos, vertices[i].Normal,
                                vertices[i].Color, vertices[i].TCoords);
@@ -1433,7 +1432,6 @@ void MeshCollector::append(const TileSpec &tile,
                }
        } else {
                vertex_count = p->vertices.size();
-               p->vertices.reserve(vertex_count + numVertices);
                for (u32 i = 0; i < numVertices; i++) {
                        video::S3DVertex vert(vertices[i].Pos, vertices[i].Normal,
                                vertices[i].Color, vertices[i].TCoords);
@@ -1441,7 +1439,6 @@ void MeshCollector::append(const TileSpec &tile,
                }
        } 
 
-       p->indices.reserve(p->indices.size() + numIndices);
        for (u32 i = 0; i < numIndices; i++) {
                u32 j = indices[i] + vertex_count;
                p->indices.push_back(j);
@@ -1484,7 +1481,6 @@ void MeshCollector::append(const TileSpec &tile,
        u32 vertex_count;
        if (m_use_tangent_vertices) {
                vertex_count = p->tangent_vertices.size();
-               p->tangent_vertices.reserve(vertex_count + numVertices);
                for (u32 i = 0; i < numVertices; i++) {
                        video::S3DVertexTangents vert(vertices[i].Pos + pos,
                                vertices[i].Normal, c, vertices[i].TCoords);
@@ -1492,7 +1488,6 @@ void MeshCollector::append(const TileSpec &tile,
                }
        } else {
                vertex_count = p->vertices.size();
-               p->vertices.reserve(vertex_count + numVertices);
                for (u32 i = 0; i < numVertices; i++) {
                        video::S3DVertex vert(vertices[i].Pos + pos,
                                vertices[i].Normal, c, vertices[i].TCoords);
@@ -1500,7 +1495,6 @@ void MeshCollector::append(const TileSpec &tile,
                }
        } 
 
-       p->indices.reserve(p->indices.size() + numIndices);
        for (u32 i = 0; i < numIndices; i++) {
                u32 j = indices[i] + vertex_count;
                p->indices.push_back(j);