mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Split CIndexBuffer from CMeshBuffer
This commit is contained in:
parent
5d6e15bc49
commit
47e4c33a50
13 changed files with 197 additions and 104 deletions
|
@ -592,17 +592,14 @@ void MapBlockBspTree::traverse(s32 node, v3f viewpoint, std::vector<s32> &output
|
|||
PartialMeshBuffer
|
||||
*/
|
||||
|
||||
void PartialMeshBuffer::beforeDraw() const
|
||||
void PartialMeshBuffer::draw(video::IVideoDriver *driver) const
|
||||
{
|
||||
// Patch the indexes in the mesh buffer before draw
|
||||
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);
|
||||
// Swap out the index buffer before drawing the mesh
|
||||
auto *old = m_buffer->Indices;
|
||||
m_buffer->Indices = m_indices.get();
|
||||
m_buffer->setDirty(scene::EBT_INDEX); // TODO remove
|
||||
driver->drawMeshBuffer(m_buffer);
|
||||
m_buffer->Indices = old;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -789,6 +786,7 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
|
|||
}
|
||||
|
||||
// Transparent parts have changing indices
|
||||
// TODO: remove
|
||||
for (auto &it : m_transparent_triangles)
|
||||
it.buffer->setHardwareMappingHint(scene::EHM_STREAM, scene::EBT_INDEX);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue