Class Model

Holds a 3D model, as a list of parts, each with a material Plus map of named materials

Implements

Constructors

Properties

_boundingBox: number[]
materials: Record<string, Material> = ...
name: string

Name of the model, usually the filename without the extension

parts: ModelPart[] = ...
programInfo: ProgramInfo
triCount: number

Accessors

  • get materialNames(): string[]
  • Get list of all material names in this model used by all parts

    Returns string[]

    • List of material names
  • get partList(): string[]
  • Get list of parts in this model, names are the material names

    Returns string[]

    • List of part material names
  • get triangleCount(): number
  • Simple getter for the number of triangles in the model

    Returns number

Methods

  • Render is used draw this model, this is called from the Instance that wraps this renderable.

    Parameters

    • gl: WebGL2RenderingContext
    • uniforms: UniformSet
    • Optional materialOverride: Material
    • Optional programOverride: ProgramInfo

    Returns void

  • Can modify & override an existing named material

    Parameters

    • name: string

      Name of the material to modify

    • material: Material

      New material to use

    Returns void

  • Parse an OBJ file & MTL material libraries, returns a new Model

    Parameters

    • path: string = '.'

      The path to the OBJ file

    • objFilename: string

      The name of the OBJ file

    • filterTextures: boolean = true

      Apply texture filtering to textures, default: true

    • flipTextureY: boolean = false

      Flip the Y axis of textures as they are loaded, default: false

    • flipUV: boolean = false

      Flip the UV coords of the model in the vertex/mesh data, default: true

    Returns Promise<Model>

  • Parse a custom model from a ModelBuilder, this is used to build models in code

    Parameters

    • builder: ModelBuilder

      The ModelBuilder to parse

    • name: string

      The name of the model

    Returns Model

Generated using TypeDoc