瀏覽代碼

GLTFLoader: Add comments in computeBounds().

Mugen87 5 年之前
父節點
當前提交
31331a6988
共有 2 個文件被更改,包括 12 次插入0 次删除
  1. 4 0
      examples/js/loaders/GLTFLoader.js
  2. 8 0
      examples/jsm/loaders/GLTFLoader.js

+ 4 - 0
examples/js/loaders/GLTFLoader.js

@@ -2295,6 +2295,8 @@ THREE.GLTFLoader = ( function () {
 			var min = accessor.min;
 			var min = accessor.min;
 			var max = accessor.max;
 			var max = accessor.max;
 
 
+			// glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
+
 			if ( min !== undefined && max !== undefined ) {
 			if ( min !== undefined && max !== undefined ) {
 
 
 				box.set(
 				box.set(
@@ -2329,6 +2331,8 @@ THREE.GLTFLoader = ( function () {
 					var min = accessor.min;
 					var min = accessor.min;
 					var max = accessor.max;
 					var max = accessor.max;
 
 
+					// glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
+
 					if ( min !== undefined && max !== undefined ) {
 					if ( min !== undefined && max !== undefined ) {
 
 
 						// we need to get max of absolute components because target weight is [-1,1]
 						// we need to get max of absolute components because target weight is [-1,1]

+ 8 - 0
examples/jsm/loaders/GLTFLoader.js

@@ -2362,12 +2362,18 @@ var GLTFLoader = ( function () {
 			var min = accessor.min;
 			var min = accessor.min;
 			var max = accessor.max;
 			var max = accessor.max;
 
 
+			// glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
+
 			if ( min !== undefined && max !== undefined ) {
 			if ( min !== undefined && max !== undefined ) {
 
 
 				box.set(
 				box.set(
 					new Vector3( min[ 0 ], min[ 1 ], min[ 2 ] ),
 					new Vector3( min[ 0 ], min[ 1 ], min[ 2 ] ),
 					new Vector3( max[ 0 ], max[ 1 ], max[ 2 ] ) );
 					new Vector3( max[ 0 ], max[ 1 ], max[ 2 ] ) );
 
 
+			} else {
+
+				return;
+
 			}
 			}
 
 
 		} else {
 		} else {
@@ -2392,6 +2398,8 @@ var GLTFLoader = ( function () {
 					var min = accessor.min;
 					var min = accessor.min;
 					var max = accessor.max;
 					var max = accessor.max;
 
 
+					// glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
+
 					if ( min !== undefined && max !== undefined ) {
 					if ( min !== undefined && max !== undefined ) {
 
 
 						// we need to get max of absolute components because target weight is [-1,1]
 						// we need to get max of absolute components because target weight is [-1,1]