summaryrefslogtreecommitdiff
path: root/src/client/mapblock_mesh.cpp
diff options
context:
space:
mode:
authorparadust7 <102263465+paradust7@users.noreply.github.com>2022-05-21 15:11:49 -0700
committerGitHub <noreply@github.com>2022-05-22 00:11:49 +0200
commit2742fef458c3626476193c9e2d1b9231e042e420 (patch)
treef7682c0a9e2a97578bc44fe344f29fe86bcf233c /src/client/mapblock_mesh.cpp
parentbc59fcf5c5cc44ea18e93f64aca9c20be71c1b07 (diff)
downloadminetest-2742fef458c3626476193c9e2d1b9231e042e420.tar.gz
minetest-2742fef458c3626476193c9e2d1b9231e042e420.tar.bz2
minetest-2742fef458c3626476193c9e2d1b9231e042e420.zip
Fixes needed to use irrArray backed by std::vector (#12263)
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));
}
}