/** * @import { GraphicsDevice } from '../../platform/graphics/graphics-device.js' * @import { Texture } from '../../platform/graphics/texture.js' */ /** * Render pass implementation of a down-sample filter. * * @category Graphics * @ignore */ export class RenderPassDownsample extends RenderPassShaderQuad { /** * @param {GraphicsDevice} device - The graphics device. * @param {Texture} sourceTexture - The source texture to downsample. * @param {object} [options] - The options for the render pass. * @param {boolean} [options.boxFilter] - Whether to use a box filter for downsampling. * @param {Texture|null} [options.premultiplyTexture] - The texture to premultiply the source texture * with. Only supported when boxFilter is true. * @param {string} [options.premultiplySrcChannel] - The source channel to premultiply. * @param {boolean} [options.removeInvalid] - Whether to remove invalid pixels from the output. * @param {boolean} [options.prefilter] - Whether to apply a soft-knee high pass to the output, * scaling down what sits below {@link RenderPassDownsample#prefilterThreshold}. Used by the * first bloom downsample to limit bloom to the brightest parts of the scene. Enabling this * generates a separate shader variant, so leave it off when the threshold is zero. */ constructor(device: GraphicsDevice, sourceTexture: Texture, options?: { boxFilter?: boolean; premultiplyTexture?: Texture | null; premultiplySrcChannel?: string; removeInvalid?: boolean; prefilter?: boolean; }); /** * The texture to downsample. Use {@link RenderPassDownsample#setSourceTexture} to change it, * which also sizes the render target from the new texture. * * @type {Texture} */ sourceTexture: Texture; premultiplyTexture: Texture; /** * Whether the high pass is compiled into this pass' shader. * * @type {boolean} * @readonly */ readonly prefilter: boolean; /** * Brightness below which the high pass scales the output down, in the units of the source * texture. Ignored unless the pass was created with the `prefilter` option. * * @type {number} */ prefilterThreshold: number; /** * Width of the quadratic transition below {@link RenderPassDownsample#prefilterThreshold}. * * @type {number} */ prefilterKnee: number; sourceTextureId: import("../../index.js").ScopeId; premultiplyTextureId: import("../../index.js").ScopeId; sourceInvResolutionId: import("../../index.js").ScopeId; sourceInvResolutionValue: Float32Array; prefilterThresholdKneeId: import("../../index.js").ScopeId; prefilterThresholdKneeValue: Float32Array; /** * Sets the texture to downsample, and the texture the render target is sized from. * * @param {Texture} value - The source texture. */ setSourceTexture(value: Texture): void; } import { RenderPassShaderQuad } from '../../scene/graphics/render-pass-shader-quad.js'; import type { Texture } from '../../platform/graphics/texture.js'; import type { GraphicsDevice } from '../../platform/graphics/graphics-device.js';