@twinfinity/core
    Preparing search index...

    Class MaterialCache

    A cache for storing and retrieving materials.

    Index

    Constructors

    Methods

    • Returns void

    • Retrieves a material from the cache if it exists, otherwise creates a new material using the provided factory function, adds it to the cache, and returns it.

      Type Parameters

      • T extends CullingMaterial

        The type of the material, extending CullingMaterial.

      • CTX = undefined

      Parameters

      • key: string

        The key associated with the material.

      • scene: Scene

        The scene to which the material belongs.

      • factory: (key: string, scene: Scene, context?: CTX) => T

        A factory function to create a new material if it does not exist in the cache.

      • Optionalcontext: CTX

      Returns T

      The material associated with the given key.