summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-06-20 14:17:13 +0200
committerGitHub <noreply@github.com>2021-06-20 14:17:13 +0200
commit0d5c0622dd71b3d10e04556a90fab0df8f013514 (patch)
treefaa20a13ca9b4d5d5a4822302e3c97ab51d21799
parentcca29b78b9986872883dfc908beb88dc9f07d10e (diff)
parentb8fb765a65da2a5b03d8d4e68a0a9352f542a4bf (diff)
Merge pull request #49714 from fire/lod-scale
Fix for LOD is broken 49706
-rw-r--r--editor/import/scene_importer_mesh.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/editor/import/scene_importer_mesh.cpp b/editor/import/scene_importer_mesh.cpp
index 7a28677481..ce78166d1e 100644
--- a/editor/import/scene_importer_mesh.cpp
+++ b/editor/import/scene_importer_mesh.cpp
@@ -215,6 +215,7 @@ void EditorSceneImporterMesh::generate_lods() {
int index_target = indices.size() * threshold;
float max_mesh_error_percentage = 1e0f;
float mesh_error = 0.0f;
+ float scale = SurfaceTool::simplify_scale_func((const float *)vertices_ptr, vertex_count, sizeof(Vector3));
while (index_target > min_indices) {
Vector<int> new_indices;
new_indices.resize(indices.size());
@@ -223,7 +224,7 @@ void EditorSceneImporterMesh::generate_lods() {
break;
}
Surface::LOD lod;
- lod.distance = mesh_error;
+ lod.distance = mesh_error * scale;
if (Math::is_zero_approx(mesh_error)) {
break;
}