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.

74 lines 3.07 kB
import { __decorate } from "../../../../tslib.es6.js"; import { RegisterClass } from "../../../../Misc/typeStore.js"; import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js"; import { FrameGraphGrainTask } from "../../../Tasks/PostProcesses/grainTask.js"; import { ThinGrainPostProcess } from "../../../../PostProcesses/thinGrainPostProcess.js"; import { NodeRenderGraphBasePostProcessBlock } from "./basePostProcessBlock.js"; /** * Block that implements the grain post process */ export class NodeRenderGraphGrainPostProcessBlock extends NodeRenderGraphBasePostProcessBlock { /** * Gets the frame graph task associated with this block */ get task() { return this._frameGraphTask; } /** * Create a new grain 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 FrameGraphGrainTask(this.name, frameGraph, new ThinGrainPostProcess(name, scene.getEngine())); } /** The intensity of the grain added */ get intensity() { return this._frameGraphTask.postProcess.intensity; } set intensity(value) { this._frameGraphTask.postProcess.intensity = value; } /** If the grain should be randomized on every frame */ get animated() { return this._frameGraphTask.postProcess.animated; } set animated(value) { this._frameGraphTask.postProcess.animated = value; } /** * Gets the current class name * @returns the class name */ getClassName() { return "NodeRenderGraphGrainPostProcessBlock"; } _dumpPropertiesCode() { const codes = []; codes.push(`${this._codeVariableName}.intensity = ${this.intensity};`); codes.push(`${this._codeVariableName}.animated = ${this.animated};`); return super._dumpPropertiesCode() + codes.join("\n"); } serialize() { const serializationObject = super.serialize(); serializationObject.intensity = this.intensity; serializationObject.animated = this.animated; return serializationObject; } _deserialize(serializationObject) { super._deserialize(serializationObject); this.intensity = serializationObject.intensity; this.animated = serializationObject.animated; } } __decorate([ editableInPropertyPage("Intensity", 1 /* PropertyTypeForEdition.Float */, "PROPERTIES", { min: 0, max: 200 }) ], NodeRenderGraphGrainPostProcessBlock.prototype, "intensity", null); __decorate([ editableInPropertyPage("Animated", 0 /* PropertyTypeForEdition.Boolean */, "PROPERTIES") ], NodeRenderGraphGrainPostProcessBlock.prototype, "animated", null); RegisterClass("BABYLON.NodeRenderGraphGrainPostProcessBlock", NodeRenderGraphGrainPostProcessBlock); //# sourceMappingURL=grainPostProcessBlock.js.map