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.

152 lines 6.91 kB
import { __decorate } from "../../../../tslib.es6.js"; import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js"; import { NodeRenderGraphBasePostProcessBlock } from "./basePostProcessBlock.js"; /** * Base class for post process blocks. */ export class NodeRenderGraphBaseWithPropertiesPostProcessBlock extends NodeRenderGraphBasePostProcessBlock { constructor() { super(...arguments); this._useCurrentViewport = false; this._useFullScreenViewport = true; this._viewport = { x: 0, y: 0, width: 1, height: 1 }; } /** If true, the depth attachment will be read-only. */ get depthReadOnly() { return this._frameGraphTask.depthReadOnly; } set depthReadOnly(value) { this._frameGraphTask.depthReadOnly = value; } /** If true, the stencil attachment will be read-only. */ get stencilReadOnly() { return this._frameGraphTask.stencilReadOnly; } set stencilReadOnly(value) { this._frameGraphTask.stencilReadOnly = value; } /** If true, color write will be disabled when applying the post process. */ get disableColorWrite() { return this._frameGraphTask.disableColorWrite; } set disableColorWrite(value) { this._frameGraphTask.disableColorWrite = value; } /** If true, the post process will be generated by a back face full-screen quad (CW order). */ get drawBackFace() { return this._frameGraphTask.drawBackFace; } set drawBackFace(value) { this._frameGraphTask.drawBackFace = value; } /** If depth testing should be enabled (default is true). */ get depthTest() { return this._frameGraphTask.depthTest; } set depthTest(value) { this._frameGraphTask.depthTest = value; } _setViewport() { if (this._useCurrentViewport) { this._frameGraphTask.viewport = null; } else if (this._useFullScreenViewport) { this._frameGraphTask.viewport = undefined; } else { this._frameGraphTask.viewport = this._viewport; } } /** If true, the current viewport will be left unchanged. */ get useCurrentViewport() { return this._useCurrentViewport; } set useCurrentViewport(value) { this._useCurrentViewport = value; this._setViewport(); } /** If true, a full screen viewport will be used. */ get useFullScreenViewport() { return this._useFullScreenViewport; } set useFullScreenViewport(value) { this._useFullScreenViewport = value; this._setViewport(); } /** The viewport to use. */ get viewport() { return this._viewport; } set viewport(value) { this._viewport = value; this._setViewport(); } /** * Gets the current class name * @returns the class name */ getClassName() { return "NodeRenderGraphBaseWithPropertiesPostProcessBlock"; } _dumpPropertiesCode() { const codes = []; codes.push(`${this._codeVariableName}.depthReadOnly = ${this.depthReadOnly};`); codes.push(`${this._codeVariableName}.stencilReadOnly = ${this.stencilReadOnly};`); codes.push(`${this._codeVariableName}.disableColorWrite = ${this.disableColorWrite};`); codes.push(`${this._codeVariableName}.drawBackFace = ${this.drawBackFace};`); codes.push(`${this._codeVariableName}.depthTest = ${this.depthTest};`); codes.push(`${this._codeVariableName}.viewport = ${this._useCurrentViewport ? "null" : this._useFullScreenViewport ? "undefined" : JSON.stringify(this._viewport)};`); return super._dumpPropertiesCode() + codes.join("\n"); } serialize() { const serializationObject = super.serialize(); serializationObject.depthReadOnly = this.depthReadOnly; serializationObject.stencilReadOnly = this.stencilReadOnly; serializationObject.disableColorWrite = this.disableColorWrite; serializationObject.drawBackFace = this.drawBackFace; serializationObject.depthTest = this.depthTest; serializationObject.useCurrentViewport = this._useCurrentViewport; serializationObject.useFullScreenViewport = this._useFullScreenViewport; serializationObject.viewport = this._viewport; return serializationObject; } _deserialize(serializationObject) { super._deserialize(serializationObject); this.depthReadOnly = !!serializationObject.depthReadOnly; this.stencilReadOnly = !!serializationObject.stencilReadOnly; this.disableColorWrite = !!serializationObject.disableColorWrite; this.drawBackFace = !!serializationObject.drawBackFace; this.depthTest = serializationObject.depthTest ?? true; if (serializationObject.useCurrentViewport !== undefined) { this._useCurrentViewport = serializationObject.useCurrentViewport; this._useFullScreenViewport = serializationObject.useFullScreenViewport; this._viewport = serializationObject.viewport; } this._setViewport(); } } __decorate([ editableInPropertyPage("Depth Read Only", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES") ], NodeRenderGraphBaseWithPropertiesPostProcessBlock.prototype, "depthReadOnly", null); __decorate([ editableInPropertyPage("Stencil Read Only", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES") ], NodeRenderGraphBaseWithPropertiesPostProcessBlock.prototype, "stencilReadOnly", null); __decorate([ editableInPropertyPage("Disable Color Write", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES") ], NodeRenderGraphBaseWithPropertiesPostProcessBlock.prototype, "disableColorWrite", null); __decorate([ editableInPropertyPage("Draw Back Face", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES") ], NodeRenderGraphBaseWithPropertiesPostProcessBlock.prototype, "drawBackFace", null); __decorate([ editableInPropertyPage("Depth Test", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES") ], NodeRenderGraphBaseWithPropertiesPostProcessBlock.prototype, "depthTest", null); __decorate([ editableInPropertyPage("Use currently active viewport", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES") ], NodeRenderGraphBaseWithPropertiesPostProcessBlock.prototype, "useCurrentViewport", null); __decorate([ editableInPropertyPage("Use full screen viewport", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES") ], NodeRenderGraphBaseWithPropertiesPostProcessBlock.prototype, "useFullScreenViewport", null); __decorate([ editableInPropertyPage("    Viewport", 13 /* PropertyTypeForEdition.Viewport */, "BASE PROPERTIES") ], NodeRenderGraphBaseWithPropertiesPostProcessBlock.prototype, "viewport", null); //# sourceMappingURL=baseWithPropertiesPostProcessBlock.js.map