[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:Array array], [page:Integer itemSize])

Instantiates this attibute with data from the associated buffer. The array can either be a regular Array or a Typed Array. itemSize gives the number of values of the array that should be associated with a particular vertex.

Properties

[property:Array array]

Stores the data associated with this attribute; can be an Array or a Typed Array. This element should have itemSize * numVertices elements, where numVertices is the number of vertices in the associated [page:BufferGeometry geometry].

[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.

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]