From 66edc17fffcc7bf14bbc51ec36c0a2d6042f99e5 Mon Sep 17 00:00:00 2001
From: Garrett Johnson
Date: Fri, 19 Jan 2024 13:01:18 +0900
Subject: [PATCH 1/2] InterleavedBufferAttribute: add getComponent,
setComponent
---
src/core/InterleavedBufferAttribute.js | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
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 );
From 4fe81492817772c8663a696db3e25dad5064f778 Mon Sep 17 00:00:00 2001
From: Garrett Johnson
Date: Fri, 19 Jan 2024 13:03:10 +0900
Subject: [PATCH 2/2] Update docs
---
docs/api/en/core/InterleavedBufferAttribute.html | 6 ++++++
1 file changed, 6 insertions(+)
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 @@ [method:this transformDirection]( [param:Matrix4 m] )
vectors.
+ [method:Number getComponent]( [param:Integer index], [param:Integer component] )
+ Returns the given component of the vector at the given index.
+
[method:Number getX]( [param:Integer index] )
Returns the x component of the item at the given index.
@@ -89,6 +92,9 @@ [method:Number getZ]( [param:Integer index] )
[method:Number getW]( [param:Integer index] )
Returns the w component of the item at the given index.
+ [method:Number setComponent]( [param:Integer index], [param:Integer component], [param:Float value] )
+ Sets the given component of the vector at the given index.
+
[method:this setX]( [param:Integer index], [param:Float x] )
Sets the x component of the item at the given index.