Helper to easily create 3D sphere indexed geometries.

Example

const sphereGeometry = new SphereGeometry()

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

indirectDraw: IndirectDrawParams

Allow to draw this Geometry with an IndirectBuffer if set.

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

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