summaryrefslogtreecommitdiff
path: root/src/client/mapblock_mesh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/mapblock_mesh.cpp')
-rw-r--r--src/client/mapblock_mesh.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/client/mapblock_mesh.cpp b/src/client/mapblock_mesh.cpp
index 868573bf0..965dd5e29 100644
--- a/src/client/mapblock_mesh.cpp
+++ b/src/client/mapblock_mesh.cpp
@@ -1162,15 +1162,16 @@ void MapBlockBspTree::traverse(s32 node, v3f viewpoint, std::vector<s32> &output
void PartialMeshBuffer::beforeDraw() const
{
// Patch the indexes in the mesh buffer before draw
-
- m_buffer->Indices.clear();
- if (!m_vertex_indexes.empty()) {
- for (auto index : m_vertex_indexes)
- m_buffer->Indices.push_back(index);
- }
+ m_buffer->Indices = std::move(m_vertex_indexes);
m_buffer->setDirty(scene::EBT_INDEX);
}
+void PartialMeshBuffer::afterDraw() const
+{
+ // Take the data back
+ m_vertex_indexes = std::move(m_buffer->Indices.steal());
+}
+
/*
MapBlockMesh
*/
@@ -1514,7 +1515,7 @@ void MapBlockMesh::updateTransparentBuffers(v3f camera_pos, v3s16 block_pos)
const auto &t = m_transparent_triangles[i];
if (current_buffer != t.buffer) {
if (current_buffer) {
- m_transparent_buffers.emplace_back(current_buffer, current_strain);
+ m_transparent_buffers.emplace_back(current_buffer, std::move(current_strain));
current_strain.clear();
}
current_buffer = t.buffer;
@@ -1525,7 +1526,7 @@ void MapBlockMesh::updateTransparentBuffers(v3f camera_pos, v3s16 block_pos)
}
if (!current_strain.empty())
- m_transparent_buffers.emplace_back(current_buffer, current_strain);
+ m_transparent_buffers.emplace_back(current_buffer, std::move(current_strain));
}
void MapBlockMesh::consolidateTransparentBuffers()
@@ -1539,7 +1540,7 @@ void MapBlockMesh::consolidateTransparentBuffers()
for (const auto &t : m_transparent_triangles) {
if (current_buffer != t.buffer) {
if (current_buffer != nullptr) {
- this->m_transparent_buffers.emplace_back(current_buffer, current_strain);
+ this->m_transparent_buffers.emplace_back(current_buffer, std::move(current_strain));
current_strain.clear();
}
current_buffer = t.buffer;
@@ -1550,7 +1551,7 @@ void MapBlockMesh::consolidateTransparentBuffers()
}
if (!current_strain.empty()) {
- this->m_transparent_buffers.emplace_back(current_buffer, current_strain);
+ this->m_transparent_buffers.emplace_back(current_buffer, std::move(current_strain));
}
}