Interface MaterialPlugin
defines?: Record<string, number | boolean>;
dynamic?: boolean;
isEnabled?: boolean;
name: string;
priority?: number;
bindTextures?(out: PluginTextureBinding[]): void;
getActiveTextures?(out: Texture2D[]): void;
getCustomCode?(
shaderType: "vertex" | "fragment",
): Partial<Record<MaterialPluginPoint, string>> | null;
getSamplers?(): PluginSamplerDecl[];
getUniforms?(): { ubo?: PluginUboField[] };
getVaryings?(): PluginVaryingDecl[];
writeUbo?(data: Float32Array, offsets: ReadonlyMap<string, number>): void;
}
Index
Properties
Optionaldefines
Static defines folded into the pipeline cache key (and available to the plugin when it builds its custom code).
Optionaldynamic
Re-upload this plugin's Standard-material UBO values before every rendered frame. PBR plugin values already follow the material UBO's versioned update path.
Optionalis Enabled
Default true when attached. A disabled plugin contributes no shader code but still changes the pipeline cache key (so toggling forces a rebuild).
Readonlyname
Stable identifier. Factored into the pipeline cache key.
Optionalpriority
Lower runs first. Default 500.
Methods
Optionalbind Textures
-
Emit texture bindings in the same order as getSamplers.
Parameters
- out: PluginTextureBinding[]
Returns void
Optionalget Active Textures
Optionalget Custom Code
-
getCustomCode?(
shaderType: "vertex" | "fragment",
): Partial<Record<MaterialPluginPoint, string>> | nullReturn WGSL snippets keyed by injection point, or null.
Parameters
- shaderType: "vertex" | "fragment"
Returns Partial<Record<MaterialPluginPoint, string>> | null
Optionalget Samplers
-
Declare custom texture/sampler bindings.
Returns PluginSamplerDecl[]
Optionalget Uniforms
-
Declare custom UBO fields appended to the host material's uniform buffer.
Returns { ubo?: PluginUboField[] }
Optionalget Varyings
-
Declare custom vertex-to-fragment varyings.
Returns PluginVaryingDecl[]
Optionalwrite Ubo
-
Write this plugin's UBO slice.
offsetsmaps field name → byte offset.Parameters
- data: Float32Array
- offsets: ReadonlyMap<string, number>
Returns void
Plain-data material plugin. All behaviour is via optional function members.