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
+153
View File
@@ -0,0 +1,153 @@
import { ByteType, ColorSpace, DataTexture, FloatType, HalfFloatType, IntType, Material, ShortType, Texture, TextureDataType, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, WebGLRenderer, WebGLRenderTarget } from 'three';
import { QuadRendererTextureOptions, TextureImageFormat } from './types';
/**
* Utility Type that translates `three` texture types to their TypedArray counterparts.
*
* @category Utility
* @group Utility
*/
export type TextureDataTypeToBufferType<TType extends TextureDataType> = TType extends typeof UnsignedByteType ? Uint8ClampedArray<ArrayBuffer> : TType extends typeof ByteType ? Int8Array<ArrayBuffer> : TType extends typeof ShortType ? Int16Array<ArrayBuffer> : TType extends typeof UnsignedShortType ? Uint16Array<ArrayBuffer> : TType extends typeof IntType ? Int32Array<ArrayBuffer> : TType extends typeof UnsignedIntType ? Uint32Array<ArrayBuffer> : TType extends typeof FloatType ? Float32Array<ArrayBuffer> : TType extends typeof HalfFloatType ? Uint16Array<ArrayBuffer> : TType extends typeof UnsignedShort4444Type ? Uint16Array<ArrayBuffer> : TType extends typeof UnsignedShort5551Type ? Uint16Array<ArrayBuffer> : TType extends typeof UnsignedInt248Type ? Uint32Array<ArrayBuffer> : TType extends typeof UnsignedInt5999Type ? Uint32Array<ArrayBuffer> : TType extends typeof UnsignedInt101111Type ? Uint32Array<ArrayBuffer> : never;
export type QuadRendererOptions<TType extends TextureDataType, TMaterial extends Material> = {
/**
* Width of the render target
*/
width: number;
/**
* height of the renderTarget
*/
height: number;
/**
* TextureDataType of the renderTarget
*/
type: TType;
/**
* ColorSpace of the renderTarget
*/
colorSpace: ColorSpace;
/**
* material to use for rendering
*/
material: TMaterial;
/**
* Renderer instance to use
*/
renderer?: WebGLRenderer;
/**
* Additional renderTarget options
*/
renderTargetOptions?: QuadRendererTextureOptions;
};
/**
* Utility class used for rendering a texture with a material
*
* @category Core
* @group Core
*/
export declare class QuadRenderer<TType extends TextureDataType, TMaterial extends Material> {
private _renderer;
private _rendererIsDisposable;
private _material;
private _scene;
private _camera;
private _quad;
private _renderTarget;
private _width;
private _height;
private _type;
private _colorSpace;
private _supportsReadPixels;
/**
* Constructs a new QuadRenderer
*
* @param options Parameters for this QuadRenderer
*/
constructor(options: QuadRendererOptions<TType, TMaterial>);
/**
* Instantiates a temporary renderer
*
* @returns
*/
static instantiateRenderer(): WebGLRenderer;
/**
* Renders the input texture using the specified material
*/
render: () => void;
/**
* Obtains a Buffer containing the rendered texture.
*
* @throws Error if the browser cannot read pixels from this RenderTarget type.
* @returns a TypedArray containing RGBA values from this renderer
*/
toArray(): TextureDataTypeToBufferType<TType>;
/**
* Performs a readPixel operation in the renderTarget
* and returns a DataTexture containing the read data
*
* @param options options
* @returns
*/
toDataTexture(options?: QuadRendererTextureOptions): DataTexture;
/**
* If using a disposable renderer, it will dispose it.
*/
disposeOnDemandRenderer(): void;
/**
* Will dispose of **all** assets used by this renderer.
*
*
* @param disposeRenderTarget will dispose of the renderTarget which will not be usable later
* set this to true if you passed the `renderTarget.texture` to a `PMREMGenerator`
* or are otherwise done with it.
*
* @example
* ```js
* const loader = new HDRJPGLoader(renderer)
* const result = await loader.loadAsync('gainmap.jpeg')
* const mesh = new Mesh(geometry, new MeshBasicMaterial({ map: result.renderTarget.texture }) )
* // DO NOT dispose the renderTarget here,
* // it is used directly in the material
* result.dispose()
* ```
*
* @example
* ```js
* const loader = new HDRJPGLoader(renderer)
* const pmremGenerator = new PMREMGenerator( renderer );
* const result = await loader.loadAsync('gainmap.jpeg')
* const envMap = pmremGenerator.fromEquirectangular(result.renderTarget.texture)
* const mesh = new Mesh(geometry, new MeshStandardMaterial({ envMap }) )
* // renderTarget can be disposed here
* // because it was used to generate a PMREM texture
* result.dispose(true)
* ```
*/
dispose(disposeRenderTarget?: boolean): void;
/**
* Width of the texture
*/
get width(): number;
set width(value: number);
/**
* Height of the texture
*/
get height(): number;
set height(value: number);
/**
* The renderer used
*/
get renderer(): WebGLRenderer;
/**
* The `WebGLRenderTarget` used.
*/
get renderTarget(): WebGLRenderTarget<Texture<TextureImageFormat>>;
set renderTarget(value: WebGLRenderTarget<Texture<TextureImageFormat>>);
/**
* The `Material` used.
*/
get material(): TMaterial;
/**
*
*/
get type(): TType;
get colorSpace(): ColorSpace;
}
+14
View File
@@ -0,0 +1,14 @@
import { DataTexture } from 'three';
import { EXR } from 'three/examples/jsm/loaders/EXRLoader.js';
import { HDR } from 'three/examples/jsm/loaders/HDRLoader.js';
import { RGBE } from 'three/examples/jsm/loaders/RGBELoader.js';
/**
* Utility function to obtain a `DataTexture` from various input formats
*
* @category Utility
* @group Utility
*
* @param image
* @returns
*/
export declare const getDataTexture: (image: EXR | RGBE | HDR | DataTexture) => DataTexture;
+3
View File
@@ -0,0 +1,3 @@
export * from './get-data-texture';
export * from './QuadRenderer';
export * from './types';
+93
View File
@@ -0,0 +1,93 @@
import { Mapping, RenderTargetOptions } from 'three';
export type Constructor = new (...args: any[]) => any;
/**
* This is the Metadata stored in an encoded Gainmap which is used
* to decode it and return an HDR image
*
* @category Specs
* @group Specs
*/
export type GainMapMetadata = {
/**
* This is the gamma to apply to the stored map values.
* @defaultValue [1, 1, 1]
* @remarks
* * Typically you can use a gamma of 1.0.
* * You can use a different value if your gain map has a very uneven distribution of log_recovery(x, y) values.
*
* For example, this might apply if a gain map has a lot of detail just above SDR range (represented as small log_recovery(x, y) values),
* and a very large map_max_log2 for the top end of the HDR rendition's desired brightness (represented by large log_recovery(x, y) values).
* In this case, you can use a map_gamma higher than 1.0 so that recovery(x, y) can precisely encode the detail in both the low end and high end of log_recovery(x, y).
*/
gamma: [number, number, number];
/**
* This is log2 of the minimum display boost value for which the map is applied at all.
*
* @remarks
* * This value also affects how much to apply the gain map based on the display boost.
* * Must be 0.0 or greater.
*
* Logarithmic space
*/
hdrCapacityMin: number;
/**
* Stores the value of hdr_capacity_max. This is log2 of the maximum display boost value for which the map is applied completely.
*
* @remarks
* * This value also affects how much to apply the gain map based on the display boost.
* * Must be greater than hdrCapacityMin.
* * Required.
*
* Logarithmic space
*/
hdrCapacityMax: number;
/**
* This is the offset to apply to the SDR pixel values during gain map generation and application
* @defaultValue [1/64, 1/64, 1/64]
*/
offsetSdr: [number, number, number];
/**
* This is the offset to apply to the HDR pixel values during gain map generation and application.
* @defaultValue [1/64, 1/64, 1/64]
*/
offsetHdr: [number, number, number];
/**
* This is log2 of min content boost, which is the minimum allowed ratio of
* the linear luminance for the target HDR rendition relative to
* (divided by) that of the SDR image, at a given pixel.
*/
gainMapMin: [number, number, number];
/**
* This is log2 of max content boost, which is the maximum allowed ratio of
* the linear luminance for the Target HDR rendition relative to
* (divided by) that of the SDR image, at a given pixel.
*/
gainMapMax: [number, number, number];
};
export type GainMapMetadataExtended = GainMapMetadata & {
version: string;
maxContentBoost: number;
minContentBoost: number;
};
/**
*
*/
export type QuadRendererTextureOptions = Omit<RenderTargetOptions, 'type' | 'format' | 'colorSpace' | 'encoding' | 'depthTexture' | 'stencilBuffer' | 'depthBuffer' | 'internalFormat'> & {
/**
* @defaultValue 300
*/
mapping?: Mapping;
/**
* @defaultValue 1
*/
anisotropy?: number;
};
/**
* Accepted image format for textures.
* For many operations we need a texture based on an image with width & height.
* It could also be a canvas, the only thing we actually need is a width and a height
*/
export type TextureImageFormat = {
width: number;
height: number;
};