mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
Split CIndexBuffer from CMeshBuffer
This commit is contained in:
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#pragma once
|
||||
|
||||
#include "irrlichttypes_extrabloated.h"
|
||||
#include "irr_ptr.h"
|
||||
#include "util/numeric.h"
|
||||
#include "client/tile.h"
|
||||
#include "voxel.h"
|
||||
@@ -145,25 +146,24 @@ private:
|
||||
* Attach alternate `Indices` to an existing mesh buffer, to make it possible to use different
|
||||
* indices with the same vertex buffer.
|
||||
*
|
||||
* Irrlicht does not currently support this: `CMeshBuffer` ties together a single vertex buffer
|
||||
* and a single index buffer. There's no way to share these between mesh buffers.
|
||||
*
|
||||
*/
|
||||
class PartialMeshBuffer
|
||||
{
|
||||
public:
|
||||
PartialMeshBuffer(scene::SMeshBuffer *buffer, std::vector<u16> &&vertex_indexes) :
|
||||
m_buffer(buffer), m_vertex_indexes(std::move(vertex_indexes))
|
||||
{}
|
||||
PartialMeshBuffer(scene::SMeshBuffer *buffer, std::vector<u16> &&vertex_indices) :
|
||||
m_buffer(buffer)
|
||||
{
|
||||
m_indices.reset(new scene::SIndexBuffer());
|
||||
m_indices->Data = std::move(vertex_indices);
|
||||
}
|
||||
|
||||
scene::IMeshBuffer *getBuffer() const { return m_buffer; }
|
||||
const std::vector<u16> &getVertexIndexes() const { return m_vertex_indexes; }
|
||||
|
||||
void beforeDraw() const;
|
||||
void afterDraw() const;
|
||||
void draw(video::IVideoDriver *driver) const;
|
||||
|
||||
private:
|
||||
scene::SMeshBuffer *m_buffer;
|
||||
mutable std::vector<u16> m_vertex_indexes;
|
||||
irr_ptr<scene::SIndexBuffer> m_indices;
|
||||
};
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user