mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-20 10:47:19 +01:00
Also add the new lod generation code to the prop job.
This commit is contained in:
parent
6e68267bd0
commit
50701f1740
@ -36,6 +36,10 @@ SOFTWARE.
|
||||
|
||||
#include "../../world/default/voxel_world_default.h"
|
||||
|
||||
#ifdef MESH_UTILS_PRESENT
|
||||
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
|
||||
#endif
|
||||
|
||||
Ref<VoxelMesher> VoxelPropJob::get_prop_mesher() const {
|
||||
return _prop_mesher;
|
||||
}
|
||||
@ -283,33 +287,34 @@ void VoxelPropJob::phase_prop() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (should_do()) {
|
||||
if (chunk->get_lod_num() > 4) {
|
||||
Ref<FastQuadraticMeshSimplifier> fqms;
|
||||
fqms.instance();
|
||||
fqms->initialize(temp_mesh_arr);
|
||||
#ifdef MESH_UTILS_PRESENT
|
||||
if (should_do()) {
|
||||
if (chunk->get_lod_num() > 4) {
|
||||
Ref<FastQuadraticMeshSimplifier> fqms;
|
||||
fqms.instance();
|
||||
fqms->set_preserve_border_edges(true);
|
||||
fqms->initialize(temp_mesh_arr);
|
||||
|
||||
Array arr_merged_simplified;
|
||||
for (int i = 4; i < chunk->get_lod_num(); ++i) {
|
||||
fqms->simplify_mesh(temp_mesh_arr.size() * 0.8, 7);
|
||||
temp_mesh_arr = fqms->get_arrays();
|
||||
|
||||
for (int i = 4; i < chunk->get_lod_num(); ++i) {
|
||||
fqms->simplify_mesh(arr_merged_simplified[0].size() * 0.8, 7);
|
||||
arr_merged_simplified = fqms->get_arrays();
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(
|
||||
chunk->get_mesh_rid_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, i),
|
||||
VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr);
|
||||
|
||||
if (arr_merged_simplified[0].size() == 0)
|
||||
break;
|
||||
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(get_mesh_rid_index(MESH_INDEX_PROP, MESH_TYPE_INDEX_MESH, i), VisualServer::PRIMITIVE_TRIANGLES, arr_merged_simplified);
|
||||
|
||||
if (get_library()->get_material(i).is_valid())
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(get_mesh_rid_index(MESH_INDEX_PROP, MESH_TYPE_INDEX_MESH, i), 0, get_library()->get_material(i)->get_rid());
|
||||
}
|
||||
}
|
||||
if (should_return()) {
|
||||
return;
|
||||
}
|
||||
if (chunk->get_library()->get_material(i).is_valid())
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(
|
||||
chunk->get_mesh_rid_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, i), 0,
|
||||
chunk->get_library()->get_material(i)->get_rid());
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (should_return()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,6 @@ SOFTWARE.
|
||||
|
||||
#include "../default/voxel_chunk_default.h"
|
||||
|
||||
//#define MESH_UTILS_PRESENT 1
|
||||
|
||||
#ifdef MESH_UTILS_PRESENT
|
||||
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user