Appearance
@tmrw-realityos/charm • Docs
@tmrw-realityos/charm / HDRLoader
Class: HDRLoader
Constructors
new HDRLoader()
new HDRLoader():
HDRLoader
Returns
Methods
load()
load(
url
):Promise
<HDREnvironment
>
Load radiance HDR from file and create HDREnvironment. Only supports 32-bit_rle_rgbe.
Parameters
• url: string
hdr filepath
Returns
Promise
<HDREnvironment
>
HDR environment
Defined in
packages/charm/src/helpers/HDRLoader.ts:105
parse()
parse(
buffer
):HDREnvironment
Similar to load but parses data from an arraybuffer.
Parameters
• buffer: Uint8Array
Data in radiance HDR format
Returns
HDREnvironment
HDR environment
Defined in
packages/charm/src/helpers/HDRLoader.ts:116
floatToRgb9e5()
static
floatToRgb9e5(buffer
):Uint32Array
Convert a float buffer to a RGB9E5 buffer. (ref https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_shared_exponent.txt)
Parameters
• buffer: Float32Array
Floating point input buffer (96 bits/pixel).
Returns
Uint32Array
A 32bit uint32 array in RGB9E5
Defined in
packages/charm/src/helpers/HDRLoader.ts:80
rgbeToFloat()
static
rgbeToFloat(buffer
):Float32Array
Convert rgbe to float.
Parameters
• buffer: Uint8Array
pixel data in rgbe format
Returns
Float32Array
RGB pixel data in float32 format
Defined in
packages/charm/src/helpers/HDRLoader.ts:14
rgbeToFloat4()
static
rgbeToFloat4(buffer
):Float32Array
Convert rgbe to four component float. The fourth component is 0.
Parameters
• buffer: Uint8Array
data in rgbe format
Returns
Float32Array
RGBA pixel data in float32 format
Defined in
packages/charm/src/helpers/HDRLoader.ts:62
rgbeToRgb9e5()
static
rgbeToRgb9e5(buffer
):Uint32Array
Convert RGB8E8 to RGB9E5 format
Parameters
• buffer: Uint8Array
data in rgbe format
Returns
Uint32Array
RGBE pixel data packed in 32bit uint.