|
@@ -8,6 +8,8 @@ import { StaticDrawUsage } from '../constants.js';
|
|
* @author mrdoob / http://mrdoob.com/
|
|
* @author mrdoob / http://mrdoob.com/
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+var _vector = new Vector3();
|
|
|
|
+
|
|
function BufferAttribute( array, itemSize, normalized ) {
|
|
function BufferAttribute( array, itemSize, normalized ) {
|
|
|
|
|
|
if ( Array.isArray( array ) ) {
|
|
if ( Array.isArray( array ) ) {
|
|
@@ -191,6 +193,78 @@ Object.assign( BufferAttribute.prototype, {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ applyMatrix3: function ( m ) {
|
|
|
|
+
|
|
|
|
+ for ( var i = 0, l = this.count; i < l; i ++ ) {
|
|
|
|
+
|
|
|
|
+ _vector.x = this.getX( i );
|
|
|
|
+ _vector.y = this.getY( i );
|
|
|
|
+ _vector.z = this.getZ( i );
|
|
|
|
+
|
|
|
|
+ _vector.applyMatrix3( m );
|
|
|
|
+
|
|
|
|
+ this.setXYZ( i, _vector.x, _vector.y, _vector.z );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ applyMatrix4: function ( m ) {
|
|
|
|
+
|
|
|
|
+ for ( var i = 0, l = this.count; i < l; i ++ ) {
|
|
|
|
+
|
|
|
|
+ _vector.x = this.getX( i );
|
|
|
|
+ _vector.y = this.getY( i );
|
|
|
|
+ _vector.z = this.getZ( i );
|
|
|
|
+
|
|
|
|
+ _vector.applyMatrix4( m );
|
|
|
|
+
|
|
|
|
+ this.setXYZ( i, _vector.x, _vector.y, _vector.z );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ applyNormalMatrix: function ( m ) {
|
|
|
|
+
|
|
|
|
+ for ( var i = 0, l = this.count; i < l; i ++ ) {
|
|
|
|
+
|
|
|
|
+ _vector.x = this.getX( i );
|
|
|
|
+ _vector.y = this.getY( i );
|
|
|
|
+ _vector.z = this.getZ( i );
|
|
|
|
+
|
|
|
|
+ _vector.applyNormalMatrix( m );
|
|
|
|
+
|
|
|
|
+ this.setXYZ( i, _vector.x, _vector.y, _vector.z );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ transformDirection: function ( m ) {
|
|
|
|
+
|
|
|
|
+ for ( var i = 0, l = this.count; i < l; i ++ ) {
|
|
|
|
+
|
|
|
|
+ _vector.x = this.getX( i );
|
|
|
|
+ _vector.y = this.getY( i );
|
|
|
|
+ _vector.z = this.getZ( i );
|
|
|
|
+
|
|
|
|
+ _vector.transformDirection( m );
|
|
|
|
+
|
|
|
|
+ this.setXYZ( i, _vector.x, _vector.y, _vector.z );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
set: function ( value, offset ) {
|
|
set: function ( value, offset ) {
|
|
|
|
|
|
if ( offset === undefined ) offset = 0;
|
|
if ( offset === undefined ) offset = 0;
|