mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Improve code in mapblock_mesh.cpp a bit
This commit is contained in:
parent
ed26ed5a1f
commit
5d26ac0088
@ -1349,17 +1349,12 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
|
|||||||
|
|
||||||
scene::SMeshBuffer *buf = new scene::SMeshBuffer();
|
scene::SMeshBuffer *buf = new scene::SMeshBuffer();
|
||||||
buf->Material = material;
|
buf->Material = material;
|
||||||
switch (p.layer.material_type) {
|
if (p.layer.isTransparent()) {
|
||||||
// list of transparent materials taken from tile.h
|
buf->append(&p.vertices[0], p.vertices.size(), nullptr, 0);
|
||||||
case TILE_MATERIAL_ALPHA:
|
|
||||||
case TILE_MATERIAL_LIQUID_TRANSPARENT:
|
|
||||||
case TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT:
|
|
||||||
{
|
|
||||||
buf->append(&p.vertices[0], p.vertices.size(),
|
|
||||||
&p.indices[0], 0);
|
|
||||||
|
|
||||||
MeshTriangle t;
|
MeshTriangle t;
|
||||||
t.buffer = buf;
|
t.buffer = buf;
|
||||||
|
m_transparent_triangles.reserve(p.indices.size() / 3);
|
||||||
for (u32 i = 0; i < p.indices.size(); i += 3) {
|
for (u32 i = 0; i < p.indices.size(); i += 3) {
|
||||||
t.p1 = p.indices[i];
|
t.p1 = p.indices[i];
|
||||||
t.p2 = p.indices[i + 1];
|
t.p2 = p.indices[i + 1];
|
||||||
@ -1367,12 +1362,9 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
|
|||||||
t.updateAttributes();
|
t.updateAttributes();
|
||||||
m_transparent_triangles.push_back(t);
|
m_transparent_triangles.push_back(t);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
break;
|
|
||||||
default:
|
|
||||||
buf->append(&p.vertices[0], p.vertices.size(),
|
buf->append(&p.vertices[0], p.vertices.size(),
|
||||||
&p.indices[0], p.indices.size());
|
&p.indices[0], p.indices.size());
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
mesh->addMeshBuffer(buf);
|
mesh->addMeshBuffer(buf);
|
||||||
buf->drop();
|
buf->drop();
|
||||||
|
Loading…
Reference in New Issue
Block a user