Documentation / scene / applyMaterialMixins
Function: applyMaterialMixins()
applyMaterialMixins<
M,T>(target, ...mixins):T&ExtractMixinType<M>
Defined in: libs/scene/src/material/meshmaterial.ts:72
Apply material mixins to a target material class.
Useful for composing optional capabilities (e.g., base color, normal map, PBR terms).
Type Parameters
M
M extends (target) => any[]
T
T
Parameters
target
T
The material class (constructor or prototype).
mixins
...M
One or more mixin functions.
Returns
T & ExtractMixinType<M>
The target class augmented with the mixins (intersection type).
Example
ts
class MyMaterial extends MeshMaterial {}
const Mixed = applyMaterialMixins(MyMaterial, WithBaseColor, WithNormalMap);
const m = new Mixed();
@public