Material

Wrapper around a native material.

Each material instance will have properties associated to the pipeline it uses. The material properties are automatically added to each material instance, example:

1const material = mesh.material; // Material with a `Phong Opaque Textured` pipeline
2// You can access all the material properties from the editor using:
3material.diffuseTexture = null;
4material.diffuseColor = [1.0, 0.0, 0.0, 1.0];

.constructor(engine: WonderlandEngine, params: number | MaterialParameters) ⇒ Material 

Create a new Material.

Note: Creating material is expensive. Please use clone to clone a material.

Note: Do not use this constructor directly with an index, this is reserved for internal purposes.

ParamTypeDescription
engineWonderlandEngine
paramsnumber | MaterialParameters

.engine: WonderlandEngine 

Hosting engine instance.

.pipeline: string 

Name of the pipeline used by this material.

.shader: string 

Deprecated: Use #pipeline instead.

.clone() ⇒ null | Material 

Create a copy of the underlying native material.

Returns: Material clone.

.equals(otherMaterial: undefined | null | Material) ⇒ boolean 

0.8.5+

Checks equality by comparing whether the wrapped native material ids are equal.

Returns: Whether this material equals the given material.

ParamTypeDescription
otherMaterialundefined | null | MaterialMaterial to check equality with.

Material.wrap(engine: WonderlandEngine, index: number) ⇒ null | Material 

Wrap a native material index.

Returns: Material instance or null if index <= 0.

Deprecated: Please use new Material() instead.

ParamTypeDescription
engineWonderlandEngineEngine instance.
indexnumberThe index.