ThreePipe
    Preparing search index...

    Class MaterialManager<TEventMap>

    Material Manager Utility class to manage materials. Maintains a library of materials and material templates that can be used to manage or create new materials. Used in AssetManager to manage materials.

    Type Parameters

    • TEventMap extends object = object

    Hierarchy

    Index
    _materialExtensions: MaterialExtension[] = []
    unregisterExtensionsOnRemove: boolean = false
    • Type Parameters

      Parameters

      • template: {
            InterpolateProperties?: string[];
            MapProperties?: string[];
            MaterialProperties?: Record<string, any>;
            TYPE: string;
            TypeAlias?: string[];
            TypeSlug: string;
            new (...args: any[]): IMaterial;
        }
      • OptionaloldMaterial: IMaterialParameters | Partial<TM>

      Returns TM | undefined

    • Creates a new material if a compatible template is found or apply minimal upgrades and returns the original material. Also checks from the registered materials, if one with the same uuid is found, it is returned instead with the new parameters. Also caches the response. Returns the same material if its already upgraded.

      Parameters

      • material: Material<MaterialEventMap> & {
            assetType?: "material";
            iMaterial?: IMaterial<IMaterialEventMap>;
        }

        the material to upgrade/check

      • useSourceMaterial: {
            createFromTemplate?: boolean;
            materialTemplate?: string;
            useSourceMaterial?: boolean;
        } = {}

        if false, will not use the source material parameters in the new material. default = true

      Returns IMaterial<IMaterialEventMap> | undefined

    • Parameters

      • material: IMaterial
      • Optionalfilename: string
      • minify: boolean = true
      • download: boolean = false

      Returns File

    • Parameters

      • type: string

      Returns
          | {
              InterpolateProperties?: string[];
              MapProperties?: string[];
              MaterialProperties?: Record<string, any>;
              TYPE: string;
              TypeAlias?: string[];
              TypeSlug: string;
              new (...args: any[]): IMaterial;
          }
          | undefined

    • Parameters

      • template: {
            InterpolateProperties?: string[];
            MapProperties?: string[];
            MaterialProperties?: Record<string, any>;
            TYPE: string;
            TypeAlias?: string[];
            TypeSlug: string;
            new (...args: any[]): IMaterial;
        }

      Returns void

    • Parameters

      • template: {
            InterpolateProperties?: string[];
            MapProperties?: string[];
            MaterialProperties?: Record<string, any>;
            TYPE: string;
            TypeAlias?: string[];
            TypeSlug: string;
            new (...args: any[]): IMaterial;
        }

      Returns void