MeshAttributeAccessor
MeshAttributeAccessor
An iterator over a mesh vertex attribute
Kind: global class
.createArray (count) ⇒ Uint8Array | Uint16Array | Uint32Array | Int32Array | Float32Array
Create a new TypedArray to hold this attribute values.
This method is useful to create a view to hold the data to pass to MeshAttributeAccessor.get and MeshAttributeAccessor.set
Example:
Kind: instance method of MeshAttributeAccessor
Returns: Uint8Array | Uint16Array | Uint32Array | Int32Array | Float32Array - A TypedArray
with the appropriate format to access the data
Param | Type | Default | Description |
---|---|---|---|
count | number | 1 | The number of vertices expected. |
.get (i, out)
Get attribute element
Kind: instance method of MeshAttributeAccessor
Param | Type | Description |
---|---|---|
i | number | Index |
out | Array.<number> | Float32Array | Uint32Array | Preallocated array to write into, to avoid garbage, otherwise will allocate a new TypedArray. out.length needs to be a multiple of the attributes component count, see MeshAttribute. If out.length is more than one multiple, it will be filled with the next n attribute elements, which can reduce overhead of this call. |
.set (i, v) ⇒ MeshAttributeAccessor
Set attribute element
Kind: instance method of MeshAttributeAccessor
Returns: MeshAttributeAccessor - Reference to self (for method chaining)
Param | Type | Description |
---|---|---|
i | number | Index |
v | Array.<number> | Float32Array | Uint32Array | Value to set the element to v.length needs to be a multiple of the attributes component count, see MeshAttribute. If v.length is more than one multiple, it will be filled with the next n attribute elements, which can reduce overhead of this call. |