mirror of
https://github.com/minetest/minetest.git
synced 2025-01-24 06:51:35 +01:00
Consolidate transparent buffers lazily
This commit is contained in:
parent
c00fed20b7
commit
39970fed38
@ -906,6 +906,7 @@ void MapBlockMesh::updateTransparentBuffers(v3f camera_pos, v3s16 block_pos)
|
|||||||
m_bsp_tree.traverse(rel_camera_pos, triangle_refs);
|
m_bsp_tree.traverse(rel_camera_pos, triangle_refs);
|
||||||
|
|
||||||
// arrange index sequences into partial buffers
|
// arrange index sequences into partial buffers
|
||||||
|
m_transparent_buffers_consolidated = false;
|
||||||
m_transparent_buffers.clear();
|
m_transparent_buffers.clear();
|
||||||
|
|
||||||
scene::SMeshBuffer *current_buffer = nullptr;
|
scene::SMeshBuffer *current_buffer = nullptr;
|
||||||
@ -930,6 +931,8 @@ void MapBlockMesh::updateTransparentBuffers(v3f camera_pos, v3s16 block_pos)
|
|||||||
|
|
||||||
void MapBlockMesh::consolidateTransparentBuffers()
|
void MapBlockMesh::consolidateTransparentBuffers()
|
||||||
{
|
{
|
||||||
|
if (m_transparent_buffers_consolidated)
|
||||||
|
return;
|
||||||
m_transparent_buffers.clear();
|
m_transparent_buffers.clear();
|
||||||
|
|
||||||
scene::SMeshBuffer *current_buffer = nullptr;
|
scene::SMeshBuffer *current_buffer = nullptr;
|
||||||
@ -952,6 +955,8 @@ void MapBlockMesh::consolidateTransparentBuffers()
|
|||||||
if (!current_strain.empty()) {
|
if (!current_strain.empty()) {
|
||||||
this->m_transparent_buffers.emplace_back(current_buffer, std::move(current_strain));
|
this->m_transparent_buffers.emplace_back(current_buffer, std::move(current_strain));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_transparent_buffers_consolidated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
video::SColor encode_light(u16 light, u8 emissive_light)
|
video::SColor encode_light(u16 light, u8 emissive_light)
|
||||||
|
@ -282,6 +282,8 @@ private:
|
|||||||
MapBlockBspTree m_bsp_tree;
|
MapBlockBspTree m_bsp_tree;
|
||||||
// Ordered list of references to parts of transparent buffers to draw
|
// Ordered list of references to parts of transparent buffers to draw
|
||||||
std::vector<PartialMeshBuffer> m_transparent_buffers;
|
std::vector<PartialMeshBuffer> m_transparent_buffers;
|
||||||
|
// Is m_transparent_buffers currently in consolidated form?
|
||||||
|
bool m_transparent_buffers_consolidated = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
Reference in New Issue
Block a user