diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-24 10:54:23 +0200 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-24 10:54:23 +0200 |
| commit | 261fe7ce6afd85cc792d61955070c5e82b5f33dd (patch) | |
| tree | 3b1141d10616e29efca1daa82ea6bc30d766d40a /editor | |
| parent | bc5d5978eabb2e943096a193c40d2e8643ef30e3 (diff) | |
| parent | 8f9cd4e1e3af46234c37c948b9607b3b31464b5a (diff) | |
| download | redot-engine-261fe7ce6afd85cc792d61955070c5e82b5f33dd.tar.gz | |
Merge pull request #83704 from clayjohn/misc-mesh-fixes
Some more fixes for compressed meshes
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/import/resource_importer_obj.cpp | 12 | ||||
| -rw-r--r-- | editor/import/resource_importer_scene.cpp | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index eec3d30bc9..646831ca24 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -226,11 +226,6 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_ bool generate_tangents = p_generate_tangents; Vector3 scale_mesh = p_scale_mesh; Vector3 offset_mesh = p_offset_mesh; - uint64_t mesh_flags = RS::ARRAY_FLAG_COMPRESS_ATTRIBUTES; - - if (p_disable_compression) { - mesh_flags = 0; - } Vector<Vector3> vertices; Vector<Vector3> normals; @@ -374,6 +369,11 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_ } } } else if (/*l.begins_with("g ") ||*/ l.begins_with("usemtl ") || (l.begins_with("o ") || f->eof_reached())) { //commit group to mesh + uint64_t mesh_flags = RS::ARRAY_FLAG_COMPRESS_ATTRIBUTES; + + if (p_disable_compression) { + mesh_flags = 0; + } //groups are too annoying if (surf_tool->get_vertex_array().size()) { //another group going on, commit it @@ -385,7 +385,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_ surf_tool->generate_tangents(); } else { // We need tangents in order to compress vertex data. So disable if tangents aren't generated. - mesh_flags &= ~RS::ARRAY_FLAG_COMPRESS_ATTRIBUTES; + mesh_flags = 0; } surf_tool->index(); diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 33c2b0e238..f9c989dc20 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -2371,7 +2371,7 @@ Node *ResourceImporterScene::pre_import(const String &p_source_file, const HashM Error err = OK; HashMap<StringName, Variant> options_dupe = p_options; - Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS, options_dupe, nullptr, &err); + Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS | EditorSceneFormatImporter::IMPORT_FORCE_DISABLE_MESH_COMPRESSION, options_dupe, nullptr, &err); if (!scene || err != OK) { return nullptr; } |
