UNPKG

@needle-tools/materialx

Version:

MaterialX material support for three.js and Needle Engine – render physically based MaterialX shaders in the browser via WebAssembly

59 lines (45 loc) 2.02 kB
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; /** Returns the alpha mode for a renderable element: "opaque", "mask", or "blend". * Inspects the shader node (and its nodegraph implementation) for alpha_mode inputs. */ getAlphaMode?(renderableElement: any, target: string): string; /** Extracts a detailed error message from a WASM exception pointer, including error logs. */ getExceptionDetailedMessage?(exceptionPtr: number): string; /** Extracts a basic error message from a WASM exception pointer. */ getExceptionMessage?(exceptionPtr: number): string; } 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; /** Validates the document and returns validation result with error messages. */ validate?(): { valid: boolean; message: string }; getNodes(): Node[]; } export type Node = { getType(): string; } export type Matrix = { numRows(): number; numColumns(): number; get size(): number; getItem(row: number, col: number): number; } }