1 |
- {"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 make gl_FragCoord available\n */\nexport class FragCoordBlock extends NodeMaterialBlock {\n /**\n * Creates a new FragCoordBlock\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(\"xyz\", NodeMaterialBlockConnectionPointTypes.Vector3, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"xyzw\", NodeMaterialBlockConnectionPointTypes.Vector4, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"x\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"y\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"z\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"w\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"FragCoordBlock\";\n }\n /**\n * Gets the xy component\n */\n get xy() {\n return this._outputs[0];\n }\n /**\n * Gets the xyz component\n */\n get xyz() {\n return this._outputs[1];\n }\n /**\n * Gets the xyzw component\n */\n get xyzw() {\n return this._outputs[2];\n }\n /**\n * Gets the x component\n */\n get x() {\n return this._outputs[3];\n }\n /**\n * Gets the y component\n */\n get y() {\n return this._outputs[4];\n }\n /**\n * Gets the z component\n */\n get z() {\n return this._outputs[5];\n }\n /**\n * Gets the w component\n */\n get output() {\n return this._outputs[6];\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n writeOutputs(state) {\n let code = \"\";\n const coord = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? \"fragmentInputs.position\" : \"gl_FragCoord\";\n for (const output of this._outputs) {\n if (output.hasEndpoints) {\n code += `${state._declareOutput(output)} = ${coord}.${output.name};\\n`;\n }\n }\n return code;\n }\n _buildBlock(state) {\n super._buildBlock(state);\n if (state.target === NodeMaterialBlockTargets.Vertex) {\n // eslint-disable-next-line no-throw-literal\n throw \"FragCoordBlock must only be used in a fragment shader\";\n }\n state.compilationString += this.writeOutputs(state);\n return this;\n }\n}\nRegisterClass(\"BABYLON.FragCoordBlock\", FragCoordBlock);","map":{"version":3,"names":["NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","FragCoordBlock","constructor","name","Fragment","registerOutput","Vector2","Vector3","Vector4","Float","getClassName","xy","_outputs","xyz","xyzw","x","y","z","output","writeOutputs","state","code","coord","shaderLanguage","hasEndpoints","_declareOutput","_buildBlock","target","Vertex","compilationString"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/Fragment/fragCoordBlock.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 make gl_FragCoord available\n */\nexport class FragCoordBlock extends NodeMaterialBlock {\n /**\n * Creates a new FragCoordBlock\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(\"xyz\", NodeMaterialBlockConnectionPointTypes.Vector3, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"xyzw\", NodeMaterialBlockConnectionPointTypes.Vector4, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"x\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"y\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"z\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"w\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"FragCoordBlock\";\n }\n /**\n * Gets the xy component\n */\n get xy() {\n return this._outputs[0];\n }\n /**\n * Gets the xyz component\n */\n get xyz() {\n return this._outputs[1];\n }\n /**\n * Gets the xyzw component\n */\n get xyzw() {\n return this._outputs[2];\n }\n /**\n * Gets the x component\n */\n get x() {\n return this._outputs[3];\n }\n /**\n * Gets the y component\n */\n get y() {\n return this._outputs[4];\n }\n /**\n * Gets the z component\n */\n get z() {\n return this._outputs[5];\n }\n /**\n * Gets the w component\n */\n get output() {\n return this._outputs[6];\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n writeOutputs(state) {\n let code = \"\";\n const coord = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? \"fragmentInputs.position\" : \"gl_FragCoord\";\n for (const output of this._outputs) {\n if (output.hasEndpoints) {\n code += `${state._declareOutput(output)} = ${coord}.${output.name};\\n`;\n }\n }\n return code;\n }\n _buildBlock(state) {\n super._buildBlock(state);\n if (state.target === NodeMaterialBlockTargets.Vertex) {\n // eslint-disable-next-line no-throw-literal\n throw \"FragCoordBlock must only be used in a fragment shader\";\n }\n state.compilationString += this.writeOutputs(state);\n return this;\n }\n}\nRegisterClass(\"BABYLON.FragCoordBlock\", FragCoordBlock);\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,4BAA4B;A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