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.

164 lines 10.6 kB
import { __esDecorate, __runInitializers } from "../../../../tslib.es6.js"; import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js"; import { NodeRenderGraphBasePostProcessBlock } from "./basePostProcessBlock.js"; /** * Base class for post process blocks. */ let NodeRenderGraphBaseWithPropertiesPostProcessBlock = (() => { var _a; let _classSuper = NodeRenderGraphBasePostProcessBlock; let _instanceExtraInitializers = []; let _get_depthReadOnly_decorators; let _get_stencilReadOnly_decorators; let _get_disableColorWrite_decorators; let _get_drawBackFace_decorators; let _get_depthTest_decorators; let _get_useCurrentViewport_decorators; let _get_useFullScreenViewport_decorators; let _get_viewport_decorators; return _a = class NodeRenderGraphBaseWithPropertiesPostProcessBlock extends _classSuper { constructor() { super(...arguments); this._frameGraphTask = __runInitializers(this, _instanceExtraInitializers); 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(); } }, (() => { const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0; _get_depthReadOnly_decorators = [editableInPropertyPage("Depth Read Only", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES")]; _get_stencilReadOnly_decorators = [editableInPropertyPage("Stencil Read Only", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES")]; _get_disableColorWrite_decorators = [editableInPropertyPage("Disable Color Write", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES")]; _get_drawBackFace_decorators = [editableInPropertyPage("Draw Back Face", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES")]; _get_depthTest_decorators = [editableInPropertyPage("Depth Test", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES")]; _get_useCurrentViewport_decorators = [editableInPropertyPage("Use currently active viewport", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES")]; _get_useFullScreenViewport_decorators = [editableInPropertyPage("Use full screen viewport", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES")]; _get_viewport_decorators = [editableInPropertyPage("    Viewport", 13 /* PropertyTypeForEdition.Viewport */, "BASE PROPERTIES")]; __esDecorate(_a, null, _get_depthReadOnly_decorators, { kind: "getter", name: "depthReadOnly", static: false, private: false, access: { has: obj => "depthReadOnly" in obj, get: obj => obj.depthReadOnly }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _get_stencilReadOnly_decorators, { kind: "getter", name: "stencilReadOnly", static: false, private: false, access: { has: obj => "stencilReadOnly" in obj, get: obj => obj.stencilReadOnly }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _get_disableColorWrite_decorators, { kind: "getter", name: "disableColorWrite", static: false, private: false, access: { has: obj => "disableColorWrite" in obj, get: obj => obj.disableColorWrite }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _get_drawBackFace_decorators, { kind: "getter", name: "drawBackFace", static: false, private: false, access: { has: obj => "drawBackFace" in obj, get: obj => obj.drawBackFace }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _get_depthTest_decorators, { kind: "getter", name: "depthTest", static: false, private: false, access: { has: obj => "depthTest" in obj, get: obj => obj.depthTest }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _get_useCurrentViewport_decorators, { kind: "getter", name: "useCurrentViewport", static: false, private: false, access: { has: obj => "useCurrentViewport" in obj, get: obj => obj.useCurrentViewport }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _get_useFullScreenViewport_decorators, { kind: "getter", name: "useFullScreenViewport", static: false, private: false, access: { has: obj => "useFullScreenViewport" in obj, get: obj => obj.useFullScreenViewport }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_a, null, _get_viewport_decorators, { kind: "getter", name: "viewport", static: false, private: false, access: { has: obj => "viewport" in obj, get: obj => obj.viewport }, metadata: _metadata }, null, _instanceExtraInitializers); if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); })(), _a; })(); export { NodeRenderGraphBaseWithPropertiesPostProcessBlock }; //# sourceMappingURL=baseWithPropertiesPostProcessBlock.js.map