瀏覽代碼

Fix the inversion

Garrett Johnson 6 年之前
父節點
當前提交
c0beca7103
共有 1 個文件被更改,包括 14 次插入8 次删除
  1. 14 8
      examples/js/loaders/LDrawLoader.js

+ 14 - 8
examples/js/loaders/LDrawLoader.js

@@ -1132,6 +1132,20 @@ THREE.LDrawLoader = ( function () {
 
 										}
 
+										// If the scale of the object is negated then the triangle winding order
+										// needs to be flipped.
+										var matrix = currentParseScope.matrix;
+										if (
+											matrix.determinant() < 0 && (
+												scope.separateObjects && isPrimitiveType( type ) ||
+												! scope.separateObjects
+											) ) {
+
+											currentParseScope.inverted = ! currentParseScope.inverted;
+
+										}
+
+
 										triangles = currentParseScope.triangles;
 										lineSegments = currentParseScope.lineSegments;
 										optionalSegments = currentParseScope.optionalSegments;
@@ -1301,14 +1315,6 @@ THREE.LDrawLoader = ( function () {
 
 						}
 
-						// If the scale of the object is negated then the triangle winding order
-						// needs to be flipped.
-						if ( matrix.determinant() < 0 ) {
-
-							bfcInverted = ! bfcInverted;
-
-						}
-
 						subobjects.push( {
 							material: material,
 							matrix: matrix,