Cache of materials via their local ID

Implements

Constructors

Properties

defaultMaterialLocalID: undefined | number

If there is a material for a whole element, this is used to add a default material to that item.

materialDefinitionsMap: Map<number, number> = ...
relMaterialsMap: Map<number, number> = ...
styledItemMap: Map<number, number> = ...

Accessors

  • get size(): number
  • Get the number of materials in this.

    Returns number

    The number of materials in this.

Methods

  • Get the materials in the cache.

    Returns IterableIterator<[number, CanonicalMaterial], any, any>

    The iterator for the local IDs and their respective materials.

  • Add a material to the cache

    Parameters

    • localID: number

      The local ID of the source material object

    • material: CanonicalMaterial

      The canonical material version of the material to add

    Returns void

  • Map the current geometry to the current default material, if one is set.

    Parameters

    • geometryLocalID: number

      The geometry ID to add.

    Returns void

  • Assign a particular geometry to a particular material

    Parameters

    • geometryLocalID: number

      The geometry

    • materialLocalID: number

      The material

    Returns void

  • Get a material by its local ID.

    Parameters

    • localID: number

      The local ID to fetch a material for.

    Returns undefined | CanonicalMaterial

    The material for the matching local ID

  • Get a material by its local geometry ID.

    Parameters

    • geometryLocalID: number

      The local ID of the geometry to get the associated material for.

    Returns undefined | [CanonicalMaterial, number]

    A tuple containing the material and its id, or undefined if it is not found.

  • Get a material by its local ID.

    Parameters

    • geometryLocalID: number

      The local ID of the geometry to fetch

    Returns undefined | number

    A tuple containing the material and its id, or undefined if it is not found.

  • Get the materials in the cache (values only).

    Returns IterableIterator<CanonicalMaterial, any, any>

    The iterator for the respective materials.