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

    Class ModelGeometry

    A geometry implementation for externally loaded models (e.g. from OBJ files). Holds raw data provided during construction.

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new ModelGeometry from provided raw data.

      Parameters

      • vertices: number[] | Float32Array<ArrayBufferLike>

        Raw vertex positions.

      • uvs: number[] | Float32Array<ArrayBufferLike>

        Raw texture coordinates.

      • normals: number[] | Float32Array<ArrayBufferLike>

        Raw vertex normals.

      • indices: number[] | Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

        Raw triangle indices.

      Returns ModelGeometry

    Properties

    _cachedBoundingVolume: BoundingVolume | undefined = undefined

    Cached bounding volume to prevent re-allocation

    _indices:
        | Uint16Array<ArrayBufferLike>
        | Uint32Array<ArrayBufferLike>
        | undefined = undefined

    The indices of the geometry for indexed rendering.

    _isLineGeometry: boolean = false

    Whether the geometry is purely line-based.

    _normals: Float32Array = ...

    The normals of the geometry (nx, ny, nz).

    _tangents: Float32Array = ...

    The tangents of the geometry (tx, ty, tz).

    _uvs: Float32Array = ...

    The UV coordinates of the geometry (u, v).

    _vertices: Float32Array = ...

    The vertices of the geometry (x, y, z).

    _wireframeIndices:
        | Uint16Array<ArrayBufferLike>
        | Uint32Array<ArrayBufferLike>
        | undefined = undefined

    The indices for wireframe rendering.

    Methods

    • Helper method to create an appropriately sized index array. Automatically chooses between 16-bit and 32-bit indices based on vertex count.

      Parameters

      • indexCount: number

        The number of indices needed.

      Returns Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

      A Uint16Array or Uint32Array.