new UniformBuffer()
Storage for uniform data. Data is stored in std140 layout.
Properties:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | The WebGL context. |
buffer |
WebGLBuffer | Allocated buffer storage. |
data |
Float32Array | Buffer data. |
dataViews |
Object | Map of base data types to matching ArrayBufferViews of the buffer data. |
offsets |
Array | Offsets into the array for each item in the buffer. |
sizes |
Array | Size of the item at the given offset. |
types |
Array | The base type of the item at the given offset (FLOAT, INT or UNSIGNED_INT). |
size |
number | The size of the buffer (in 4-byte items). |
usage |
GLenum | Usage pattern of the buffer. |
- Source:
Methods
delete() → {UniformBuffer}
Delete this uniform buffer.
- Source:
Returns:
The UniformBuffer object.
- Type
- UniformBuffer
restore() → {UniformBuffer}
Restore uniform buffer after context loss.
- Source:
Returns:
The UniformBuffer object.
- Type
- UniformBuffer
set(index, value) → {UniformBuffer}
Update data for a given item in the buffer. NOTE: Data is not
sent the the GPU until the update() method is called!
Parameters:
Name | Type | Description |
---|---|---|
index |
number | Index in the layout of item to set. |
value |
ArrayBufferView | Value to store at the layout location. |
- Source:
Returns:
The UniformBuffer object.
- Type
- UniformBuffer
update() → {UniformBuffer}
Send stored buffer data to the GPU.
- Source:
Returns:
The UniformBuffer object.
- Type
- UniformBuffer