IndexedGeometry constructor
parameters used to create our IndexedGeometry
Number of vertices defined by this geometry
Vertices order to be drawn by the render pipeline
Number of instances of this geometry to draw
Array of vertex buffers to use with this geometry
Options used to create this geometry
The type of the geometry
The universal unique id of the geometry
The bounding box of the geometry, i.e. two Vec3 defining the min and max positions to wrap this geometry in a cube
A string to append to our shaders code describing the WGSL structure representing this geometry attributes
A string representing the vertexBuffers layout, used for pipelines caching
A Set to store this Geometry consumers (Mesh uuid)
Whether this geometry is ready to be drawn, i.e. it has been computed and all its vertex buffers have been created
Object containing our index buffer format & length, array and GPUBuffer
Get whether this Geometry is ready to compute, i.e. if its first vertex buffer array has not been created yet
If we have less than 65.536 vertices, we should use a Uin16Array to hold our index buffer values
Add a vertex buffer to our Geometry, set its attributes and return it
vertex buffer parameters
Get a vertex buffer by name
our vertex buffer name
Set a vertex buffer attribute
attributes parameters
Get an attribute by name
name of the attribute to find
Upload a GeometryBuffer to the GPU.
Renderer used to upload the buffer.
GeometryBuffer holding a Buffer and a typed array to upload.
Reset all the vertex buffers and index buffer when the device is lost
Restore the IndexedGeometry buffers on context restoration
Set our indexBuffer
parameters used to create our index buffer
Create the Geometry vertex buffers and index buffer.
Destroy our indexed geometry vertex buffers and index buffer.
Used to create an IndexedGeometry which holds an index array to use as an index buffer.
The index array represents the order in which the attributes should be processed. This allows to create smaller vertex, uv and normal arrays.
During the render, the IndexedGeometry is responsible for setting the vertexBuffers and drawing the indexed vertices.
Example