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 output the vertex position\n */\nexport class VertexOutputBlock extends NodeMaterialBlock {\n /**\n * Creates a new VertexOutputBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Vertex, true);\n this.registerInput(\"vector\", NodeMaterialBlockConnectionPointTypes.Vector4);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"VertexOutputBlock\";\n }\n /**\n * Gets the vector input component\n */\n get vector() {\n return this._inputs[0];\n }\n _isLogarithmicDepthEnabled(nodeList, useLogarithmicDepth) {\n if (useLogarithmicDepth) {\n return true;\n }\n for (const node of nodeList) {\n if (node.useLogarithmicDepth) {\n return true;\n }\n }\n return false;\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const input = this.vector;\n const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;\n if (state.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {\n state.compilationString += `vertexOutputs.position = ${input.associatedVariableName};\\n`;\n } else {\n state.compilationString += `gl_Position = ${input.associatedVariableName};\\n`;\n }\n // TODOWGSL\n if (this._isLogarithmicDepthEnabled(state.sharedData.fragmentOutputNodes, state.sharedData.nodeMaterial.useLogarithmicDepth)) {\n state._emitUniformFromString(\"logarithmicDepthConstant\", NodeMaterialBlockConnectionPointTypes.Float);\n state._emitVaryingFromString(\"vFragmentDepth\", NodeMaterialBlockConnectionPointTypes.Float);\n const fragDepth = isWebGPU ? \"vertexOutputs.vFragmentDepth\" : \"vFragmentDepth\";\n const uniformP = isWebGPU ? \"uniforms.\" : \"\";\n const position = isWebGPU ? \"vertexOutputs.position\" : \"gl_Position\";\n state.compilationString += `${fragDepth} = 1.0 + ${position}.w;\\n`;\n state.compilationString += `${position}.z = log2(max(0.000001, ${fragDepth})) * ${uniformP}logarithmicDepthConstant;\\n`;\n }\n return this;\n }\n}\nRegisterClass(\"BABYLON.VertexOutputBlock\", VertexOutputBlock);","map":{"version":3,"names":["NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","VertexOutputBlock","constructor","name","Vertex","registerInput","Vector4","getClassName","vector","_inputs","_isLogarithmicDepthEnabled","nodeList","useLogarithmicDepth","node","_buildBlock","state","input","isWebGPU","shaderLanguage","compilationString","associatedVariableName","sharedData","fragmentOutputNodes","nodeMaterial","_emitUniformFromString","Float","_emitVaryingFromString","fragDepth","uniformP","position"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/Vertex/vertexOutputBlock.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 output the vertex position\n */\nexport class VertexOutputBlock extends NodeMaterialBlock {\n /**\n * Creates a new VertexOutputBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Vertex, true);\n this.registerInput(\"vector\", NodeMaterialBlockConnectionPointTypes.Vector4);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"VertexOutputBlock\";\n }\n /**\n * Gets the vector input component\n */\n get vector() {\n return this._inputs[0];\n }\n _isLogarithmicDepthEnabled(nodeList, useLogarithmicDepth) {\n if (useLogarithmicDepth) {\n return true;\n }\n for (const node of nodeList) {\n if (node.useLogarithmicDepth) {\n return true;\n }\n }\n return false;\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const input = this.vector;\n const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;\n if (state.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {\n state.compilationString += `vertexOutputs.position = ${input.associatedVariableName};\\n`;\n }\n else {\n state.compilationString += `gl_Position = ${input.associatedVariableName};\\n`;\n }\n // TODOWGSL\n if (this._isLogarithmicDepthEnabled(state.sharedData.fragmentOutputNodes, state.sharedData.nodeMaterial.useLogarithmicDepth)) {\n state._emitUniformFromString(\"logarithmicDepthConstant\", NodeMaterialBlockConnectionPointTypes.Float);\n state._emitVaryingFromString(\"vFragmentDepth\", NodeMaterialBlockConnectionPointTypes.Float);\n const fragDepth = isWebGPU ? \"vertexOutputs.vFragmentDepth\" : \"vFragmentDepth\";\n const uniformP = isWebGPU ? \"uniforms.\" : \"\";\n const position = isWebGPU ? \"vertexOutputs.position\" : \"gl_Position\";\n state.compilationString += `${fragDepth} = 1.0 + ${position}.w;\\n`;\n state.compilationString += `${position}.z = log2(max(0.000001, ${fragDepth})) * ${uniformP}logarithmicDepthConstant;\\n`;\n }\n return this;\n }\n}\nRegisterClass(\"BABYLON.VertexOutputBlock\", VertexOutputBlock);\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,iBAAiB,SAASJ,iBAAiB,CAAC;EACrD;AACJ;AACA;AACA;EACIK,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,EAAEJ,wBAAwB,CAACK,MAAM,EAAE,IAAI,CAAC;IAClD,IAAI,CAACC,aAAa,CAAC,QAAQ,EAAEP,qCAAqC,CAACQ,OAAO,CAAC;EAC/E;EACA;AACJ;AACA;AACA;EACIC,YAAYA,CAAA,EAAG;IACX,OAAO,mBAAmB;EAC9B;EACA;AACJ;A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