1 |
- {"ast":null,"code":"import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../../Types/nodeRenderGraphTypes.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\nimport { FrameGraphBlackAndWhiteTask } from \"../../../Tasks/PostProcesses/blackAndWhiteTask.js\";\nimport { ThinBlackAndWhitePostProcess } from \"../../../../PostProcesses/thinBlackAndWhitePostProcess.js\";\n/**\n * Block that implements the black and white post process\n */\nexport class NodeRenderGraphBlackAndWhitePostProcessBlock extends NodeRenderGraphBlock {\n /**\n * Gets the frame graph task associated with this block\n */\n get task() {\n return this._frameGraphTask;\n }\n /**\n * Create a new BlackAndWhitePostProcessBlock\n * @param name defines the block name\n * @param frameGraph defines the hosting frame graph\n * @param scene defines the hosting scene\n */\n constructor(name, frameGraph, scene) {\n super(name, frameGraph, scene);\n this.registerInput(\"source\", NodeRenderGraphBlockConnectionPointTypes.Texture);\n this.registerInput(\"destination\", NodeRenderGraphBlockConnectionPointTypes.Texture, true);\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\n this.source.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\n this.destination.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAll);\n this.output._typeConnectionSource = () => {\n return this.destination.isConnected ? this.destination : this.source;\n };\n this._frameGraphTask = new FrameGraphBlackAndWhiteTask(this.name, frameGraph, new ThinBlackAndWhitePostProcess(name, scene.getEngine()));\n }\n /** Sampling mode used to sample from the source texture */\n get sourceSamplingMode() {\n return this._frameGraphTask.sourceSamplingMode;\n }\n set sourceSamplingMode(value) {\n this._frameGraphTask.sourceSamplingMode = value;\n }\n /** Degree of conversion to black and white (default: 1 - full b&w conversion) */\n get degree() {\n return this._frameGraphTask.postProcess.degree;\n }\n set degree(value) {\n this._frameGraphTask.postProcess.degree = value;\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"NodeRenderGraphBlackAndWhitePostProcessBlock\";\n }\n /**\n * Gets the source input component\n */\n get source() {\n return this._inputs[0];\n }\n /**\n * Gets the destination input component\n */\n get destination() {\n return this._inputs[1];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n super._buildBlock(state);\n this._frameGraphTask.name = this.name;\n this.output.value = this._frameGraphTask.outputTexture; // the value of the output connection point is the \"output\" texture of the task\n const sourceConnectedPoint = this.source.connectedPoint;\n if (sourceConnectedPoint) {\n this._frameGraphTask.sourceTexture = sourceConnectedPoint.value;\n }\n const destinationConnectedPoint = this.destination.connectedPoint;\n if (destinationConnectedPoint) {\n this._frameGraphTask.destinationTexture = destinationConnectedPoint.value;\n }\n }\n _dumpPropertiesCode() {\n const codes = [];\n codes.push(`${this._codeVariableName}.degree = ${this.degree};`);\n codes.push(`${this._codeVariableName}.sourceSamplingMode = ${this.sourceSamplingMode};`);\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\n }\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.degree = this.degree;\n serializationObject.sourceSamplingMode = this.sourceSamplingMode;\n return serializationObject;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n this.degree = serializationObject.degree;\n this.sourceSamplingMode = serializationObject.sourceSamplingMode;\n }\n}\n__decorate([editableInPropertyPage(\"Source sampling mode\", 6 /* PropertyTypeForEdition.SamplingMode */, \"PROPERTIES\")], NodeRenderGraphBlackAndWhitePostProcessBlock.prototype, \"sourceSamplingMode\", null);\n__decorate([editableInPropertyPage(\"Degree\", 1 /* PropertyTypeForEdition.Float */, \"PROPERTIES\", {\n min: 0,\n max: 1\n})], NodeRenderGraphBlackAndWhitePostProcessBlock.prototype, \"degree\", null);\nRegisterClass(\"BABYLON.NodeRenderGraphBlackAndWhitePostProcessBlock\", NodeRenderGraphBlackAndWhitePostProcessBlock);","map":{"version":3,"names":["__decorate","NodeRenderGraphBlock","RegisterClass","NodeRenderGraphBlockConnectionPointTypes","editableInPropertyPage","FrameGraphBlackAndWhiteTask","ThinBlackAndWhitePostProcess","NodeRenderGraphBlackAndWhitePostProcessBlock","task","_frameGraphTask","constructor","name","frameGraph","scene","registerInput","Texture","registerOutput","BasedOnInput","source","addAcceptedConnectionPointTypes","TextureAllButBackBuffer","destination","TextureAll","output","_typeConnectionSource","isConnected","getEngine","sourceSamplingMode","value","degree","postProcess","getClassName","_inputs","_outputs","_buildBlock","state","outputTexture","sourceConnectedPoint","connectedPoint","sourceTexture","destinationConnectedPoint","destinationTexture","_dumpPropertiesCode","codes","push","_codeVariableName","join","serialize","serializationObject","_deserialize","prototype","min","max"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js"],"sourcesContent":["import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../../Types/nodeRenderGraphTypes.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\nimport { FrameGraphBlackAndWhiteTask } from \"../../../Tasks/PostProcesses/blackAndWhiteTask.js\";\nimport { ThinBlackAndWhitePostProcess } from \"../../../../PostProcesses/thinBlackAndWhitePostProcess.js\";\n/**\n * Block that implements the black and white post process\n */\nexport class NodeRenderGraphBlackAndWhitePostProcessBlock extends NodeRenderGraphBlock {\n /**\n * Gets the frame graph task associated with this block\n */\n get task() {\n return this._frameGraphTask;\n }\n /**\n * Create a new BlackAndWhitePostProcessBlock\n * @param name defines the block name\n * @param frameGraph defines the hosting frame graph\n * @param scene defines the hosting scene\n */\n constructor(name, frameGraph, scene) {\n super(name, frameGraph, scene);\n this.registerInput(\"source\", NodeRenderGraphBlockConnectionPointTypes.Texture);\n this.registerInput(\"destination\", NodeRenderGraphBlockConnectionPointTypes.Texture, true);\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\n this.source.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\n this.destination.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAll);\n this.output._typeConnectionSource = () => {\n return this.destination.isConnected ? this.destination : this.source;\n };\n this._frameGraphTask = new FrameGraphBlackAndWhiteTask(this.name, frameGraph, new ThinBlackAndWhitePostProcess(name, scene.getEngine()));\n }\n /** Sampling mode used to sample from the source texture */\n get sourceSamplingMode() {\n return this._frameGraphTask.sourceSamplingMode;\n }\n set sourceSamplingMode(value) {\n this._frameGraphTask.sourceSamplingMode = value;\n }\n /** Degree of conversion to black and white (default: 1 - full b&w conversion) */\n get degree() {\n return this._frameGraphTask.postProcess.degree;\n }\n set degree(value) {\n this._frameGraphTask.postProcess.degree = value;\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"NodeRenderGraphBlackAndWhitePostProcessBlock\";\n }\n /**\n * Gets the source input component\n */\n get source() {\n return this._inputs[0];\n }\n /**\n * Gets the destination input component\n */\n get destination() {\n return this._inputs[1];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n super._buildBlock(state);\n this._frameGraphTask.name = this.name;\n this.output.value = this._frameGraphTask.outputTexture; // the value of the output connection point is the \"output\" texture of the task\n const sourceConnectedPoint = this.source.connectedPoint;\n if (sourceConnectedPoint) {\n this._frameGraphTask.sourceTexture = sourceConnectedPoint.value;\n }\n const destinationConnectedPoint = this.destination.connectedPoint;\n if (destinationConnectedPoint) {\n this._frameGraphTask.destinationTexture = destinationConnectedPoint.value;\n }\n }\n _dumpPropertiesCode() {\n const codes = [];\n codes.push(`${this._codeVariableName}.degree = ${this.degree};`);\n codes.push(`${this._codeVariableName}.sourceSamplingMode = ${this.sourceSamplingMode};`);\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\n }\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.degree = this.degree;\n serializationObject.sourceSamplingMode = this.sourceSamplingMode;\n return serializationObject;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n this.degree = serializationObject.degree;\n this.sourceSamplingMode = serializationObject.sourceSamplingMode;\n }\n}\n__decorate([\n editableInPropertyPage(\"Source sampling mode\", 6 /* PropertyTypeForEdition.SamplingMode */, \"PROPERTIES\")\n], NodeRenderGraphBlackAndWhitePostProcessBlock.prototype, \"sourceSamplingMode\", null);\n__decorate([\n editableInPropertyPage(\"Degree\", 1 /* PropertyTypeForEdition.Float */, \"PROPERTIES\", { min: 0, max: 1 })\n], NodeRenderGraphBlackAndWhitePostProcessBlock.prototype, \"degree\", null);\nRegisterClass(\"BABYLON.NodeRenderGraphBlackAndWhitePostProcessBlock\", NodeRenderGraphBlackAndWhitePostProcessBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,oBAAoB,QAAQ,+BAA+B;AACpE,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,wCAAwC,QAAQ,qCAAqC;AAC9F,SAASC,sBAAsB,QAAQ,yCAAyC;AAChF,SAASC,2BAA2B,QAAQ,mDAAmD;AAC/F,SAASC,4BAA4B,QAAQ,2DAA2D;AACxG;AACA;AACA;AACA,OAAO,MAAMC,4CAA4C,SAASN,oBAAoB,CAAC;EACnF;AACJ;AACA;EACI,IAAIO,IAAIA,CAAA,EAAG;IACP,OAAO,IAAI,CAACC,eAAe;EAC/B;EACA;AACJ;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAACC,IAAI,EAAEC,UAAU,EAAEC,KAAK,EAAE;IACjC,KAAK,CAACF,IAAI,EAAEC,UAAU,EAAEC,KAAK,CAAC;IAC9B,IAAI,CAAC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