提交 100aca88 编写于 作者: M Mr.doob

Updated builds.

上级 bc3ebe9e
......@@ -7765,6 +7765,37 @@
},
setFromBufferAttribute: function ( attribute ) {
var minX = + Infinity;
var minY = + Infinity;
var minZ = + Infinity;
var maxX = - Infinity;
var maxY = - Infinity;
var maxZ = - Infinity;
for ( var i = 0, l = attribute.count; i < l; i ++ ) {
var x = attribute.getX( i );
var y = attribute.getY( i );
var z = attribute.getZ( i );
if ( x < minX ) minX = x;
if ( y < minY ) minY = y;
if ( z < minZ ) minZ = z;
if ( x > maxX ) maxX = x;
if ( y > maxY ) maxY = y;
if ( z > maxZ ) maxZ = z;
}
this.min.set( minX, minY, minZ );
this.max.set( maxX, maxY, maxZ );
},
setFromPoints: function ( points ) {
this.makeEmpty();
......@@ -14252,11 +14283,11 @@
}
var positions = this.attributes.position.array;
var position = this.attributes.position;
if ( positions !== undefined ) {
if ( position !== undefined ) {
this.boundingBox.setFromArray( positions );
this.boundingBox.setFromBufferAttribute( position );
} else {
......@@ -14285,14 +14316,13 @@
}
var positions = this.attributes.position;
var position = this.attributes.position;
if ( positions ) {
if ( position ) {
var array = positions.array;
var center = this.boundingSphere.center;
box.setFromArray( array );
box.setFromBufferAttribute( position );
box.getCenter( center );
// hoping to find a boundingSphere with a radius smaller than the
......@@ -14300,9 +14330,11 @@
var maxRadiusSq = 0;
for ( var i = 0, il = array.length; i < il; i += 3 ) {
for ( var i = 0, il = position.count; i < il; i ++ ) {
vector.fromArray( array, i );
vector.x = position.getX( i );
vector.y = position.getY( i );
vector.z = position.getZ( i );
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );
}
......@@ -15779,11 +15811,15 @@
type = gl.UNSIGNED_INT;
size = 4;
} else {
} else if ( index.array instanceof Uint16Array ) {
type = gl.UNSIGNED_SHORT;
size = 2;
} else {
type = gl.UNSIGNED_BYTE;
size = 1;
}
}
......
此差异已折叠。
......@@ -7759,6 +7759,37 @@ Box3.prototype = {
},
setFromBufferAttribute: function ( attribute ) {
var minX = + Infinity;
var minY = + Infinity;
var minZ = + Infinity;
var maxX = - Infinity;
var maxY = - Infinity;
var maxZ = - Infinity;
for ( var i = 0, l = attribute.count; i < l; i ++ ) {
var x = attribute.getX( i );
var y = attribute.getY( i );
var z = attribute.getZ( i );
if ( x < minX ) minX = x;
if ( y < minY ) minY = y;
if ( z < minZ ) minZ = z;
if ( x > maxX ) maxX = x;
if ( y > maxY ) maxY = y;
if ( z > maxZ ) maxZ = z;
}
this.min.set( minX, minY, minZ );
this.max.set( maxX, maxY, maxZ );
},
setFromPoints: function ( points ) {
this.makeEmpty();
......@@ -14246,11 +14277,11 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
}
var positions = this.attributes.position.array;
var position = this.attributes.position;
if ( positions !== undefined ) {
if ( position !== undefined ) {
this.boundingBox.setFromArray( positions );
this.boundingBox.setFromBufferAttribute( position );
} else {
......@@ -14279,14 +14310,13 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
}
var positions = this.attributes.position;
var position = this.attributes.position;
if ( positions ) {
if ( position ) {
var array = positions.array;
var center = this.boundingSphere.center;
box.setFromArray( array );
box.setFromBufferAttribute( position );
box.getCenter( center );
// hoping to find a boundingSphere with a radius smaller than the
......@@ -14294,9 +14324,11 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
var maxRadiusSq = 0;
for ( var i = 0, il = array.length; i < il; i += 3 ) {
for ( var i = 0, il = position.count; i < il; i ++ ) {
vector.fromArray( array, i );
vector.x = position.getX( i );
vector.y = position.getY( i );
vector.z = position.getZ( i );
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );
}
......@@ -15773,11 +15805,15 @@ function WebGLIndexedBufferRenderer( gl, extensions, infoRender ) {
type = gl.UNSIGNED_INT;
size = 4;
} else {
} else if ( index.array instanceof Uint16Array ) {
type = gl.UNSIGNED_SHORT;
size = 2;
} else {
type = gl.UNSIGNED_BYTE;
size = 1;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册