This class stores data for an attribute (such as vertex positions, face indices, normals,
colors, UVs, and any custom attributes ) associated with a [page:BufferGeometry], which allows
for more efficient passing of data to the GPU. See that page for details and a usage example.
Data is stored as vectors of any length (defined by [page:BufferAttribute.itemSize itemSize]),
and in general in the methods outlined below if passing in an index, this is automatically
multiplied by the vector length.
[page:TypedArray array] -- Must be a [link:https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/TypedArray TypedArray].
Used to instantiate the buffer.
This array should have
itemSize * numVertices
elements, where numVertices is the number of vertices in the associated [page:BufferGeometry BufferGeometry].
[page:Integer itemSize] -- the number of values of the array that should be associated with
a particular vertex. For instance, if this
attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
[page:Boolean normalized] -- (optional) Applies to integer data only. Indicates how the underlying data
in the buffer maps to the values in the GLSL code. For instance, if [page:TypedArray array] is an instance
of UInt16Array, and [page:Boolean normalized] is true, the values 0 - +65535 in the array
data will be mapped to 0.0f - +1.0f in the GLSL attribute. An Int16Array (signed) would map
from -32767 - +32767 to -1.0f - +1.0f. If [page:Boolean normalized] is false, the values
will be converted to floats unmodified, i.e. 32767 becomes 32767.0f.
The [page:TypedArray array] holding data stored in the buffer.
Stores the [page:BufferAttribute.array array]'s length divided by the [page:BufferAttribute.itemSize itemSize].
If the buffer is storing a 3-component vector (such as a position, normal, or color),
then this will count the number of such vectors stored.
Whether the buffer is dynamic or not. Default is *false*.
If false, the GPU is informed that contents of the buffer are likely to be used often and not change often.
This corresponds to the [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData gl.STATIC_DRAW] flag.
if true, the GPU is informed that contents of the buffer are likely to be used often and change often.
This corresponds to the [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData gl.DYNAMIC_DRAW] flag.
Used to check whether this or derived classes are BufferAttributes. Default is *true*.
You should not change this, as it used internally for optimisation.
The length of vectors that are being stored in the [page:BufferAttribute.array array].
Optional name for this attribute instance. Default is an empty string.
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 array.
Setting this to true also increments the [page:BufferAttribute.version version].
Indicates how the underlying data in the buffer maps to the values in the GLSL shader code. See the constructor above for details.
A callback function that is executed after the Renderer has transferred the attribute array data to the GPU.
Object containing:
[page:Integer offset]: Default is *0*. Position at which to start update.
[page:Integer count]: Default is *-1*, which means don't use update ranges.
This can be used to only update some components of stored vectors (for example, just the component
related to color).
A version number, incremented every time the [page:BufferAttribute.needsUpdate needsUpdate] property is set to true.
Return a copy of this bufferAttribute.
Copies another BufferAttribute to this BufferAttribute.
Copy the array given here (which can be a normal array or TypedArray) into
[page:BufferAttribute.array array].
See [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set]
for notes on requirements if copying a TypedArray.
Copy a vector from bufferAttribute[index2] to [page:BufferAttribute.array array][index1].
Copy an array representing RGB color values into [page:BufferAttribute.array array].
Copy an array representing [page:Vector2]s into [page:BufferAttribute.array array].
Copy an array representing [page:Vector3]s into [page:BufferAttribute.array array].
Copy an array representing [page:Vector4]s into [page:BufferAttribute.array array].
Returns the x component of the vector at the given index.
Returns the y component of the vector at the given index.
Returns the z component of the vector at the given index.
Returns the w component of the vector at the given index.
Sets the value of the onUploadCallback property.
In the [example:webgl_buffergeometry WebGL / Buffergeometry] this is used to free memory
after the buffer has been transferred to the GPU.
value -- an [page:Array] or [page:TypedArray] from which to copy values.
offset -- (optional) index of the [page:BufferAttribute.array array] at which to start copying.
Calls [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set]( [page:Array value], [page:Integer offset] )
on the [page:BufferAttribute.array array].
In particular, see that page for requirements on [page:Array value]
being a [page:TypedArray].
Set [page:BufferAttribute.dynamic dynamic] to value.
Sets the x component of the vector at the given index.
Sets the y component of the vector at the given index.
Sets the z component of the vector at the given index.
Sets the w component of the vector at the given index.
Sets the x and y components of the vector at the given index.
Sets the x, y and z components of the vector at the given index.
Sets the x, y, z and w components of the vector at the given index.
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]