PlaneGeometry constructor
parameters used to create our PlaneGeometry
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
Defines our PlaneGeometry definition based on the provided parameters
unique id based on width and height segments, used to get PlaneGeometry from cache
number of segments along the X axis
number of segments along the Y axis
total number of segments
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.
Compute the UV and position arrays based on our plane widthSegments and heightSegments values and return the corresponding attributes
number of vertices of our PlaneGeometry
Used to create an indexed plane geometry based on the number of segments along the X and Y axis.
This is how it will look for a 3x2 quad. Indexing will take care of drawing the right vertices in the right order.
Example