Capítulo 670 de 859

Chapter 670: InterleavedBufferAttribute

Core Idea

An alternative version of a buffer attribute with interleaved data. Interleaved attributes share a common interleaved data storage (InterleavedBuffer) and refer with different offsets into the buffer.

Key Concepts

  • array : TypedArray: The array holding the interleaved buffer attribute data.
  • count : number (readonly): The item count of this buffer attribute.
  • data : InterleavedBuffer: The buffer holding the interleaved data.
  • isInterleavedBufferAttribute : boolean (readonly): This flag can be used for type testing.
  • itemSize : number: The item size, see BufferAttribute#itemSize.
  • name : string: The name of the buffer attribute.
  • needsUpdate : number: Flag to indicate that this attribute has changed and should be re-sent to the GPU. Set this to true when you modify the value of the arra…
  • normalized : InterleavedBuffer: Whether the data are normalized or not, see BufferAttribute#normalized
  • offset : number: The attribute offset into the buffer.

Reference Tables

Constructor

Signature
new InterleavedBufferAttribute( interleavedBuffer : InterleavedBuffer, itemSize : number, offset : number, normalized : boolean )

Properties

PropertyDescription
.array : TypedArrayThe array holding the interleaved buffer attribute data.
.count : number (readonly)The item count of this buffer attribute.
.data : InterleavedBufferThe buffer holding the interleaved data.
.isInterleavedBufferAttribute : boolean (readonly)This flag can be used for type testing.
.itemSize : numberThe item size, see BufferAttribute#itemSize.
.name : stringThe name of the buffer attribute.
.needsUpdate : numberFlag to indicate that this attribute has changed and should be re-sent to the GPU. Set this to true when you modify the value of the array.
.normalized : InterleavedBufferWhether the data are normalized or not, see BufferAttribute#normalized
.offset : numberThe attribute offset into the buffer.

Methods

MethodDescription
.applyMatrix4( m : Matrix4 ) : InterleavedBufferAttributeApplies the given 4x4 matrix to the given attribute. Only works with item size 3.
.applyNormalMatrix( m : Matrix3 ) : InterleavedBufferAttributeApplies the given 3x3 normal matrix to the given attribute. Only works with item size 3.
`.clone( data : Object ) : BufferAttributeInterleavedBufferAttribute`
.getComponent( index : number, component : number ) : numberReturns the given component of the vector at the given index.
.getW( index : number ) : numberReturns the w component of the vector at the given index.
.getX( index : number ) : numberReturns the x component of the vector at the given index.
.getY( index : number ) : numberReturns the y component of the vector at the given index.
.getZ( index : number ) : numberReturns the z component of the vector at the given index.
.setComponent( index : number, component : number, value : number ) : InterleavedBufferAttributeSets the given value to the given component of the vector at the given index.
.setW( index : number, w : number ) : InterleavedBufferAttributeSets the w component of the vector at the given index.
.setX( index : number, x : number ) : InterleavedBufferAttributeSets the x component of the vector at the given index.
.setXY( index : number, x : number, y : number ) : InterleavedBufferAttributeSets the x and y component of the vector at the given index.
.setXYZ( index : number, x : number, y : number, z : number ) : InterleavedBufferAttributeSets the x, y and z component of the vector at the given index.
.setXYZW( index : number, x : number, y : number, z : number, w : number ) : InterleavedBufferAttributeSets the x, y, z and w component of the vector at the given index.
.setY( index : number, y : number ) : InterleavedBufferAttributeSets the y component of the vector at the given index.
.setZ( index : number, z : number ) : InterleavedBufferAttributeSets the z component of the vector at the given index.
.toJSON( data : Object ) : ObjectSerializes the buffer attribute into JSON.
.transformDirection( m : Matrix4 ) : InterleavedBufferAttributeApplies the given 4x4 matrix to the given attribute. Only works with item size 3 and with direction vectors.

Key Takeaways

  1. Most relevant properties: array, count, data, isInterleavedBufferAttribute.
  2. Key methods: applyMatrix4, applyNormalMatrix, clone, getComponent.

Connects To