threejs-worldgen
    Preparing search index...

    Class MeshBuilder

    Accumulates indexed triangles straight into growable typed arrays with a fixed set of float attributes. Set the "current" value of an attribute with MeshBuilder.set, then emit vertices with MeshBuilder.vertex; attributes keep their last value.

    Index
    spec: Record<string, number>

    Attribute item sizes.

    • Adds a flat quad from four corners given counter-clockwise as seen from the front, with the normal computed from them. uvs = [u0, v0, u1, v1, …] per corner.

      Parameters

      • p: readonly (readonly [number, number, number])[]
      • uvs: readonly number[]

      Returns this

    • Sets the current value of an attribute (used by following vertices).

      Parameters

      • name: string
      • a: number = 0
      • b: number = 0
      • c: number = 0
      • d: number = 0

      Returns this

    • Adds a flat triangle from three corners counter-clockwise as seen from the front.

      Parameters

      • p: readonly (readonly [number, number, number])[]
      • uvs: readonly number[]

      Returns this

    • Adds a triangle.

      Parameters

      • a: number
      • b: number
      • c: number

      Returns this

    • Emits a vertex at (x, y, z) with uv (u, v) and the current values of the other attributes. Returns its index.

      Parameters

      • x: number
      • y: number
      • z: number
      • u: number = 0
      • v: number = 0

      Returns number