[name]
This class stores data for an attribute associated with a [page:BufferGeometry]. See that page for details and a usage example. This class is used to store builtin attributes such as vertex position, normals, color, etc., but can also be used in your code to store custom attributes in a [page:BufferGeometry].
Constructor
[name]( [page:TypedArray array], [page:Integer itemSize], [page:Boolean normalized] )
Instantiates this attribute with data from the associated buffer.
itemSize gives the number of values of the array that should be associated with a particular vertex. normalized indicates how the underlying data in the buffer maps to the values in the GLSL shader code.
Properties
[property:TypedArray array]
Stores the data associated with this attribute. This element should have itemSize * numVertices
elements, where numVertices is the number of vertices in the associated [page:BufferGeometry geometry]. [page:TypedArray array] can be an instance of UInt8Array, Int8Array, UInt16Array, Int16Array, or Float32Array.
[property:Integer itemSize]
Records how many items of the array are 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.
[property:Integer length]
Gives the total number of elements in the array.
[property:Boolean needsUpdate]
Flag to indicate that this attribute has changed and should be re-send to the GPU. Set this to true when you modify the value of the array.
[property:Boolean normalized]
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 which contain the exact value, i.e. 32767 becomes 32767.0f.
[property:Integer version]
A version number, incremented every time the needsUpdate property is set to true.
Methods
[method:null copyAt] ( [page:Integer index1], attribute, [page:Integer index2] )
Copies itemSize values in the array from the vertex at index2 to the vertex at index1.
[method:null set] ( [page:Array value] )
Sets the associated array with values from the passed array.
[method:null setX]( index, x )
Sets the value of the array at index * itemSize
to x
[method:null setY]( index, y )
Sets the value of the array at index * itemSize + 1
to y
[method:null setZ]( index, z )
Sets the value of the array at index * itemSize + 2
to z
[method:null setXY]( index, x, y )
Sets the value of the array at index * itemSize
to x and
sets the value of the array at index * itemSize + 1
to y
[method:null setXYZ]( index, x, y, z )
Sets the value of the array at index * itemSize
to x,
the value of the array at index * itemSize + 1
to y, and
the value of the array at index * itemSize + 2
to z.
[method:null setXYZW]( index, x, y, z, w )
Sets the value of the array at index * itemSize
to x,
the value of the array at index * itemSize + 1
to y,
the value of the array at index * itemSize + 2
to z, and
the value of the array at index * itemSize + 3
to w.
[method:BufferAttribute clone]()
Copies this attribute.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]