a40f597e68474aa06854ea99d937910cfadd1c7001ea3262bfca9edd86842195.json 14 KB

1
  1. {"ast":null,"code":"import { Logger } from \"../../Misc/logger.js\";\n/**\n * Class used to store shared data between 2 NodeMaterialBuildState\n */\nexport class NodeMaterialBuildStateSharedData {\n /** Creates a new shared data */\n constructor() {\n /**\n * Gets the list of emitted varyings\n */\n this.temps = [];\n /**\n * Gets the list of emitted varyings\n */\n this.varyings = [];\n /**\n * Gets the varying declaration string\n */\n this.varyingDeclaration = \"\";\n /**\n * Input blocks\n */\n this.inputBlocks = [];\n /**\n * Input blocks\n */\n this.textureBlocks = [];\n /**\n * Bindable blocks (Blocks that need to set data to the effect)\n */\n this.bindableBlocks = [];\n /**\n * Bindable blocks (Blocks that need to set data to the effect) that will always be called (by bindForSubMesh), contrary to bindableBlocks that won't be called if _mustRebind() returns false\n */\n this.forcedBindableBlocks = [];\n /**\n * List of blocks that can provide a compilation fallback\n */\n this.blocksWithFallbacks = [];\n /**\n * List of blocks that can provide a define update\n */\n this.blocksWithDefines = [];\n /**\n * List of blocks that can provide a repeatable content\n */\n this.repeatableContentBlocks = [];\n /**\n * List of blocks that can provide a dynamic list of uniforms\n */\n this.dynamicUniformBlocks = [];\n /**\n * List of blocks that can block the isReady function for the material\n */\n this.blockingBlocks = [];\n /**\n * Gets the list of animated inputs\n */\n this.animatedInputs = [];\n /** List of emitted variables */\n this.variableNames = {};\n /** List of emitted defines */\n this.defineNames = {};\n /**\n * Gets the compilation hints emitted at compilation time\n */\n this.hints = {\n needWorldViewMatrix: false,\n needWorldViewProjectionMatrix: false,\n needAlphaBlending: false,\n needAlphaTesting: false\n };\n /**\n * List of compilation checks\n */\n this.checks = {\n emitVertex: false,\n emitFragment: false,\n notConnectedNonOptionalInputs: new Array()\n };\n /**\n * Is vertex program allowed to be empty?\n */\n this.allowEmptyVertexProgram = false;\n // Exclude usual attributes from free variable names\n this.variableNames[\"position\"] = 0;\n this.variableNames[\"normal\"] = 0;\n this.variableNames[\"tangent\"] = 0;\n this.variableNames[\"uv\"] = 0;\n this.variableNames[\"uv2\"] = 0;\n this.variableNames[\"uv3\"] = 0;\n this.variableNames[\"uv4\"] = 0;\n this.variableNames[\"uv5\"] = 0;\n this.variableNames[\"uv6\"] = 0;\n this.variableNames[\"color\"] = 0;\n this.variableNames[\"matricesIndices\"] = 0;\n this.variableNames[\"matricesWeights\"] = 0;\n this.variableNames[\"matricesIndicesExtra\"] = 0;\n this.variableNames[\"matricesWeightsExtra\"] = 0;\n this.variableNames[\"diffuseBase\"] = 0;\n this.variableNames[\"specularBase\"] = 0;\n this.variableNames[\"worldPos\"] = 0;\n this.variableNames[\"shadow\"] = 0;\n this.variableNames[\"view\"] = 0;\n // Exclude known varyings\n this.variableNames[\"vTBN\"] = 0;\n // Exclude defines\n this.defineNames[\"MAINUV0\"] = 0;\n this.defineNames[\"MAINUV1\"] = 0;\n this.defineNames[\"MAINUV2\"] = 0;\n this.defineNames[\"MAINUV3\"] = 0;\n this.defineNames[\"MAINUV4\"] = 0;\n this.defineNames[\"MAINUV5\"] = 0;\n this.defineNames[\"MAINUV6\"] = 0;\n this.defineNames[\"MAINUV7\"] = 0;\n }\n /**\n * Emits console errors and exceptions if there is a failing check\n * @param errorObservable defines an Observable to send the error message\n * @returns true if all checks pass\n */\n emitErrors(errorObservable = null) {\n let errorMessage = \"\";\n if (!this.checks.emitVertex && !this.allowEmptyVertexProgram) {\n errorMessage += \"NodeMaterial does not have a vertex output. You need to at least add a block that generates a position value.\\n\";\n }\n if (!this.checks.emitFragment) {\n errorMessage += \"NodeMaterial does not have a fragment output. You need to at least add a block that generates a color value.\\n\";\n }\n for (const notConnectedInput of this.checks.notConnectedNonOptionalInputs) {\n errorMessage += `input ${notConnectedInput.name} from block ${notConnectedInput.ownerBlock.name}[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\n }\n if (errorMessage) {\n if (errorObservable) {\n errorObservable.notifyObservers(errorMessage);\n }\n Logger.Error(\"Build of NodeMaterial failed:\\n\" + errorMessage);\n return false;\n }\n return true;\n }\n}","map":{"version":3,"names":["Logger","NodeMaterialBuildStateSharedData","constructor","temps","varyings","varyingDeclaration","inputBlocks","textureBlocks","bindableBlocks","forcedBindableBlocks","blocksWithFallbacks","blocksWithDefines","repeatableContentBlocks","dynamicUniformBlocks","blockingBlocks","animatedInputs","variableNames","defineNames","hints","needWorldViewMatrix","needWorldViewProjectionMatrix","needAlphaBlending","needAlphaTesting","checks","emitVertex","emitFragment","notConnectedNonOptionalInputs","Array","allowEmptyVertexProgram","emitErrors","errorObservable","errorMessage","notConnectedInput","name","ownerBlock","getClassName","notifyObservers","Error"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/nodeMaterialBuildStateSharedData.js"],"sourcesContent":["import { Logger } from \"../../Misc/logger.js\";\n/**\n * Class used to store shared data between 2 NodeMaterialBuildState\n */\nexport class NodeMaterialBuildStateSharedData {\n /** Creates a new shared data */\n constructor() {\n /**\n * Gets the list of emitted varyings\n */\n this.temps = [];\n /**\n * Gets the list of emitted varyings\n */\n this.varyings = [];\n /**\n * Gets the varying declaration string\n */\n this.varyingDeclaration = \"\";\n /**\n * Input blocks\n */\n this.inputBlocks = [];\n /**\n * Input blocks\n */\n this.textureBlocks = [];\n /**\n * Bindable blocks (Blocks that need to set data to the effect)\n */\n this.bindableBlocks = [];\n /**\n * Bindable blocks (Blocks that need to set data to the effect) that will always be called (by bindForSubMesh), contrary to bindableBlocks that won't be called if _mustRebind() returns false\n */\n this.forcedBindableBlocks = [];\n /**\n * List of blocks that can provide a compilation fallback\n */\n this.blocksWithFallbacks = [];\n /**\n * List of blocks that can provide a define update\n */\n this.blocksWithDefines = [];\n /**\n * List of blocks that can provide a repeatable content\n */\n this.repeatableContentBlocks = [];\n /**\n * List of blocks that can provide a dynamic list of uniforms\n */\n this.dynamicUniformBlocks = [];\n /**\n * List of blocks that can block the isReady function for the material\n */\n this.blockingBlocks = [];\n /**\n * Gets the list of animated inputs\n */\n this.animatedInputs = [];\n /** List of emitted variables */\n this.variableNames = {};\n /** List of emitted defines */\n this.defineNames = {};\n /**\n * Gets the compilation hints emitted at compilation time\n */\n this.hints = {\n needWorldViewMatrix: false,\n needWorldViewProjectionMatrix: false,\n needAlphaBlending: false,\n needAlphaTesting: false,\n };\n /**\n * List of compilation checks\n */\n this.checks = {\n emitVertex: false,\n emitFragment: false,\n notConnectedNonOptionalInputs: new Array(),\n };\n /**\n * Is vertex program allowed to be empty?\n */\n this.allowEmptyVertexProgram = false;\n // Exclude usual attributes from free variable names\n this.variableNames[\"position\"] = 0;\n this.variableNames[\"normal\"] = 0;\n this.variableNames[\"tangent\"] = 0;\n this.variableNames[\"uv\"] = 0;\n this.variableNames[\"uv2\"] = 0;\n this.variableNames[\"uv3\"] = 0;\n this.variableNames[\"uv4\"] = 0;\n this.variableNames[\"uv5\"] = 0;\n this.variableNames[\"uv6\"] = 0;\n this.variableNames[\"color\"] = 0;\n this.variableNames[\"matricesIndices\"] = 0;\n this.variableNames[\"matricesWeights\"] = 0;\n this.variableNames[\"matricesIndicesExtra\"] = 0;\n this.variableNames[\"matricesWeightsExtra\"] = 0;\n this.variableNames[\"diffuseBase\"] = 0;\n this.variableNames[\"specularBase\"] = 0;\n this.variableNames[\"worldPos\"] = 0;\n this.variableNames[\"shadow\"] = 0;\n this.variableNames[\"view\"] = 0;\n // Exclude known varyings\n this.variableNames[\"vTBN\"] = 0;\n // Exclude defines\n this.defineNames[\"MAINUV0\"] = 0;\n this.defineNames[\"MAINUV1\"] = 0;\n this.defineNames[\"MAINUV2\"] = 0;\n this.defineNames[\"MAINUV3\"] = 0;\n this.defineNames[\"MAINUV4\"] = 0;\n this.defineNames[\"MAINUV5\"] = 0;\n this.defineNames[\"MAINUV6\"] = 0;\n this.defineNames[\"MAINUV7\"] = 0;\n }\n /**\n * Emits console errors and exceptions if there is a failing check\n * @param errorObservable defines an Observable to send the error message\n * @returns true if all checks pass\n */\n emitErrors(errorObservable = null) {\n let errorMessage = \"\";\n if (!this.checks.emitVertex && !this.allowEmptyVertexProgram) {\n errorMessage += \"NodeMaterial does not have a vertex output. You need to at least add a block that generates a position value.\\n\";\n }\n if (!this.checks.emitFragment) {\n errorMessage += \"NodeMaterial does not have a fragment output. You need to at least add a block that generates a color value.\\n\";\n }\n for (const notConnectedInput of this.checks.notConnectedNonOptionalInputs) {\n errorMessage += `input ${notConnectedInput.name} from block ${notConnectedInput.ownerBlock.name}[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\n }\n if (errorMessage) {\n if (errorObservable) {\n errorObservable.notifyObservers(errorMessage);\n }\n Logger.Error(\"Build of NodeMaterial failed:\\n\" + errorMessage);\n return false;\n }\n return true;\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,sBAAsB;AAC7C;AACA;AACA;AACA,OAAO,MAAMC,gCAAgC,CAAC;EAC1C;EACAC,WAAWA,CAAA,EAAG;IACV;AACR;AACA;IACQ,IAAI,CAACC,KAAK,GAAG,EAAE;IACf;AACR;AACA;IACQ,IAAI,CAACC,QAAQ,GAAG,EAAE;IAClB;AACR;AACA;IACQ,IAAI,CAACC,kBAAkB,GAAG,EAAE;IAC5B;AACR;AACA;IACQ,IAAI,CAACC,WAAW,GAAG,EAAE;IACrB;AACR;AACA;IACQ,IAAI,CAACC,aAAa,GAAG,EAAE;IACvB;AACR;AACA;IACQ,IAAI,CAACC,cAAc,GAAG,EAAE;IACxB;AACR;AACA;IACQ,IAAI,CAACC,oBAAoB,GAAG,EAAE;IAC9B;AACR;AACA;IACQ,IAAI,CAACC,mBAAmB,GAAG,EAAE;IAC7B;AACR;AACA;IACQ,IAAI,CAACC,iBAAiB,GAAG,EAAE;IAC3B;AACR;AACA;IACQ,IAAI,CAACC,uBAAuB,GAAG,EAAE;IACjC;AACR;AACA;IACQ,IAAI,CAACC,oBAAoB,GAAG,EAAE;IAC9B;AACR;AACA;IACQ,IAAI,CAACC,cAAc,GAAG,EAAE;IACxB;A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