62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
import { GainMapMetadata } from '../core/types';
|
|
import { EncodingParametersBase } from './types';
|
|
/**
|
|
* Encodes a Gainmap starting from an HDR file.
|
|
*
|
|
* @remarks
|
|
* if you do not pass a `renderer` parameter
|
|
* you must manually dispose the result
|
|
* ```js
|
|
* const encodingResult = await encode({ ... })
|
|
* // do something with the buffers
|
|
* const sdr = encodingResult.sdr.getArray()
|
|
* const gainMap = encodingResult.gainMap.getArray()
|
|
* // after that
|
|
* encodingResult.sdr.dispose()
|
|
* encodingResult.gainMap.dispose()
|
|
* ```
|
|
*
|
|
* @category Encoding Functions
|
|
* @group Encoding Functions
|
|
*
|
|
* @example
|
|
* import { encode, findTextureMinMax } from '@monogrid/gainmap-js'
|
|
* import { EXRLoader } from 'three/examples/jsm/loaders/EXRLoader.js'
|
|
*
|
|
* // load an HDR file
|
|
* const loader = new EXRLoader()
|
|
* const image = await loader.loadAsync('image.exr')
|
|
*
|
|
* // find RAW RGB Max value of a texture
|
|
* const textureMax = findTextureMinMax(image)
|
|
*
|
|
* // Encode the gainmap
|
|
* const encodingResult = encode({
|
|
* image,
|
|
* // this will encode the full HDR range
|
|
* maxContentBoost: Math.max.apply(this, textureMax)
|
|
* })
|
|
* // can be re-encoded after changing parameters
|
|
* encodingResult.sdr.material.exposure = 0.9
|
|
* encodingResult.sdr.render()
|
|
* // or
|
|
* encodingResult.gainMap.material.gamma = [1.1, 1.1, 1.1]
|
|
* encodingResult.gainMap.render()
|
|
*
|
|
* // do something with encodingResult.gainMap.toArray()
|
|
* // and encodingResult.sdr.toArray()
|
|
*
|
|
* // renderers must be manually disposed
|
|
* encodingResult.sdr.dispose()
|
|
* encodingResult.gainMap.dispose()
|
|
*
|
|
* @param params Encoding Parameters
|
|
* @returns
|
|
*/
|
|
export declare const encode: (params: EncodingParametersBase) => {
|
|
sdr: import("../core").QuadRenderer<1009, import(".").SDRMaterial>;
|
|
gainMap: import("../core").QuadRenderer<1009, import(".").GainMapEncoderMaterial>;
|
|
hdr: import("three").DataTexture;
|
|
getMetadata: () => GainMapMetadata;
|
|
};
|