Nano WebGPU API - v0.11.0
    Preparing search index...

    Class Geometry

    Geometry encapsulates physical vertex and index GPUBuffers allocated in VRAM, standardizing heterogeneous coordinate data into uniform 11-float vertex formats.

    Index

    Constructors

    • Instantiates a new Geometry resource block, allocating and writing vertex and index buffers. Programmatically expands and translates raw coordinates into standard 11-float GPU formats (pos:3, norm:3, uv:2, color:3).

      Parameters

      • ctx: Context

        Active framework context.

      • vertices: Float32Array

        Source raw float vertex components.

      • indices: Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

        Source index arrays.

      • options: {
            hasColors?: boolean;
            hasNormals?: boolean;
            hasUVs?: boolean;
            topology?: GPUPrimitiveTopology;
        } = {}

        Attribute specifications and topology overrides.

      Returns Geometry

    Methods

    • Releases vertex and index buffers from GPU memory and unregisters resources from VRAM trackers.

      Parameters

      • ctx: Context

        Shared context instance.

      Returns void

    Properties

    hasColors: boolean = false

    Boolean flag showing if the source array contained vertex color components.

    hasNormals: boolean = false

    Boolean flag showing if the source array contained surface normal components.

    hasUVs: boolean = false

    Boolean flag showing if the source array contained UV coordinate components.

    id: number

    Unique runtime geometry block identifier.

    indexBuffer: GPUBuffer

    GPUBuffer instance containing index element arrays.

    indexCount: number = 0

    Total index elements present in the index buffer.

    indexFormat: GPUIndexFormat = "uint16"

    Index mapping format (either "uint16" or "uint32").

    topology: GPUPrimitiveTopology = "triangle-list"

    GPU primitive assembly topology configuration.

    vertexBuffer: GPUBuffer

    GPUBuffer instance containing interleaved vertex attribute components.

    vertexCount: number = 0

    Total vertex elements present in the vertex buffer.