|
@@ -10683,7 +10683,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
|
|
|
if ( position && position.isGLBufferAttribute ) {
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this );
|
|
|
+ console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );
|
|
|
|
|
|
this.boundingBox.set(
|
|
|
new Vector3( - Infinity, - Infinity, - Infinity ),
|
|
@@ -10753,7 +10753,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
|
|
|
if ( position && position.isGLBufferAttribute ) {
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this );
|
|
|
+ console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );
|
|
|
|
|
|
this.boundingSphere.set( new Vector3(), Infinity );
|
|
|
|
|
@@ -10870,24 +10870,21 @@ class BufferGeometry extends EventDispatcher {
|
|
|
|
|
|
}
|
|
|
|
|
|
- const indices = index.array;
|
|
|
- const positions = attributes.position.array;
|
|
|
- const normals = attributes.normal.array;
|
|
|
- const uvs = attributes.uv.array;
|
|
|
-
|
|
|
- const nVertices = positions.length / 3;
|
|
|
+ const positionAttribute = attributes.position;
|
|
|
+ const normalAttribute = attributes.normal;
|
|
|
+ const uvAttribute = attributes.uv;
|
|
|
|
|
|
if ( this.hasAttribute( 'tangent' ) === false ) {
|
|
|
|
|
|
- this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
|
|
|
+ this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );
|
|
|
|
|
|
}
|
|
|
|
|
|
- const tangents = this.getAttribute( 'tangent' ).array;
|
|
|
+ const tangentAttribute = this.getAttribute( 'tangent' );
|
|
|
|
|
|
const tan1 = [], tan2 = [];
|
|
|
|
|
|
- for ( let i = 0; i < nVertices; i ++ ) {
|
|
|
+ for ( let i = 0; i < positionAttribute.count; i ++ ) {
|
|
|
|
|
|
tan1[ i ] = new Vector3();
|
|
|
tan2[ i ] = new Vector3();
|
|
@@ -10907,13 +10904,13 @@ class BufferGeometry extends EventDispatcher {
|
|
|
|
|
|
function handleTriangle( a, b, c ) {
|
|
|
|
|
|
- vA.fromArray( positions, a * 3 );
|
|
|
- vB.fromArray( positions, b * 3 );
|
|
|
- vC.fromArray( positions, c * 3 );
|
|
|
+ vA.fromBufferAttribute( positionAttribute, a );
|
|
|
+ vB.fromBufferAttribute( positionAttribute, b );
|
|
|
+ vC.fromBufferAttribute( positionAttribute, c );
|
|
|
|
|
|
- uvA.fromArray( uvs, a * 2 );
|
|
|
- uvB.fromArray( uvs, b * 2 );
|
|
|
- uvC.fromArray( uvs, c * 2 );
|
|
|
+ uvA.fromBufferAttribute( uvAttribute, a );
|
|
|
+ uvB.fromBufferAttribute( uvAttribute, b );
|
|
|
+ uvC.fromBufferAttribute( uvAttribute, c );
|
|
|
|
|
|
vB.sub( vA );
|
|
|
vC.sub( vA );
|
|
@@ -10946,7 +10943,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
|
|
|
groups = [ {
|
|
|
start: 0,
|
|
|
- count: indices.length
|
|
|
+ count: index.count
|
|
|
} ];
|
|
|
|
|
|
}
|
|
@@ -10961,9 +10958,9 @@ class BufferGeometry extends EventDispatcher {
|
|
|
for ( let j = start, jl = start + count; j < jl; j += 3 ) {
|
|
|
|
|
|
handleTriangle(
|
|
|
- indices[ j + 0 ],
|
|
|
- indices[ j + 1 ],
|
|
|
- indices[ j + 2 ]
|
|
|
+ index.getX( j + 0 ),
|
|
|
+ index.getX( j + 1 ),
|
|
|
+ index.getX( j + 2 )
|
|
|
);
|
|
|
|
|
|
}
|
|
@@ -10975,7 +10972,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
|
|
|
function handleVertex( v ) {
|
|
|
|
|
|
- n.fromArray( normals, v * 3 );
|
|
|
+ n.fromBufferAttribute( normalAttribute, v );
|
|
|
n2.copy( n );
|
|
|
|
|
|
const t = tan1[ v ];
|
|
@@ -10991,10 +10988,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
const test = tmp2.dot( tan2[ v ] );
|
|
|
const w = ( test < 0.0 ) ? - 1.0 : 1.0;
|
|
|
|
|
|
- tangents[ v * 4 ] = tmp.x;
|
|
|
- tangents[ v * 4 + 1 ] = tmp.y;
|
|
|
- tangents[ v * 4 + 2 ] = tmp.z;
|
|
|
- tangents[ v * 4 + 3 ] = w;
|
|
|
+ tangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -11007,9 +11001,9 @@ class BufferGeometry extends EventDispatcher {
|
|
|
|
|
|
for ( let j = start, jl = start + count; j < jl; j += 3 ) {
|
|
|
|
|
|
- handleVertex( indices[ j + 0 ] );
|
|
|
- handleVertex( indices[ j + 1 ] );
|
|
|
- handleVertex( indices[ j + 2 ] );
|
|
|
+ handleVertex( index.getX( j + 0 ) );
|
|
|
+ handleVertex( index.getX( j + 1 ) );
|
|
|
+ handleVertex( index.getX( j + 2 ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -51347,7 +51341,7 @@ class Raycaster {
|
|
|
|
|
|
intersectObject( object, recursive = true, intersects = [] ) {
|
|
|
|
|
|
- intersectObject( object, this, intersects, recursive );
|
|
|
+ intersect( object, this, intersects, recursive );
|
|
|
|
|
|
intersects.sort( ascSort );
|
|
|
|
|
@@ -51359,7 +51353,7 @@ class Raycaster {
|
|
|
|
|
|
for ( let i = 0, l = objects.length; i < l; i ++ ) {
|
|
|
|
|
|
- intersectObject( objects[ i ], this, intersects, recursive );
|
|
|
+ intersect( objects[ i ], this, intersects, recursive );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -51377,7 +51371,7 @@ function ascSort( a, b ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
-function intersectObject( object, raycaster, intersects, recursive ) {
|
|
|
+function intersect( object, raycaster, intersects, recursive ) {
|
|
|
|
|
|
if ( object.layers.test( raycaster.layers ) ) {
|
|
|
|
|
@@ -51391,7 +51385,7 @@ function intersectObject( object, raycaster, intersects, recursive ) {
|
|
|
|
|
|
for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
|
|
|
|
- intersectObject( children[ i ], raycaster, intersects, true );
|
|
|
+ intersect( children[ i ], raycaster, intersects, true );
|
|
|
|
|
|
}
|
|
|
|