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.

 3---2---1---0
 |  /|  /|  /|
 |/  |/  |/  |
 7---6---5---4
 |  /|  /|  /|
 |/  |/  |/  |
 11--10--9---8

Example

const planeGeometry = new PlaneGeometry()

Hierarchy (view full)

Constructors

Properties

verticesCount: number

Number of vertices defined by this geometry

verticesOrder: GPUFrontFace

Vertices order to be drawn by the render pipeline

topology: GPUPrimitiveTopology

Topology to use with this Geometry, i.e. whether to draw triangles or points

instancesCount: number

Number of instances of this geometry to draw

vertexBuffers: VertexBuffer[]

Array of vertex buffers to use with this geometry

Options used to create this geometry

type: string

The type of the geometry

uuid: string

The universal unique id of the geometry

boundingBox: Box3

The bounding box of the geometry, i.e. two Vec3 defining the min and max positions to wrap this geometry in a cube

wgslStructFragment: string

A string to append to our shaders code describing the WGSL structure representing this geometry attributes

layoutCacheKey: string

A string representing the vertexBuffers layout, used for pipelines caching

consumers: Set<string>

A Set to store this Geometry consumers (Mesh uuid)

ready: boolean

Whether this geometry is ready to be drawn, i.e. it has been computed and all its vertex buffers have been created

indexBuffer: IndexBuffer

Object containing our index buffer format & length, array and GPUBuffer

definition: {
    id: number;
    width: number;
    height: number;
    count: number;
}

Defines our PlaneGeometry definition based on the provided parameters

Type declaration

  • id: number

    unique id based on width and height segments, used to get PlaneGeometry from cache

  • width: number

    number of segments along the X axis

  • height: number

    number of segments along the Y axis

  • count: number

    total number of segments

Accessors

  • get shouldCompute(): boolean
  • Get whether this Geometry is ready to compute, i.e. if its first vertex buffer array has not been created yet

    Returns boolean

  • get useUint16IndexArray(): boolean
  • If we have less than 65.536 vertices, we should use a Uin16Array to hold our index buffer values

    Returns boolean

Methods