Class
Material
View sourceDefines the base asset type for render material values.
Extend this class when defining a concrete material asset for a renderer. The base value supplies neutral defaults and an empty serialized form, so a subclass can add the state and behavior its renderer needs.
Examples
class CustomMaterial extends Material {
vertex() { return 'vertex shader source' }
fragment() { return 'fragment shader source' }
}
const material = new CustomMaterial()Constructor
Methods
vertex(): string
View sourceReturns the vertex-stage shader source for this material.
The base implementation returns an empty string. Concrete material classes can override this method with their vertex source.
fragment(): string
View sourceReturns the fragment-stage shader source for this material.
The base implementation returns an empty string. Concrete material classes can override this method with their fragment source.
staticdefault(): Material
View sourceCreates the base material’s default asset value.
The base implementation returns a new Material. Concrete
material classes should override this method when their default asset
needs subtype-specific state.
staticserialize(_value: Material): object
View sourceConverts a material to the base class’s serialized representation.
The base implementation ignores _value and returns a new empty object;
it does not mutate the material. Concrete material classes can override
this method with fields for their own asset data.
staticdeserialize(_value: unknown, out?: Material): Material
View sourceRestores a material from the base class’s serialized representation.
The base implementation ignores _value. When out is provided, it
returns that same object without changing it; otherwise it returns a new
Material. Concrete material classes can override this method to
populate their own fields.
