Browse Source

Change vertex position fetch to use fromBufferAttribute instead of inlined access.

manthrax 4 years ago
parent
commit
bb621fcc31
1 changed files with 2 additions and 3 deletions
  1. 2 3
      src/objects/Points.js

+ 2 - 3
src/objects/Points.js

@@ -71,7 +71,6 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
 			const attributes = geometry.attributes;
 			const positions = attributes.position.array;
 			const stride = attributes.position.isInterleavedBufferAttribute ? attributes.position.data.stride : 3;
-			const offset = attributes.position.isInterleavedBufferAttribute ? attributes.position.offset : 0;
 
 			if ( index !== null ) {
 
@@ -81,7 +80,7 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 					const a = indices[ i ];
 
-					_position.fromArray( positions, a * stride + offset );
+					_position.fromBufferAttribute( attributes.position, a );
 
 					testPoint( _position, a, localThresholdSq, matrixWorld, raycaster, intersects, this );
 
@@ -91,7 +90,7 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 				for ( let i = 0, l = positions.length / stride; i < l; i ++ ) {
 
-					_position.fromArray( positions, i * stride + offset );
+					_position.fromBufferAttribute( attributes.position, i );
 
 					testPoint( _position, i, localThresholdSq, matrixWorld, raycaster, intersects, this );