diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-11-20 14:13:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-20 14:13:36 +0100 |
commit | 477e89a8a211f9235bdfb46583c7c14cef8a7c11 (patch) | |
tree | 3d86d6d6a5cfd8aa59714b6df22fec7c82dee14d /modules | |
parent | a2a5793e1324f97e495ccb835a8fd5003354ec29 (diff) | |
parent | bcef4b8dc6d0c74802a1120d5082c2f151d76f73 (diff) |
Merge pull request #23760 from BastiaanOlij/fix_tangent_direction
Fixing tangent and binormal logic
Diffstat (limited to 'modules')
-rw-r--r-- | modules/csg/csg_shape.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index e1607c4326..a4c34e7583 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -201,10 +201,9 @@ void CSGShape::mikktSetTSpaceBasic(const SMikkTSpaceContext *pContext, const flo int i = (iFace * 3 + iVert) * 4; - // Godot seems to want the tangent flipped because our handedness is reversed.. - surface.tansw[i++] = -fvTangent[0]; - surface.tansw[i++] = -fvTangent[1]; - surface.tansw[i++] = -fvTangent[2]; + surface.tansw[i++] = fvTangent[0]; + surface.tansw[i++] = fvTangent[1]; + surface.tansw[i++] = fvTangent[2]; surface.tansw[i++] = fSign; } @@ -219,11 +218,10 @@ void CSGShape::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const f Vector3 bitangent = Vector3(fvBiTangent[0], fvBiTangent[1], fvBiTangent[2]); float d = bitangent.dot(normal.cross(tangent)); - // Godot seems to want the tangent flipped because our handedness is reversed.. i *= 4; - surface.tansw[i++] = -tangent.x; - surface.tansw[i++] = -tangent.y; - surface.tansw[i++] = -tangent.z; + surface.tansw[i++] = tangent.x; + surface.tansw[i++] = tangent.y; + surface.tansw[i++] = tangent.z; surface.tansw[i++] = d < 0 ? -1 : 1; } |