|
@@ -2291,12 +2291,23 @@ THREE.GLTFLoader = ( function () {
|
|
|
if ( attributes.POSITION !== undefined ) {
|
|
|
|
|
|
var accessor = parser.json.accessors[ attributes.POSITION ];
|
|
|
+
|
|
|
var min = accessor.min;
|
|
|
var max = accessor.max;
|
|
|
|
|
|
- box.set(
|
|
|
- new THREE.Vector3( min[ 0 ], min[ 1 ], min[ 2 ] ),
|
|
|
- new THREE.Vector3( max[ 0 ], max[ 1 ], max[ 2 ] ) );
|
|
|
+ // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
|
|
|
+
|
|
|
+ if ( min !== undefined && max !== undefined ) {
|
|
|
+
|
|
|
+ box.set(
|
|
|
+ new THREE.Vector3( min[ 0 ], min[ 1 ], min[ 2 ] ),
|
|
|
+ new THREE.Vector3( max[ 0 ], max[ 1 ], max[ 2 ] ) );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -2320,12 +2331,18 @@ THREE.GLTFLoader = ( function () {
|
|
|
var min = accessor.min;
|
|
|
var max = accessor.max;
|
|
|
|
|
|
- // we need to get max of absolute components because target weight is [-1,1]
|
|
|
- vector.setX( Math.max( Math.abs( min[ 0 ] ), Math.abs( max[ 0 ] ) ) );
|
|
|
- vector.setY( Math.max( Math.abs( min[ 1 ] ), Math.abs( max[ 1 ] ) ) );
|
|
|
- vector.setZ( Math.max( Math.abs( min[ 2 ] ), Math.abs( max[ 2 ] ) ) );
|
|
|
+ // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
|
|
|
+
|
|
|
+ if ( min !== undefined && max !== undefined ) {
|
|
|
|
|
|
- box.expandByVector( vector );
|
|
|
+ // we need to get max of absolute components because target weight is [-1,1]
|
|
|
+ vector.setX( Math.max( Math.abs( min[ 0 ] ), Math.abs( max[ 0 ] ) ) );
|
|
|
+ vector.setY( Math.max( Math.abs( min[ 1 ] ), Math.abs( max[ 1 ] ) ) );
|
|
|
+ vector.setZ( Math.max( Math.abs( min[ 2 ] ), Math.abs( max[ 2 ] ) ) );
|
|
|
+
|
|
|
+ box.expandByVector( vector );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|