1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-21 18:11:11 +00:00

Update mesh collector and move it to a separate file (#6904)

* Update MeshCollector

* Simplify MeshCollector
This commit is contained in:
Vitaliy 2018-03-22 22:59:49 +03:00 committed by Loïc Blot
parent 8986a9e605
commit 9fcc0c1217
8 changed files with 222 additions and 291 deletions

View file

@ -173,51 +173,6 @@ private:
v3s16 m_camera_offset;
};
/*
This is used because CMeshBuffer::append() is very slow
*/
struct PreMeshBuffer
{
TileLayer layer;
std::vector<u16> indices;
std::vector<video::S3DVertex> vertices;
std::vector<video::S3DVertexTangents> tangent_vertices;
};
struct MeshCollector
{
std::array<std::vector<PreMeshBuffer>, MAX_TILE_LAYERS> prebuffers;
bool m_use_tangent_vertices;
MeshCollector(bool use_tangent_vertices):
m_use_tangent_vertices(use_tangent_vertices)
{
}
void append(const TileSpec &material,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices);
void append(const TileLayer &material,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices, u8 layernum,
bool use_scale = false);
void append(const TileSpec &material,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices, v3f pos,
video::SColor c, u8 light_source);
void append(const TileLayer &material,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices, v3f pos,
video::SColor c, u8 light_source, u8 layernum,
bool use_scale = false);
/*!
* Colorizes all vertices in the collector.
*/
void applyTileColors();
};
/*!
* Encodes light of a node.
* The result is not the final color, but a