Static
_makeStatic
createCreates a new material instance of the specified type. The material type must be registered before calling this method. This method handles instance counting and initialization.
The name of the registered material type
The material content definition for this specific instance
A new Material instance with proper initialization
Static
forceForcibly registers a material type, overwriting any existing registration. This method bypasses the duplicate check and always performs the registration. Use with caution as it can replace existing material type definitions.
The unique name identifier for the material type
The material content definition containing shader semantics and properties
The maximum number of instances that can be created for this material type
Always returns true as the registration is forced
Static
getGets all currently active material instances from the repository. Returns an array of WeakRef objects that may contain undefined values if materials have been garbage collected.
Array of WeakRef objects pointing to all registered materials
Static
getGets the memory location offset for a specific property of a material type. The offset is calculated in 16-byte aligned units for GPU buffer access. This is used for efficient GPU memory access in shaders.
The name of the material type
The shader semantic name of the property
The byte offset divided by 16 (IndexOf16Bytes) for the property location
Static
getRetrieves a material instance by its unique identifier. Returns undefined if the material doesn't exist or has been garbage collected.
The unique identifier of the material to retrieve
The material instance if found and still alive, undefined otherwise
Static
isChecks if the maximum number of instances for a material type has been reached or exceeded. This is useful for preventing memory overflow by limiting material instance creation.
The name of the material type to check
True if the material type has reached or exceeded its maximum instance count
Static
isDetermines if a new material node is compatible with an existing material. Compatibility is checked by comparing shader semantics information arrays. Materials are compatible if they have identical shader semantic structures.
The existing material to compare against
The new material node to check for compatibility
True if the materials are compatible, false otherwise
Static
isStatic
registerRegisters a new material type with the repository. This method creates the necessary data structures and allocates memory for the material type. If the material type is already registered, the registration will be skipped.
The unique name identifier for the material type
The material content definition containing shader semantics and properties
The maximum number of instances that can be created for this material type
True if the material type was successfully registered, false if it was already registered
Repository class for managing material types and instances. Handles registration, creation, and lifecycle management of materials.