A model's material with modifiable parameters. A glTF materialcontains parameters defined by the material's technique with valuesdefined by the technique and potentially overridden by the material.This class allows changing these values at runtime.
Use Model#getMaterial
to create an instance.
See:
Members
-
The name of the glTF JSON property for this material. This is guaranteedto be unique among all materials. It may not match the material's
name
property (@link ModelMaterial#name), which is assigned bythe artist when the asset is created. -
The value of the
name
property of this material. This is thename assigned by the artist when the asset is created. This can bedifferent than the name of the material property (ModelMaterial#id
),which is internal to glTF.
Methods
-
Returns the value of the parameter with the given
name
. The type of thereturned object depends on the glTF type of the parameter. It will be a floating-pointnumber, Cartesian, or matrix.Name Type Description name
String The name of the parameter. Returns:
The value of the parameter orundefined
if the parameter does not exist. -
Assigns a value to a material parameter. The type for
value
depends on the glTF type of the parameter. It will be a floating-pointnumber, Cartesian, or matrix.Name Type Description name
String The name of the parameter. value
Object optional The value to assign to the parameter. Throws:
-
DeveloperError : name must match a parameter name in the material's technique that is targetable and not optimized out.
Example:
material.setValue('diffuse', new Cesium.Cartesian4(1.0, 0.0, 0.0, 1.0)); // vec4 material.setValue('shininess', 256.0); // scalar
-