Geometry constructor
parameters used to create our Geometry
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
Get whether this Geometry is ready to compute, i.e. if its first vertex buffer array has not been created yet
Reset all the vertex buffers when the device is lost
Restore the Geometry buffers on context restoration
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
Create the Geometry vertex buffers.
Upload a GeometryBuffer to the GPU.
Renderer used to upload the buffer.
GeometryBuffer holding a Buffer and a typed array to upload.
Destroy our geometry vertex buffers.
Used to create a Geometry from given parameters like instances count or geometry attributes (vertices, uvs, normals).
Holds all attributes arrays, bounding box and create as WGSL code snippet for the vertex shader input attributes.
During the render, the Geometry is responsible for setting the vertexBuffers and drawing the vertices.
Example