Material
A Material defines surface appearance through a combination of diffuse, specular, normal, emission, and alpha components. These values are specified using a JSON schema called Fabric which gets parsed and assembled into glsl shader code behind-the-scenes. Check out the wiki page for more details on Fabric.
Base material types and their uniforms:
// Create a color material with fromType:
polygon.material = Material.fromType('Color');
polygon.material.uniforms.color = new Color(1.0, 1.0, 0.0, 1.0);
// Create the default material:
polygon.material = new Material();
// Create a color material with full Fabric notation:
polygon.material = new Material({
fabric: {
type: 'Color',
uniforms: {
color: new Color(1.0, 1.0, 0.0, 1.0)
}
}
});
Content copied to clipboard