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 { FrameGraphBlurTask } from \"../../../Tasks/PostProcesses/blurTask.js\";\nimport { ThinBlurPostProcess } from \"../../../../PostProcesses/thinBlurPostProcess.js\";\nimport { Vector2 } from \"../../../../Maths/math.vector.js\";\n/**\n * Block that implements the blur post process\n */\nexport class NodeRenderGraphBlurPostProcessBlock 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 NodeRenderGraphBlurPostProcessBlock\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 FrameGraphBlurTask(this.name, frameGraph, new ThinBlurPostProcess(name, scene.getEngine(), new Vector2(1, 0), 32));\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 /** The direction in which to blur the image */\n get direction() {\n return this._frameGraphTask.postProcess.direction;\n }\n set direction(value) {\n this._frameGraphTask.postProcess.direction = value;\n }\n /** Length in pixels of the blur sample region */\n get kernel() {\n return this._frameGraphTask.postProcess.kernel;\n }\n set kernel(value) {\n this._frameGraphTask.postProcess.kernel = value;\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"NodeRenderGraphBlurPostProcessBlock\";\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}.direction = new BABYLON.Vector2(${this.direction.x}, ${this.direction.y});`);\n codes.push(`${this._codeVariableName}.kernel = ${this.kernel};`);\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.direction = this.direction.asArray();\n serializationObject.kernel = this.kernel;\n serializationObject.sourceSamplingMode = this.sourceSamplingMode;\n return serializationObject;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n this.direction.fromArray(serializationObject.direction);\n this.kernel = serializationObject.kernel;\n this.sourceSamplingMode = serializationObject.sourceSamplingMode;\n }\n}\n__decorate([editableInPropertyPage(\"Source sampling mode\", 6 /* PropertyTypeForEdition.SamplingMode */, \"PROPERTIES\")], NodeRenderGraphBlurPostProcessBlock.prototype, \"sourceSamplingMode\", null);\n__decorate([editableInPropertyPage(\"Direction\", 3 /* PropertyTypeForEdition.Vector2 */, \"PROPERTIES\")], NodeRenderGraphBlurPostProcessBlock.prototype, \"direction\", null);\n__decorate([editableInPropertyPage(\"Kernel\", 2 /* PropertyTypeForEdition.Int */, \"PROPERTIES\", {\n min: 1,\n max: 256\n})], NodeRenderGraphBlurPostProcessBlock.prototype, \"kernel\", null);\nRegisterClass(\"BABYLON.NodeRenderGraphBlurPostProcessBlock\", NodeRenderGraphBlurPostProcessBlock);","map":{"version":3,"names":["__decorate","NodeRenderGraphBlock","RegisterClass","NodeRenderGraphBlockConnectionPointTypes","editableInPropertyPage","FrameGraphBlurTask","ThinBlurPostProcess","Vector2","NodeRenderGraphBlurPostProcessBlock","task","_frameGraphTask","constructor","name","frameGraph","scene","registerInput","Texture","registerOutput","BasedOnInput","source","addAcceptedConnectionPointTypes","TextureAllButBackBuffer","destination","TextureAll","output","_typeConnectionSource","isConnected","getEngine","sourceSamplingMode","value","direction","postProcess","kernel","getClassName","_inputs","_outputs","_buildBlock","state","outputTexture","sourceConnectedPoint","connectedPoint","sourceTexture","destinationConnectedPoint","destinationTexture","_dumpPropertiesCode","codes","push","_codeVariableName","x","y","join","serialize","serializationObject","asArray","_deserialize","fromArray","prototype","min","max"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.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 { FrameGraphBlurTask } from \"../../../Tasks/PostProcesses/blurTask.js\";\nimport { ThinBlurPostProcess } from \"../../../../PostProcesses/thinBlurPostProcess.js\";\nimport { Vector2 } from \"../../../../Maths/math.vector.js\";\n/**\n * Block that implements the blur post process\n */\nexport class NodeRenderGraphBlurPostProcessBlock 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 NodeRenderGraphBlurPostProcessBlock\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 FrameGraphBlurTask(this.name, frameGraph, new ThinBlurPostProcess(name, scene.getEngine(), new Vector2(1, 0), 32));\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 /** The direction in which to blur the image */\n get direction() {\n return this._frameGraphTask.postProcess.direction;\n }\n set direction(value) {\n this._frameGraphTask.postProcess.direction = value;\n }\n /** Length in pixels of the blur sample region */\n get kernel() {\n return this._frameGraphTask.postProcess.kernel;\n }\n set kernel(value) {\n this._frameGraphTask.postProcess.kernel = value;\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"NodeRenderGraphBlurPostProcessBlock\";\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}.direction = new BABYLON.Vector2(${this.direction.x}, ${this.direction.y});`);\n codes.push(`${this._codeVariableName}.kernel = ${this.kernel};`);\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.direction = this.direction.asArray();\n serializationObject.kernel = this.kernel;\n serializationObject.sourceSamplingMode = this.sourceSamplingMode;\n return serializationObject;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n this.direction.fromArray(serializationObject.direction);\n this.kernel = serializationObject.kernel;\n this.sourceSamplingMode = serializationObject.sourceSamplingMode;\n }\n}\n__decorate([\n editableInPropertyPage(\"Source sampling mode\", 6 /* PropertyTypeForEdition.SamplingMode */, \"PROPERTIES\")\n], NodeRenderGraphBlurPostProcessBlock.prototype, \"sourceSamplingMode\", null);\n__decorate([\n editableInPropertyPage(\"Direction\", 3 /* PropertyTypeForEdition.Vector2 */, \"PROPERTIES\")\n], NodeRenderGraphBlurPostProcessBlock.prototype, \"direction\", null);\n__decorate([\n editableInPropertyPage(\"Kernel\", 2 /* PropertyTypeForEdition.Int */, \"PROPERTIES\", { min: 1, max: 256 })\n], NodeRenderGraphBlurPostProcessBlock.prototype, \"kernel\", null);\nRegisterClass(\"BABYLON.NodeRenderGraphBl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