mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-01-30 19:42:59 -05:00
correct winding order check bug
This commit is contained in:
parent
563d5243a2
commit
3293621155
@ -350,15 +350,17 @@ function loadObj(objPath, options) {
|
||||
}
|
||||
|
||||
var scratch3 = new Cartesian3();
|
||||
var scratch4 = new Cartesian3();
|
||||
var scratch5 = new Cartesian3();
|
||||
// Checks if winding order matches the given normal.
|
||||
function checkWindingCorrect(positionIndex1, positionIndex2, positionIndex3, normal) {
|
||||
var A = get3DPoint(positionIndex1, scratch1);
|
||||
var B = get3DPoint(positionIndex2, scratch2);
|
||||
var C = get3DPoint(positionIndex3, scratch3);
|
||||
|
||||
Cartesian3.subtract(B, A, B);
|
||||
Cartesian3.subtract(C, A, C);
|
||||
var cross = Cartesian3.cross(A, C, scratch1);
|
||||
var BA = Cartesian3.subtract(B, A, scratch4);
|
||||
var CA = Cartesian3.subtract(C, A, scratch5);
|
||||
var cross = Cartesian3.cross(BA, CA, scratch3);
|
||||
|
||||
return (Cartesian3.dot(normal, cross) >= 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user