Favivon - Correção

This commit is contained in:
2026-05-30 19:59:39 -03:00
parent 76ddaa815d
commit d7dfd221f0
32859 changed files with 5459654 additions and 404 deletions
@@ -0,0 +1,69 @@
import { HalfFloatType } from 'three/webgpu';
import { QuadRenderer } from '../core/QuadRenderer';
import { GainMapDecoderMaterial } from '../materials/GainMapDecoderMaterial';
import { LoaderBaseWebGPU } from './LoaderBaseWebGPU';
/**
* A Three.js Loader for the gain map format (WebGPU version).
*
* @category Loaders
* @group Loaders
*
* @example
* import { GainMapLoader } from '@monogrid/gainmap-js/webgpu'
* import {
* EquirectangularReflectionMapping,
* Mesh,
* MeshBasicMaterial,
* PerspectiveCamera,
* PlaneGeometry,
* Scene,
* WebGPURenderer
* } from 'three/webgpu'
*
* const renderer = new WebGPURenderer()
* await renderer.init()
*
* const loader = new GainMapLoader(renderer)
* .setRenderTargetOptions({ mapping: EquirectangularReflectionMapping })
*
* const result = await loader.loadAsync(['sdr.jpeg', 'gainmap.jpeg', 'metadata.json'])
* // `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
*
* // result must be manually disposed
* // when you are done using it
* result.dispose()
*
*/
export declare class GainMapLoader extends LoaderBaseWebGPU<[string, string, string]> {
/**
* Loads a gainmap using separate data
* * sdr image
* * gain map image
* * metadata json
*
* useful for webp gain maps
*
* @param urls An array in the form of [sdr.jpg, gainmap.jpg, metadata.json]
* @param onLoad Load complete callback, will receive the result
* @param onProgress Progress callback, will receive a `ProgressEvent`
* @param onError Error callback
* @returns
*/
load([sdrUrl, gainMapUrl, metadataUrl]: [string, string, string], onLoad?: (data: QuadRenderer<typeof HalfFloatType, GainMapDecoderMaterial>) => void, onProgress?: (event: ProgressEvent) => void, onError?: (err: unknown) => void): QuadRenderer<typeof HalfFloatType, GainMapDecoderMaterial>;
}
@@ -0,0 +1,65 @@
import { HalfFloatType } from 'three/webgpu';
import { QuadRenderer } from '../core/QuadRenderer';
import { GainMapDecoderMaterial } from '../materials/GainMapDecoderMaterial';
import { LoaderBaseWebGPU } from './LoaderBaseWebGPU';
/**
* A Three.js Loader for a JPEG with embedded gainmap metadata (WebGPU version).
*
* @category Loaders
* @group Loaders
*
* @example
* import { HDRJPGLoader } from '@monogrid/gainmap-js/webgpu'
* import {
* EquirectangularReflectionMapping,
* Mesh,
* MeshBasicMaterial,
* PerspectiveCamera,
* PlaneGeometry,
* Scene,
* WebGPURenderer
* } from 'three/webgpu'
*
* const renderer = new WebGPURenderer()
* await renderer.init()
*
* const loader = new HDRJPGLoader(renderer)
* .setRenderTargetOptions({ mapping: EquirectangularReflectionMapping })
*
* 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
*
* // result must be manually disposed
* // when you are done using it
* result.dispose()
*
*/
export declare class HDRJPGLoader extends LoaderBaseWebGPU<string> {
/**
* Loads a JPEG containing gain map metadata
* Renders a normal SDR image if gainmap data is not found
*
* @param url Path to a JPEG file containing embedded gain map metadata
* @param onLoad Load complete callback, will receive the result
* @param onProgress Progress callback, will receive a `ProgressEvent`
* @param onError Error callback
* @returns
*/
load(url: string, onLoad?: (data: QuadRenderer<typeof HalfFloatType, GainMapDecoderMaterial>) => void, onProgress?: (event: ProgressEvent) => void, onError?: (err: unknown) => void): QuadRenderer<typeof HalfFloatType, GainMapDecoderMaterial>;
}
@@ -0,0 +1,20 @@
import { HalfFloatType, LoadingManager, WebGPURenderer } from 'three/webgpu';
import { type GainMapMetadata } from '../../../core/types';
import { LoaderBaseShared } from '../../shared';
import { QuadRenderer } from '../core/QuadRenderer';
import { GainMapDecoderMaterial } from '../materials/GainMapDecoderMaterial';
/**
* Base class for WebGPU loaders
* @template TUrl - The type of URL used to load resources
*/
export declare abstract class LoaderBaseWebGPU<TUrl = string> extends LoaderBaseShared<WebGPURenderer, QuadRenderer<typeof HalfFloatType, GainMapDecoderMaterial>, GainMapDecoderMaterial, TUrl> {
constructor(renderer?: WebGPURenderer, manager?: LoadingManager);
/**
* @private
* @param quadRenderer
* @param metadata
* @param sdrBuffer
* @param gainMapBuffer
*/
protected render(quadRenderer: QuadRenderer<typeof HalfFloatType, GainMapDecoderMaterial>, metadata: GainMapMetadata, sdrBuffer: ArrayBuffer, gainMapBuffer?: ArrayBuffer): Promise<void>;
}