mirror of
https://github.com/Relintai/godot_voxel.git
synced 2024-11-11 20:35:08 +01:00
Index meshes
This commit is contained in:
parent
e6213c50c7
commit
08411a4a5b
@ -319,12 +319,16 @@ Ref<Mesh> VoxelMesher::build(const VoxelBuffer & buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Commit mesh
|
// Commit mesh
|
||||||
Ref<Mesh> mesh_ref = _surface_tool[0].commit();
|
Ref<Mesh> mesh_ref;
|
||||||
_surface_tool[0].clear();
|
for (unsigned int i = 0; i < MAX_MATERIALS; ++i) {
|
||||||
for (unsigned int i = 1; i < MAX_MATERIALS; ++i) {
|
|
||||||
if (_materials[i].is_valid()) {
|
if (_materials[i].is_valid()) {
|
||||||
SurfaceTool & st = _surface_tool[i];
|
SurfaceTool & st = _surface_tool[i];
|
||||||
st.commit(mesh_ref);
|
|
||||||
|
// Index mesh to reduce memory usage and make upload to VRAM faster
|
||||||
|
// TODO actually, we could make it indexed from the ground up without using SurfaceTool, so we also save time!
|
||||||
|
st.index();
|
||||||
|
|
||||||
|
mesh_ref = st.commit(mesh_ref);
|
||||||
st.clear();
|
st.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user