{"ast":null,"code":"import { NodeMaterialBlock } from \"../../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\n/**\n * Block used to get the screen sizes\n */\nexport class ScreenSizeBlock extends NodeMaterialBlock {\n /**\n * Creates a new ScreenSizeBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"xy\", NodeMaterialBlockConnectionPointTypes.Vector2, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"x\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"y\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ScreenSizeBlock\";\n }\n /**\n * Gets the xy component\n */\n get xy() {\n return this._outputs[0];\n }\n /**\n * Gets the x component\n */\n get x() {\n return this._outputs[1];\n }\n /**\n * Gets the y component\n */\n get y() {\n return this._outputs[2];\n }\n bind(effect) {\n const engine = this._scene.getEngine();\n effect.setFloat2(this._varName, engine.getRenderWidth(), engine.getRenderHeight());\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n writeOutputs(state, varName) {\n let code = \"\";\n for (const output of this._outputs) {\n if (output.hasEndpoints) {\n code += `${state._declareOutput(output)} = ${varName}.${output.name};\\n`;\n }\n }\n return code;\n }\n _buildBlock(state) {\n super._buildBlock(state);\n this._scene = state.sharedData.scene;\n if (state.target === NodeMaterialBlockTargets.Vertex) {\n // eslint-disable-next-line no-throw-literal\n throw \"ScreenSizeBlock must only be used in a fragment shader\";\n }\n state.sharedData.bindableBlocks.push(this);\n this._varName = state._getFreeVariableName(\"screenSize\");\n state._emitUniformFromString(this._varName, NodeMaterialBlockConnectionPointTypes.Vector2);\n const prefix = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? \"uniforms.\" : \"\";\n state.compilationString += this.writeOutputs(state, prefix + this._varName);\n return this;\n }\n}\nRegisterClass(\"BABYLON.ScreenSizeBlock\", ScreenSizeBlock);","map":{"version":3,"names":["NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","ScreenSizeBlock","constructor","name","Fragment","registerOutput","Vector2","Float","getClassName","xy","_outputs","x","y","bind","effect","engine","_scene","getEngine","setFloat2","_varName","getRenderWidth","getRenderHeight","writeOutputs","state","varName","code","output","hasEndpoints","_declareOutput","_buildBlock","sharedData","scene","target","Vertex","bindableBlocks","push","_getFreeVariableName","_emitUniformFromString","prefix","shaderLanguage","compilationString"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/Fragment/screenSizeBlock.js"],"sourcesContent":["import { NodeMaterialBlock } from \"../../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\n/**\n * Block used to get the screen sizes\n */\nexport class ScreenSizeBlock extends NodeMaterialBlock {\n /**\n * Creates a new ScreenSizeBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"xy\", NodeMaterialBlockConnectionPointTypes.Vector2, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"x\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"y\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ScreenSizeBlock\";\n }\n /**\n * Gets the xy component\n */\n get xy() {\n return this._outputs[0];\n }\n /**\n * Gets the x component\n */\n get x() {\n return this._outputs[1];\n }\n /**\n * Gets the y component\n */\n get y() {\n return this._outputs[2];\n }\n bind(effect) {\n const engine = this._scene.getEngine();\n effect.setFloat2(this._varName, engine.getRenderWidth(), engine.getRenderHeight());\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n writeOutputs(state, varName) {\n let code = \"\";\n for (const output of this._outputs) {\n if (output.hasEndpoints) {\n code += `${state._declareOutput(output)} = ${varName}.${output.name};\\n`;\n }\n }\n return code;\n }\n _buildBlock(state) {\n super._buildBlock(state);\n this._scene = state.sharedData.scene;\n if (state.target === NodeMaterialBlockTargets.Vertex) {\n // eslint-disable-next-line no-throw-literal\n throw \"ScreenSizeBlock must only be used in a fragment shader\";\n }\n state.sharedData.bindableBlocks.push(this);\n this._varName = state._getFreeVariableName(\"screenSize\");\n state._emitUniformFromString(this._varName, NodeMaterialBlockConnectionPointTypes.Vector2);\n const prefix = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? \"uniforms.\" : \"\";\n state.compilationString += this.writeOutputs(state, prefix + this._varName);\n return this;\n }\n}\nRegisterClass(\"BABYLON.ScreenSizeBlock\", ScreenSizeBlock);\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,qCAAqC,QAAQ,sDAAsD;AAC5G,SAASC,wBAAwB,QAAQ,yCAAyC;AAClF,SAASC,aAAa,QAAQ,+BAA+B;AAC7D;AACA;AACA;AACA,OAAO,MAAMC,eAAe,SAASJ,iBAAiB,CAAC;EACnD;AACJ;AACA;AACA;EACIK,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,EAAEJ,wBAAwB,CAACK,QAAQ,CAAC;IAC9C,IAAI,CAACC,cAAc,CAAC,IAAI,EAAEP,qCAAqC,CAACQ,OAAO,EAAEP,wBAAwB,CAACK,QAAQ,CAAC;IAC3G,IAAI,CAACC,cAAc,CAAC,GAAG,EAA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