BufferInterleavedArrayElement constructor
parameters used to create our BufferInterleavedArrayElement
Initial length of the input buffer binding array
Total number of elements (i.e. arrayLength divided by buffer layout number of elements
Number of bytes in the ArrayBuffer between two elements startOffset
The name of the BufferElement
The WGSL variable type of the BufferElement
The key of the BufferElement
BufferLayout used to fill the buffer binding array at the right offsets
Object defining exactly at which place a binding should be inserted into the buffer binding array
Optional
viewArray containing the BufferElement values
Function assigned to set the view values
Function assigned to set the view values
Corresponding DataView set function based on view type
Optional
littleEndian: booleanOptional
littleEndian: booleanOptional
littleEndian: booleanOptional
littleEndian: booleanGet the array stride between two elements of the array, in indices
Get the total number of rows used by this BufferElement
Get the total number of bytes used by this BufferElement, including final padding
Get the offset (i.e. byte index) at which our BufferElement starts
Get the array offset (i.e. array index) at which our BufferElement starts
Get the offset (i.e. byte index) at which our BufferElement ends
Get the array offset (i.e. array index) at which our BufferElement ends
Get the total number of slots used by this BufferInterleavedArrayElement based on buffer layout size and total number of elements
Set the strided view value from an array
array to use
Get the position at given offset (i.e. byte index)
byte index to use
Get the number of bytes at a given position
position from which to count
Check that a byte position does not overflow its max value (16)
Get the number of bytes between two positions
first position
second position
Compute the right alignment (i.e. start and end rows and bytes) given the size and align properties and the next available position
next position at which we should insert this element
position at which to start inserting the values in the buffer binding array
Set the view value from a float or an int
float or int to use
Set the view value from an array with pad applied
array to use
Set the alignment To compute how arrays are packed, we need to compute the arrayStride between two elements beforehand and pass it here. Using the arrayStride and the total number of elements, we can easily get the end alignment position.
offset at which to start inserting the values in the buffer binding array
Stride in the ArrayBuffer between two elements of the array
Set the view and viewSetFunction
Update the view based on the new value, and then update the buffer binding array view using sub arrays
new value to use
Extract the data corresponding to this specific BufferInterleavedArrayElement from a Float32Array holding the GPUBuffer data of the parentMesh BufferBinding
Float32Array holding GPUBuffer data
Used to compute alignment when dealing with arrays of Struct