diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-12-11 15:21:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-11 15:21:43 +0100 |
commit | 55089d0b1aa6342ca5836bbd196cbc6e6ba9d23f (patch) | |
tree | 468c20f39f4a164261bd89a40e77f0141aa05a6c /editor | |
parent | 244cc11edd7ba5cae95a909ada2fec207631ffc8 (diff) | |
parent | fa63a0fe835868148c9ac6ab9a3f260928155c70 (diff) |
Merge pull request #24224 from BastiaanOlij/flip_bitangent
Reverse bitangent on everythings
Diffstat (limited to 'editor')
-rw-r--r-- | editor/import/editor_import_collada.cpp | 2 | ||||
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 11 |
2 files changed, 2 insertions, 11 deletions
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 8e69090da3..93c462f747 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -771,7 +771,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me int binormal_pos = (binormal_src->stride ? binormal_src->stride : 3) * p.indices[src + binormal_ofs]; ERR_FAIL_INDEX_V(binormal_pos, binormal_src->array.size(), ERR_INVALID_DATA); - Vector3 binormal = Vector3(-binormal_src->array[binormal_pos + 0], -binormal_src->array[binormal_pos + 1], -binormal_src->array[binormal_pos + 2]); // Due to Godots face order it seems we need to flip our binormal! + Vector3 binormal = Vector3(binormal_src->array[binormal_pos + 0], binormal_src->array[binormal_pos + 1], binormal_src->array[binormal_pos + 2]); int tangent_pos = (tangent_src->stride ? tangent_src->stride : 3) * p.indices[src + tangent_ofs]; ERR_FAIL_INDEX_V(tangent_pos, tangent_src->array.size(), ERR_INVALID_DATA); diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 00ca86a43b..b5d646d5d4 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -899,16 +899,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { array[Mesh::ARRAY_NORMAL] = _decode_accessor_as_vec3(state, a["NORMAL"], true); } if (a.has("TANGENT")) { - PoolVector<float> tans = _decode_accessor_as_floats(state, a["TANGENT"], true); - { // we need our binormals inversed, so flip our w component. - int ts = tans.size(); - PoolVector<float>::Write w = tans.write(); - - for (int j = 3; j < ts; j += 4) { - w[j] *= -1.0; - } - } - array[Mesh::ARRAY_TANGENT] = tans; + array[Mesh::ARRAY_TANGENT] = _decode_accessor_as_floats(state, a["TANGENT"], true); } if (a.has("TEXCOORD_0")) { array[Mesh::ARRAY_TEX_UV] = _decode_accessor_as_vec2(state, a["TEXCOORD_0"], true); |