Skip to main content

MATERIAL

Constant MATERIAL 

Source
pub const MATERIAL: &str = "type Material {\n  color: Str = \"#6fe3ff\";\n  roughness: Number = 0.6;\n  emissive: Number = 0;\n}";
Expand description

Surface appearance for geometry rendered by the spatial adapter.

The adapter validates color as #RRGGBB or #RRGGBBAA. Roughness must be in 0..=1 and emissive intensity in 0..=100. Renderable geometry receives default Transform and Material values when omitted.

§Declaration

type Material {
  color: Str = "#6fe3ff";
  roughness: Number = 0.6;
  emissive: Number = 0;
}

§Fields and methods

  • color: Color in #RRGGBB or #RRGGBBAA form; defaults to #6fe3ff.

  • roughness: Surface roughness from 0 through 1; defaults to 0.6.

  • emissive: Emissive intensity from 0 through 100; defaults to 0.

§Attach material

Geometry receives a default material if none is attached by the spatial adapter.

let entity = spawn(Sphere {});
add(entity, Material { color: "#ff0000" });
print(get[Material](entity).color);