API / geotoolkit / webgl / BufferAttribute / BufferAttribute
webgl.BufferAttribute.BufferAttribute
This class stores data for an attribute, which allows for more efficient passing of data to the GPU.
Throws
BufferAttribute should be a typed array
Constructors
• new BufferAttribute(array, itemSize, normalized?, dynamic?)
Create BufferAttribute
| Name | Type | Description |
|---|---|---|
array | TypedArray | typed array |
itemSize | number | the number of values of the array that associated with a particular vertex |
Optional normalized | boolean | Applies to integer data only. Indicates how the underlying data in the buffer maps to the values in the GLSL code |
Optional dynamic | boolean | Defines the intended usage pattern of the data store for optimization purposes |
Methods
▸ get(offset): number
Return a value at given position in array
Note that this should not be confused with index of vertex.
| Name | Type | Description |
|---|---|---|
offset | number | the offset of array |
number
value
▸ getArray(): TypedArray
Return the typed array in the buffer
array typed array
▸ getAttributes(): Attributes
Return attributes for this BufferAttribute
The attributes
▸ set(value, offset): BufferAttribute
Set a value at given position in array
Note that this should not be confused with index of vertex.
| Name | Type | Description |
|---|---|---|
value | number | the value to be set |
offset | number | the offset of array. Note this should not be confused with index of vertices. |
this
▸ setArray(array): BufferAttribute
Set the typed array in the buffer
Throws
TypeError if array is not a Typed Array
| Name | Type | Description |
|---|---|---|
array | number[] | typed array |
this
▸ setDynamic(dynamic): BufferAttribute
Whether the buffer is updated dynamically or not.
| Name | Type | Description |
|---|---|---|
dynamic | boolean | the dynamic flag |
this
▸ setName(name): BufferAttribute
Set name for this attribute
| Name | Type | Description |
|---|---|---|
name | string | the attribute name |
this