소스 검색

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