[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

.[page: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].

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

.[page:Integer length]

Gives the total number of elements in the array.

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

.copyAt ( [page:Integer index1], attribute, [page:Integer index2] )

Copies itemSize values in the array from the vertex at index2 to the vertex at index1.

.set ( [page:Array value] )

Sets the associated array with values from the passed array.

.setX ( index, x )

Sets the value of the array at index * itemSize to x

.setY ( index, y )

Sets the value of the array at index * itemSize + 1 to y

.setZ ( index, z )

Sets the value of the array at index * itemSize + 2 to z

.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

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

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

.clone ()

Copies this attribute.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]