Disable mesh compression if vertex position.z is always 0
This commit is contained in:
parent
9d6bdbc56e
commit
077e20cd51
3 changed files with 36 additions and 2 deletions
|
|
@ -384,7 +384,22 @@ static Error _parse_obj(const String &p_path, List<Ref<ImporterMesh>> &r_meshes,
|
|||
|
||||
if (p_disable_compression) {
|
||||
mesh_flags = 0;
|
||||
} else {
|
||||
bool is_mesh_2d = true;
|
||||
|
||||
// Disable compression if all z equals 0 (the mesh is 2D).
|
||||
for (int i = 0; i < vertices.size(); i++) {
|
||||
if (!Math::is_zero_approx(vertices[i].z)) {
|
||||
is_mesh_2d = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_mesh_2d) {
|
||||
mesh_flags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//groups are too annoying
|
||||
if (surf_tool->get_vertex_array().size()) {
|
||||
//another group going on, commit it
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue