diff --git a/docs/api/en/core/InterleavedBufferAttribute.html b/docs/api/en/core/InterleavedBufferAttribute.html index c213727bb12fcc..0a09367a8c9808 100644 --- a/docs/api/en/core/InterleavedBufferAttribute.html +++ b/docs/api/en/core/InterleavedBufferAttribute.html @@ -77,6 +77,9 @@
Returns the given component of the vector at the given index.
+Returns the x component of the item at the given index.
@@ -89,6 +92,9 @@Returns the w component of the item at the given index.
+Sets the given component of the vector at the given index.
+Sets the x component of the item at the given index.
diff --git a/src/core/InterleavedBufferAttribute.js b/src/core/InterleavedBufferAttribute.js index b24fe14ba12e80..47b0f8fb13bc1d 100644 --- a/src/core/InterleavedBufferAttribute.js +++ b/src/core/InterleavedBufferAttribute.js @@ -86,6 +86,26 @@ class InterleavedBufferAttribute { } + getComponent( index, component ) { + + let value = this.array[ index * this.data.stride + this.offset + component ]; + + if ( this.normalized ) value = denormalize( value, this.array ); + + return value; + + } + + setComponent( index, component, value ) { + + if ( this.normalized ) value = normalize( value, this.array ); + + this.data.array[ index * this.data.stride + this.offset + component ] = value; + + return this; + + } + setX( index, x ) { if ( this.normalized ) x = normalize( x, this.array );