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

    Class AbstractGeometryAbstract

    Base class for all geometry types. Manages vertex, index, normal, and UV data. Designed to be extended by specific shapes.

    Hierarchy (View Summary)

    Implements

    Index
    _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.

    • 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.

    • Computes the normals of the geometry using the current vertices and indices. Averages normals for shared vertices.

      Returns void

    • Computes the tangents of the geometry based on normals and UVs. Required for normal mapping.

      Returns void

    • Computes the wireframe indices (line-segments) from the current triangle topology.

      Returns void

    • Rotates the geometry vertices around the X-axis in-place.

      Parameters

      • a: number

        The rotation angle in radians.

      Returns this

      this

    • Rotates the geometry vertices around the Y-axis in-place.

      Parameters

      • a: number

        The rotation angle in radians.

      Returns this

      this

    • Rotates the geometry vertices around the Z-axis in-place.

      Parameters

      • a: number

        The rotation angle in radians.

      Returns this

      this

    • Scales the geometry vertices in-place.

      Parameters

      • f: number

        The scale factor.

      Returns this

      this