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.
Allow to draw this Geometry with an IndirectBuffer if set.
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.
StaticdequantizeHelper to decode and normalize integer values to float values based on the data type.
TypedArrayConstructor used to know the data type.
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.
Compute a Geometry, which means iterate through all vertex buffers and create the attributes array that will be sent as buffers. Also compute the Geometry bounding box.
Upload a GeometryBuffer to the GPU.
Renderer used to upload the buffer.
GeometryBuffer holding a Buffer and a typed array to upload.
Set the indirectDraw parameters to draw this Geometry with an IndirectBuffer.
indirect draw parameters to use for this Geometry.
Set our vertex buffers then draw the geometry.
current render pass.
Reset all the vertex buffers and index buffer when the device is lost
Restore the IndexedGeometry buffers on context restoration
Compute IndexedGeometry flat normals in case the normal attribute is missing.
Set our indexBuffer
parameters used to create our index buffer
Set the layoutCacheKey and WGSL code snippet that will be appended to the vertex shader.
First, set our render pass geometry vertex buffers Then, set our render pass geometry index buffer
current render pass
Draw our indexed geometry. Can use indirect drawing if indirectDraw is set up.
current render pass.
Set our PlaneGeometry index array
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