Capítulo 388 de 859
A special type of uniform node which represents array-like data as uniform buffers. The access usually happens via element() which returns an instance of ArrayElementNode. For example:
In general, it is recommended to use the more managed UniformArrayNode since it handles more input types and automatically cares about buffer paddings.
const bufferNode = buffer( array, 'mat4', count );
const matrixNode = bufferNode.element( index ); // access a matrix from the buffer
Constructor
| Signature |
|---|
new BufferNode( value : Array.<number>, bufferType : string, bufferCount : number ) |
Properties
| Property | Description |
|---|---|
.bufferCount : number | The uniform node that holds the value of the reference node. |
.bufferType : string | The data type of the buffer. |
.isBufferNode : boolean (readonly) | This flag can be used for type testing. |
.updateRanges : Array.<{start: number, count: number}> | An array of update ranges. |
Methods
| Method | Description |
|---|---|
.addUpdateRange( start : number, count : number ) | Adds a range of data in the data array to be updated on the GPU. |
.clearUpdateRanges() | Clears the update ranges. |
.getElementType( builder : NodeBuilder ) : string | The data type of the buffer elements. |
.getInputType( builder : NodeBuilder ) : string | Overwrites the default implementation to return a fixed value 'buffer'. |