diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-01-05 10:34:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-05 10:34:08 +0100 |
commit | c6bd3ca191a8e947d22c13a8469e156c799a5925 (patch) | |
tree | 220ccf23df1c72f716c77374bc10311e041022b7 /modules | |
parent | ab68384b8563e4e33a573b4466fa88819c272da7 (diff) | |
parent | f34ea3873ea60a116b720e5e4009901790eef1f9 (diff) |
Merge pull request #56290 from nikitalita/fix-gltf-mesh-prims
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gltf/gltf_document.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 2f8320d7c9..d23ce87bcf 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -2523,14 +2523,16 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> state) { if (p.has("mode")) { const int mode = p["mode"]; ERR_FAIL_INDEX_V(mode, 7, ERR_FILE_CORRUPT); + // Convert mesh.primitive.mode to Godot Mesh enum. See: + // https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#_mesh_primitive_mode static const Mesh::PrimitiveType primitives2[7] = { - Mesh::PRIMITIVE_POINTS, - Mesh::PRIMITIVE_LINES, - Mesh::PRIMITIVE_LINES, //loop not supported, should ce converted - Mesh::PRIMITIVE_LINES, - Mesh::PRIMITIVE_TRIANGLES, - Mesh::PRIMITIVE_TRIANGLE_STRIP, - Mesh::PRIMITIVE_TRIANGLES, //fan not supported, should be converted + Mesh::PRIMITIVE_POINTS, // 0 POINTS + Mesh::PRIMITIVE_LINES, // 1 LINES + Mesh::PRIMITIVE_LINES, // 2 LINE_LOOP; loop not supported, should be converted + Mesh::PRIMITIVE_LINE_STRIP, // 3 LINE_STRIP + Mesh::PRIMITIVE_TRIANGLES, // 4 TRIANGLES + Mesh::PRIMITIVE_TRIANGLE_STRIP, // 5 TRIANGLE_STRIP + Mesh::PRIMITIVE_TRIANGLES, // 6 TRIANGLE_FAN fan not supported, should be converted #ifndef _MSC_VER #warning line loop and triangle fan are not supported and need to be converted to lines and triangles #endif |