gpu-curtains
    Preparing search index...

    Used to create an IndexedGeometry which holds an index array to use as an index buffer.

    The index array represents the order in which the attributes should be processed. This allows to create smaller vertex, uv and normal arrays.

    During the render, the IndexedGeometry is responsible for setting the vertexBuffers and drawing the indexed vertices.

    const vertices = new Float32Array([
    -1, -1, 0,
    1, -1, 0,
    -1, 1, 0,
    1, 1, 0
    ])

    // vertices index (order in which they should be drawn)
    const indexArray = new Uint16Array([0, 2, 1, 1, 2, 3])

    // create an indexed quad geometry made of 4 vertices
    const indexedGeometry = new IndexedGeometry()

    indexedGeometry.setAttribute({
    name: 'position',
    type: 'vec3f',
    bufferFormat: 'float32x3',
    size: 3,
    bufferLength: vertices.length,
    array: vertices,
    })

    indexedGeometry.setIndexBuffer({
    array: indexArray,
    bufferFormat: 'uint16',
    })

    Hierarchy (View Summary)

    Index

    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

    Methods