Class ModelBuilder

A builder for creating multi-part models from triangle meshes Use in conjunction Model.parseFromBuilder

Example usage:

const builder = new ModelBuilder()
const part = builder.newPart('foo' Material.RED)
builder.addTriangle([1, -1, 1], [1, 1, 1], [-1, 1, 1])
Model.parseFromBuilder(builder, 'myModel')

Constructors

Properties

Methods

Constructors

Properties

parts: Map<string, BuilderPart>

Methods

  • Create and add a 'part', each part should have a unique name, and material to apply to it Vertex mesh data is then added to the part, with addQuad and addTriangle

    Parameters

    • name: string

      Name of this part, just a string can be anything

    • material: Material

      Material to attach and apply to all surfaces in this part

    Returns BuilderPart