-
Notifications
You must be signed in to change notification settings - Fork 8
decode.Class.JPEGRLoader
@monogrid/gainmap-js / decode / JPEGRLoader
A Three.js Loader for a JPEG with embedded gainmap metadata.
import { HDRJPGLoader } from '@monogrid/gainmap-js'
import {
EquirectangularReflectionMapping,
LinearFilter,
Mesh,
MeshBasicMaterial,
PerspectiveCamera,
PlaneGeometry,
Scene,
WebGLRenderer
} from 'three'
const renderer = new WebGLRenderer()
const loader = new HDRJPGLoader(renderer)
const result = await loader.loadAsync('gainmap.jpeg')
// `result` can be used to populate a Texture
const scene = new Scene()
const mesh = new Mesh(
new PlaneGeometry(),
new MeshBasicMaterial({ map: result.renderTarget.texture })
)
scene.add(mesh)
renderer.render(scene, new PerspectiveCamera())
// Starting from three.js r159
// `result.renderTarget.texture` can
// also be used as Equirectangular scene background
//
// it was previously needed to convert it
// to a DataTexture with `result.toDataTexture()`
scene.background = result.renderTarget.texture
scene.background.mapping = EquirectangularReflectionMapping
// result must be manually disposed
// when you are done using it
result.dispose()
-
LoaderBase
<string
>
new JPEGRLoader(
renderer
?,manager
?):JPEGRLoader
• renderer?: WebGLRenderer
• manager?: LoadingManager
LoaderBase<string>.constructor
src/decode/loaders/LoaderBase.ts:34
load(
url
,onLoad
?,onProgress
?,onError
?):QuadRenderer
<1016
,GainMapDecoderMaterial
>
Loads a JPEG containing gain map metadata Renders a normal SDR image if gainmap data is not found
• url: string
An array in the form of [sdr.jpg, gainmap.jpg, metadata.json]
• onLoad?
Load complete callback, will receive the result
• onProgress?
Progress callback, will receive a ProgressEvent
• onError?
Error callback
QuadRenderer
<1016
, GainMapDecoderMaterial
>
LoaderBase.load
src/decode/loaders/HDRJPGLoader.ts:73
setRenderTargetOptions(
options
):JPEGRLoader
Specify the renderTarget options to use when rendering the gain map
• options: QuadRendererTextureOptions
LoaderBase.setRenderTargetOptions
src/decode/loaders/LoaderBase.ts:57
setRenderer(
renderer
):JPEGRLoader
Specify the renderer to use when rendering the gain map
• renderer: WebGLRenderer
LoaderBase.setRenderer