Options
All
  • Public
  • Public/Protected
  • All
Menu

Geometry class to hold buffers and attributes for a mesh. Accepts the data that makes up your model - indices, vertices, uvs, normals, etc. The only required attribute & buffer to render is "position"

Hierarchy

  • Geometry

Index

Constructors

constructor

  • new Geometry(gl: WebGLRenderingContext): Geometry

Properties

Private #gl

#gl: WebGLRenderingContext

attributes

attributes: Map<any, any> = ...

vertexCount

vertexCount: number = 0

Methods

addAttribute

  • addAttribute(key: string, params: WebGLArrayBufferInterface): Geometry
  • description

    Add attribute as array buffer

    Parameters

    • key: string

      Name of attribute. Must match attribute name in your GLSL program

    • params: WebGLArrayBufferInterface

    Returns Geometry

addIndex

  • addIndex(params: WebGLElementBufferInterface): Geometry
  • description

    Set data into element array buffer

    Parameters

    • params: WebGLElementBufferInterface

    Returns Geometry

delete

  • delete(): void
  • description

    Delete all buffers associated with this geometry

    Returns void

updateAttribute

  • updateAttribute(key: string, index: number, size: number, subTypeArray: Float32Array): Geometry
  • Parameters

    • key: string

      Name of attribute. Must match attribute name in your GLSL program

    • index: number

      Index to start updating your typed array from

    • size: number

      How many items are to be updated

    • subTypeArray: Float32Array

      The whole or partial array to update your attribute with

    Returns Geometry

Generated using TypeDoc