@needle-tools/materialx
Version:
Web runtime support to load and display MaterialX materials in Needle Engine and three.js via the MaterialX WebAssembly library. glTF files containing the `NEEDLE_materials_mtlx` extension can be loaded with this package. There is also experimental suppor
50 lines (36 loc) • 1.3 kB
TypeScript
export namespace MaterialX {
export type MODULE = {
ShaderInterfaceType: any;
HwSpecularEnvironmentMethod: any;
HwShaderGenerator: {
bindLightShader(def: any, id: number, genContext: GenContext): void;
unbindLightShaders(context: any): void;
};
createDocument(): Document;
readFromXmlString(doc: Document, xml: string, searchPath?: string): void;
loadStandardLibraries(genContext: GenContext): StandardLibrary;
isTransparentSurface(renderableElement: any, target: string): boolean;
}
export type GenContext = {
}
export type StandardLibrary = {
}
// https://github.com/AcademySoftwareFoundation/MaterialX/blob/b74787db6544283dc32afc8085ebc93cabe937cb/source/MaterialXGenShader/ShaderStage.h#L56
export type ShaderStage = {
getUniformBlocks(): Record<string, any>;
}
export type Document = {
setDataLibrary(lib: StandardLibrary): void;
importLibrary(lib: Document): void;
getNodes(): Node[];
}
export type Node = {
getType(): string;
}
export type Matrix = {
numRows(): number;
numColumns(): number;
get size(): number;
getItem(row: number, col: number): number;
}
}