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.

88 lines 4.33 kB
import { __decorate } from "../../../../tslib.es6.js"; import { Vector2 } from "../../../../Maths/math.vector.js"; import { RegisterClass } from "../../../../Misc/typeStore.js"; import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js"; import { FrameGraphChromaticAberrationTask } from "../../../Tasks/PostProcesses/chromaticAberrationTask.js"; import { ThinChromaticAberrationPostProcess } from "../../../../PostProcesses/thinChromaticAberrationPostProcess.js"; import { NodeRenderGraphBasePostProcessBlock } from "./basePostProcessBlock.js"; /** * Block that implements the chromatic aberration post process */ export class NodeRenderGraphChromaticAberrationPostProcessBlock extends NodeRenderGraphBasePostProcessBlock { /** * Gets the frame graph task associated with this block */ get task() { return this._frameGraphTask; } /** * Create a new chromatic aberration post process block * @param name defines the block name * @param frameGraph defines the hosting frame graph * @param scene defines the hosting scene */ constructor(name, frameGraph, scene) { super(name, frameGraph, scene); this._finalizeInputOutputRegistering(); this._frameGraphTask = new FrameGraphChromaticAberrationTask(this.name, frameGraph, new ThinChromaticAberrationPostProcess(name, scene.getEngine())); } /** The amount of separation of rgb channels */ get aberrationAmount() { return this._frameGraphTask.postProcess.aberrationAmount; } set aberrationAmount(value) { this._frameGraphTask.postProcess.aberrationAmount = value; } /** The amount the effect will increase for pixels closer to the edge of the screen */ get radialIntensity() { return this._frameGraphTask.postProcess.radialIntensity; } set radialIntensity(value) { this._frameGraphTask.postProcess.radialIntensity = value; } /** The normalized direction in which the rgb channels should be separated. If set to 0,0 radial direction will be used. */ get direction() { return this._frameGraphTask.postProcess.direction; } set direction(value) { this._frameGraphTask.postProcess.direction = value; } /** * Gets the current class name * @returns the class name */ getClassName() { return "NodeRenderGraphChromaticAberrationPostProcessBlock"; } _dumpPropertiesCode() { const codes = []; codes.push(`${this._codeVariableName}.aberrationAmount = ${this.aberrationAmount};`); codes.push(`${this._codeVariableName}.radialIntensity = ${this.radialIntensity};`); codes.push(`${this._codeVariableName}.direction = new BABYLON.Vector2(${this.direction.x}, ${this.direction.y});`); return super._dumpPropertiesCode() + codes.join("\n"); } serialize() { const serializationObject = super.serialize(); serializationObject.aberrationAmount = this.aberrationAmount; serializationObject.radialIntensity = this.radialIntensity; serializationObject.direction = this.direction.asArray(); return serializationObject; } _deserialize(serializationObject) { super._deserialize(serializationObject); this.aberrationAmount = serializationObject.aberrationAmount; this.radialIntensity = serializationObject.radialIntensity; this.direction = Vector2.FromArray(serializationObject.direction); } } __decorate([ editableInPropertyPage("Amount", 1 /* PropertyTypeForEdition.Float */, "PROPERTIES", { min: -1000, max: 1000 }) ], NodeRenderGraphChromaticAberrationPostProcessBlock.prototype, "aberrationAmount", null); __decorate([ editableInPropertyPage("Radial intensity", 1 /* PropertyTypeForEdition.Float */, "PROPERTIES", { min: 0.1, max: 5 }) ], NodeRenderGraphChromaticAberrationPostProcessBlock.prototype, "radialIntensity", null); __decorate([ editableInPropertyPage("Direction", 3 /* PropertyTypeForEdition.Vector2 */, "PROPERTIES") ], NodeRenderGraphChromaticAberrationPostProcessBlock.prototype, "direction", null); RegisterClass("BABYLON.NodeRenderGraphChromaticAberrationPostProcessBlock", NodeRenderGraphChromaticAberrationPostProcessBlock); //# sourceMappingURL=chromaticAberrationPostProcessBlock.js.map