MaterialManager
Manage materials.
Creation
To create a material, first retrieve the class associated to the pipeline using getTemplate:
1const PhongMaterial = engine.materials.getTemplate('Phong Opaque');
Creating a material is then done using the constructor:
- MaterialManager
- ._wrapInstance(instance) ⇒ Material
- .getTemplate<T>(pipeline) ⇒ MaterialConstructor
- .wrap(index) ⇒ null | Material
._wrapInstance(instance: Material) ⇒ Material
Wrap a material instance.
@todo: Remove at 2.0.0.
Note: Wrapping should only be called once per instance.
Returns: The new material, wrapped in a proxy.
Param | Type | Description |
---|---|---|
instance | Material | The material instance. |
.getTemplate<T>(pipeline: string) ⇒ MaterialConstructor
Get the material class with the given pipeline name.
Usage
Returns: The material class.
Throws: Error
if the material class doesn’t exist.
Param | Type | Description |
---|---|---|
pipeline | string | The pipeline name to search for. |
Template Param | Type Definition |
---|---|
T | extends Material |
.wrap(index: number) ⇒ null | Material
Param | Type | Description |
---|---|---|
index | number |