Small World Engine API Reference - v0.46.1
    Preparing search index...

    Class Mesh

    Wrapper for WebGL vertex and index buffers. Handles both indexed and non-indexed geometry.

    Index

    Constructors

    • Creates a new Mesh and uploads the geometry data to the GPU.

      Parameters

      • gl: WebGLRenderingContext | WebGL2RenderingContext

        The WebGL context.

      • data: GeometryDataInterface

        The geometry data to upload.

      Returns Mesh

    Properties

    count: number

    The number of elements (indices or vertices) to draw.

    ebo: WebGLBuffer | undefined

    The element buffer object (indices).

    indexType: number = 0

    The GL data type of the indices (e.g., UNSIGNED_SHORT or UNSIGNED_INT).

    isIndexed: boolean = false

    Whether this mesh uses indices for drawing.

    nbo: WebGLBuffer | undefined = undefined

    The normal buffer object.

    tanbo: WebGLBuffer | undefined = undefined

    The tangent buffer object.

    tbo: WebGLBuffer | undefined = undefined

    The texture coordinate buffer object.

    vbo: WebGLBuffer | undefined

    The vertex buffer object.

    webo: WebGLBuffer | undefined

    The wireframe element buffer object.

    wireframeCount: number = 0

    The number of wireframe elements.

    wireframeIndexType: number = 0

    The GL data type of the wireframe indices.

    Methods

    • Binds the buffers and sets the vertex attributes.

      Parameters

      • posLoc: number

        The location of the position attribute.

      • normLoc: number = -1

        The location of the normal attribute.

      • uvLoc: number = -1

        The location of the UV attribute.

      • tanLoc: number = -1

        The location of the tangent attribute.

      Returns void

    • Draws the mesh using the appropriate GL call.

      Parameters

      • mode: number

        The draw mode (e.g. TRIANGLES, LINES).

      Returns void