import type { IHdr2Png } from "./api"; declare module '@protostr/hdr2png' { export const enum Result { Success = 0, /** * The WASM module ran out of heap memory. * Callers can grow the WASM memory and try again. */ OutOfMemory = -1, /** * The caller violated one or more preconditions. */ ValidationFailure = -2, /** * The WASM module wasn't able to decode the provided input images. */ InvalidInput = -3, /** * The WASM module couldn't perform the operation. */ ConversionFailed = -4, /** * The requested output cannot be inspected. */ OutputUnavailable = -5, /** * The WASM module was able to decode the provided input images, but the * data format used is not supported. */ UnsupportedFormat = -6, /** * A parameter's value was out-of-bounds. */ OutOfBounds = -7, /** * The specified operation ID was invalid. */ InvalidOperation = -8, } export const enum Operation { /** * Merges two separate metallic-roughness textures into one (ORM * packing). At least one of the textures must be non-null. * * @param {Uint8Array | null} input0 Metallic texture * @param {Uint8Array | null} input1 Roughness texture * @returns {[Uint8Array]} */ MergeMetallicRoughness = 0, /** * Converts a transparent image into a transmission map by taking the * alpha channel of the input image, inverting it and placing the value * into the red channel. * * @param {Uint8Array} input0 Image * @returns {[Uint8Array]} */ AlphaToTransmission = 1, /** * Strips the alpha channel from the input image. * * @param {Uint8Array} input0 Image * @returns {[Uint8Array]} */ RemoveAlpha = 2, /** * Simply passes the input image through. The output is an RGB image, * even if the input was RGBA. * * @param {Uint8Array} input0 Image * @returns {[Uint8Array]} */ Passthrough = 3, /** * Takes a Radiance HDR image and converts it to an RGBE-encoded image * stored in a PNG file. * @param {Uint8Array} input0 Radiance HDR image * @returns {[Uint8Array]} */ HdrToRgbe = 4, /** * Splits a lightmap image into two images: * - a full-resolution image that contains only luminance in each * channel, and * - a quarter-res image that contains scaled orange and green chroma * differences, with the scale factor in the blue channel. * Both images are encoded to the basis texture format. * @param {Uint8Array} input0 Lightmap * @returns {[Uint8Array, Uint8Array]} Luma; chroma (basis format; * mipmapped) */ SplitChromaLightmap = 5, /** * Merges the color channels from the first image and the alpha from the * second image. * @param {Uint8Array} input0 Color * @param {Uint8Array} input1 Alpha * @returns {[Uint8Array]} */ MergeColorAlpha = 6, /** * Strips the color information from an RGBA image, replacing it with white. * @param {Uint8Array} input0 Input * @returns {[Uint8Array]} */ MergeWhiteAlpha = 7, /** * Convolves the input equirectangular envmap with the GGX distribution. * The output RGBE-encoded DDS image can be used for specular IBL. * @param {Uint8Array} input0 Input * @returns {[Uint8Array]} */ GgxPrefilterHdr = 8, /** * Convolves the input equirectangular envmap and generates a diffuse * irradiance map. * The output RGBE-encoded DDS image can be used for diffuse IBL. * @param {Uint8Array} input0 Input * @returns {[Uint8Array]} */ DiffuseIrradiance = 9, /** * Resizes the image. * @param {Uint8Array} input0 Input image * @param {number} param0 Factor * @returns {[Uint8Array]} */ Resample = 11, /** * Converts a normal map to the BC3 format. Normal vectors are stored * with hemi-octahedron encoding in the RG channels, while an isotropic * roughness (stdev of the mipped down normal vectors) is stored in the * alpha channel. The blue channel will be black. * @param {Uint8Array} input0 Input * @returns {[Uint8Array]} */ FilterNormalMap = 12, } export declare function h2pCreateInstance(): Promise; /** * Releases every input and output buffer currently allocated on the WASM * heap. * Every U8 view returned by {@link h2pGetOutputView} is invalidated after a * call to this function. */ export declare function h2pReset(instance: IHdr2Png): void; /** * Executes an operation. */ export declare function h2pExecute(instance: IHdr2Png, op: Operation): Result; /** * A callback function. The caller will either supply an error or an array * of views of the output images. */ export interface ResultCallback2 { (err: Result, outputs: null): void; (err: null, outputs: Uint8Array[]): void; } /** * Allocates buffer for an input image at the given index and initializes * its contents with the provided U8 view. */ export declare function h2pInitInputWith(instance: IHdr2Png, idxInput: number, view: Uint8Array): Result; /** * Returns a U8 view of the output at the given index. */ export declare function h2pGetOutputView(instance: IHdr2Png, idxOutput: number): Uint8Array; /** Initializes parameters from an array. */ export declare function h2pInitParameters(instance: IHdr2Png, array: number[]): void; // Helper functions; you could build these yourself using the functions // above export declare function h2pSingleInputMultiOutput(instance: IHdr2Png, op: Operation, image: Uint8Array, numOutputs: number, callback: ResultCallback2): Result; export declare function h2pSingleInputSingleOutput(instance: IHdr2Png, op: Operation, image: Uint8Array, callback: ResultCallback2): Result; export declare function h2pMergeMetallicRoughness(instance: IHdr2Png, imgMetallic: Uint8Array | null, imgRoughness: Uint8Array | null, callback: ResultCallback2): Result; export declare function h2pAlphaToTransmission(instance: IHdr2Png, image: Uint8Array, callback: ResultCallback2): Result; export declare function h2pRemoveAlpha(instance: IHdr2Png, image: Uint8Array, callback: ResultCallback2): Result; export declare function h2pPassthrough(instance: IHdr2Png, image: Uint8Array, callback: ResultCallback2): Result; export declare function h2pHdrToRgbe(instance: IHdr2Png, image: Uint8Array, callback: ResultCallback2): Result; export declare function h2pSplitChromaLightmap(instance: IHdr2Png, image: Uint8Array, callback: ResultCallback2): Result; export declare function h2pMergeColorAlpha(instance: IHdr2Png, color: Uint8Array, alpha: Uint8Array, callback: ResultCallback2): Result; export declare function h2pMergeWhiteAlpha(instance: IHdr2Png, alpha: Uint8Array, callback: ResultCallback2): Result; export declare function h2pGgxPrefilterHdr(instance: IHdr2Png, image: Uint8Array, callback: ResultCallback2): Result; export declare function h2pDiffuseIrradiance(instance: IHdr2Png, image: Uint8Array, callback: ResultCallback2): Result; export declare function h2pResample(instance: IHdr2Png, image: Uint8Array, factor: number, callback: ResultCallback2): Result; export declare function h2pFilterNormalMap(instance: IHdr2Png, image: Uint8Array, callback: ResultCallback2): Result; }