UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

331 lines (330 loc) 10.2 kB
import { __decorate } from "../tslib.es6.js"; import { serialize } from "../Misc/decorators.js"; import { PostProcess } from "./postProcess.js"; import { ThinImageProcessingPostProcess } from "./thinImageProcessingPostProcess.js"; /** * ImageProcessingPostProcess * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#imageprocessing */ export class ImageProcessingPostProcess extends PostProcess { get _imageProcessingConfiguration() { return this._effectWrapper.imageProcessingConfiguration; } /** * Gets the image processing configuration used either in this material. */ get imageProcessingConfiguration() { return this._effectWrapper.imageProcessingConfiguration; } /** * Sets the Default image processing configuration used either in the this material. * * If sets to null, the scene one is in use. */ set imageProcessingConfiguration(value) { this._effectWrapper.imageProcessingConfiguration = value; } /** * If the post process is supported. */ get isSupported() { const effect = this.getEffect(); return !effect || effect.isSupported; } /** * Gets Color curves setup used in the effect if colorCurvesEnabled is set to true . */ get colorCurves() { return this.imageProcessingConfiguration.colorCurves; } /** * Sets Color curves setup used in the effect if colorCurvesEnabled is set to true . */ set colorCurves(value) { this.imageProcessingConfiguration.colorCurves = value; } /** * Gets whether the color curves effect is enabled. */ get colorCurvesEnabled() { return this.imageProcessingConfiguration.colorCurvesEnabled; } /** * Sets whether the color curves effect is enabled. */ set colorCurvesEnabled(value) { this.imageProcessingConfiguration.colorCurvesEnabled = value; } /** * Gets Color grading LUT texture used in the effect if colorGradingEnabled is set to true. */ get colorGradingTexture() { return this.imageProcessingConfiguration.colorGradingTexture; } /** * Sets Color grading LUT texture used in the effect if colorGradingEnabled is set to true. */ set colorGradingTexture(value) { this.imageProcessingConfiguration.colorGradingTexture = value; } /** * Gets whether the color grading effect is enabled. */ get colorGradingEnabled() { return this.imageProcessingConfiguration.colorGradingEnabled; } /** * Gets whether the color grading effect is enabled. */ set colorGradingEnabled(value) { this.imageProcessingConfiguration.colorGradingEnabled = value; } /** * Gets exposure used in the effect. */ get exposure() { return this.imageProcessingConfiguration.exposure; } /** * Sets exposure used in the effect. */ set exposure(value) { this.imageProcessingConfiguration.exposure = value; } /** * Gets whether tonemapping is enabled or not. */ get toneMappingEnabled() { return this._imageProcessingConfiguration.toneMappingEnabled; } /** * Sets whether tonemapping is enabled or not */ set toneMappingEnabled(value) { this._imageProcessingConfiguration.toneMappingEnabled = value; } /** * Gets the type of tone mapping effect. */ get toneMappingType() { return this._imageProcessingConfiguration.toneMappingType; } /** * Sets the type of tone mapping effect. */ set toneMappingType(value) { this._imageProcessingConfiguration.toneMappingType = value; } /** * Gets contrast used in the effect. */ get contrast() { return this.imageProcessingConfiguration.contrast; } /** * Sets contrast used in the effect. */ set contrast(value) { this.imageProcessingConfiguration.contrast = value; } /** * Gets Vignette stretch size. */ get vignetteStretch() { return this.imageProcessingConfiguration.vignetteStretch; } /** * Sets Vignette stretch size. */ set vignetteStretch(value) { this.imageProcessingConfiguration.vignetteStretch = value; } /** * Gets Vignette center X Offset. * @deprecated use vignetteCenterX instead */ get vignetteCentreX() { return this.imageProcessingConfiguration.vignetteCenterX; } /** * Sets Vignette center X Offset. * @deprecated use vignetteCenterX instead */ set vignetteCentreX(value) { this.imageProcessingConfiguration.vignetteCenterX = value; } /** * Gets Vignette center Y Offset. * @deprecated use vignetteCenterY instead */ get vignetteCentreY() { return this.imageProcessingConfiguration.vignetteCenterY; } /** * Sets Vignette center Y Offset. * @deprecated use vignetteCenterY instead */ set vignetteCentreY(value) { this.imageProcessingConfiguration.vignetteCenterY = value; } /** * Vignette center Y Offset. */ get vignetteCenterY() { return this.imageProcessingConfiguration.vignetteCenterY; } set vignetteCenterY(value) { this.imageProcessingConfiguration.vignetteCenterY = value; } /** * Vignette center X Offset. */ get vignetteCenterX() { return this.imageProcessingConfiguration.vignetteCenterX; } set vignetteCenterX(value) { this.imageProcessingConfiguration.vignetteCenterX = value; } /** * Gets Vignette weight or intensity of the vignette effect. */ get vignetteWeight() { return this.imageProcessingConfiguration.vignetteWeight; } /** * Sets Vignette weight or intensity of the vignette effect. */ set vignetteWeight(value) { this.imageProcessingConfiguration.vignetteWeight = value; } /** * Gets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode) * if vignetteEnabled is set to true. */ get vignetteColor() { return this.imageProcessingConfiguration.vignetteColor; } /** * Sets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode) * if vignetteEnabled is set to true. */ set vignetteColor(value) { this.imageProcessingConfiguration.vignetteColor = value; } /** * Gets Camera field of view used by the Vignette effect. */ get vignetteCameraFov() { return this.imageProcessingConfiguration.vignetteCameraFov; } /** * Sets Camera field of view used by the Vignette effect. */ set vignetteCameraFov(value) { this.imageProcessingConfiguration.vignetteCameraFov = value; } /** * Gets the vignette blend mode allowing different kind of effect. */ get vignetteBlendMode() { return this.imageProcessingConfiguration.vignetteBlendMode; } /** * Sets the vignette blend mode allowing different kind of effect. */ set vignetteBlendMode(value) { this.imageProcessingConfiguration.vignetteBlendMode = value; } /** * Gets whether the vignette effect is enabled. */ get vignetteEnabled() { return this.imageProcessingConfiguration.vignetteEnabled; } /** * Sets whether the vignette effect is enabled. */ set vignetteEnabled(value) { this.imageProcessingConfiguration.vignetteEnabled = value; } /** * Gets intensity of the dithering effect. */ get ditheringIntensity() { return this.imageProcessingConfiguration.ditheringIntensity; } /** * Sets intensity of the dithering effect. */ set ditheringIntensity(value) { this.imageProcessingConfiguration.ditheringIntensity = value; } /** * Gets whether the dithering effect is enabled. */ get ditheringEnabled() { return this.imageProcessingConfiguration.ditheringEnabled; } /** * Sets whether the dithering effect is enabled. */ set ditheringEnabled(value) { this.imageProcessingConfiguration.ditheringEnabled = value; } /** * Gets whether the input of the processing is in Gamma or Linear Space. */ get fromLinearSpace() { return this._effectWrapper.fromLinearSpace; } /** * Sets whether the input of the processing is in Gamma or Linear Space. */ set fromLinearSpace(value) { this._effectWrapper.fromLinearSpace = value; } constructor(name, options, camera = null, samplingMode, engine, reusable, textureType = 0, imageProcessingConfiguration) { const localOptions = { size: typeof options === "number" ? options : undefined, camera, samplingMode, engine, reusable, textureType, imageProcessingConfiguration, scene: camera?.getScene(), ...options, blockCompilation: true, }; super(name, ThinImageProcessingPostProcess.FragmentUrl, { effectWrapper: typeof options === "number" || !options.effectWrapper ? new ThinImageProcessingPostProcess(name, engine, localOptions) : undefined, ...localOptions, }); this.onApply = () => { this._effectWrapper.overrideAspectRatio = this.aspectRatio; }; } /** * "ImageProcessingPostProcess" * @returns "ImageProcessingPostProcess" */ getClassName() { return "ImageProcessingPostProcess"; } /** * @internal */ _updateParameters() { this._effectWrapper._updateParameters(); } dispose(camera) { super.dispose(camera); if (this._imageProcessingConfiguration) { this.imageProcessingConfiguration.applyByPostProcess = false; } } } __decorate([ serialize() ], ImageProcessingPostProcess.prototype, "fromLinearSpace", null); //# sourceMappingURL=imageProcessingPostProcess.js.map