e985d0ca4e3939dd55e1a65744f76d796e02f386317ea4eb724794036747d965.json 12 KB

1
  1. {"ast":null,"code":"import { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets.js\";\nimport { NodeMaterialBlock } from \"../../nodeMaterialBlock.js\";\n/**\n * Defines a block used to teleport a value to an endpoint\n */\nexport class NodeMaterialTeleportInBlock extends NodeMaterialBlock {\n /** Gets the list of attached endpoints */\n get endpoints() {\n return this._endpoints;\n }\n /**\n * Gets or sets the target of the block\n */\n get target() {\n const input = this._inputs[0];\n if (input.isConnected) {\n const block = input.connectedPoint.ownerBlock;\n if (block.target !== NodeMaterialBlockTargets.VertexAndFragment) {\n return block.target;\n }\n if (input.connectedPoint.target !== NodeMaterialBlockTargets.VertexAndFragment) {\n return input.connectedPoint.target;\n }\n }\n return this._target;\n }\n set target(value) {\n if ((this._target & value) !== 0) {\n return;\n }\n this._target = value;\n }\n /**\n * Create a new NodeMaterialTeleportInBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this._endpoints = [];\n this.registerInput(\"input\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"NodeMaterialTeleportInBlock\";\n }\n /**\n * Gets the input component\n */\n get input() {\n return this._inputs[0];\n }\n /**\n * @returns a boolean indicating that this connection will be used in the fragment shader\n */\n isConnectedInFragmentShader() {\n return this.endpoints.some(e => e.output.isConnectedInFragmentShader);\n }\n _dumpCode(uniqueNames, alreadyDumped) {\n let codeString = super._dumpCode(uniqueNames, alreadyDumped);\n for (const endpoint of this.endpoints) {\n if (alreadyDumped.indexOf(endpoint) === -1) {\n codeString += endpoint._dumpCode(uniqueNames, alreadyDumped);\n }\n }\n return codeString;\n }\n /**\n * Checks if the current block is an ancestor of a given block\n * @param block defines the potential descendant block to check\n * @returns true if block is a descendant\n */\n isAnAncestorOf(block) {\n for (const endpoint of this.endpoints) {\n if (endpoint === block) {\n return true;\n }\n if (endpoint.isAnAncestorOf(block)) {\n return true;\n }\n }\n return false;\n }\n /**\n * Add an enpoint to this block\n * @param endpoint define the endpoint to attach to\n */\n attachToEndpoint(endpoint) {\n endpoint.detach();\n this._endpoints.push(endpoint);\n endpoint._entryPoint = this;\n endpoint._outputs[0]._typeConnectionSource = this._inputs[0];\n endpoint._tempEntryPointUniqueId = null;\n endpoint.name = \"> \" + this.name;\n this._outputs = this._endpoints.map(e => e.output);\n }\n /**\n * Remove enpoint from this block\n * @param endpoint define the endpoint to remove\n */\n detachFromEndpoint(endpoint) {\n const index = this._endpoints.indexOf(endpoint);\n if (index !== -1) {\n this._endpoints.splice(index, 1);\n endpoint._outputs[0]._typeConnectionSource = null;\n endpoint._entryPoint = null;\n this._outputs = this._endpoints.map(e => e.output);\n }\n }\n /**\n * Release resources\n */\n dispose() {\n super.dispose();\n for (const endpoint of this._endpoints) {\n this.detachFromEndpoint(endpoint);\n }\n this._endpoints = [];\n }\n}\nRegisterClass(\"BABYLON.NodeMaterialTeleportInBlock\", NodeMaterialTeleportInBlock);","map":{"version":3,"names":["RegisterClass","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","NodeMaterialBlock","NodeMaterialTeleportInBlock","endpoints","_endpoints","target","input","_inputs","isConnected","block","connectedPoint","ownerBlock","VertexAndFragment","_target","value","constructor","name","Neutral","registerInput","AutoDetect","getClassName","isConnectedInFragmentShader","some","e","output","_dumpCode","uniqueNames","alreadyDumped","codeString","endpoint","indexOf","isAnAncestorOf","attachToEndpoint","detach","push","_entryPoint","_outputs","_typeConnectionSource","_tempEntryPointUniqueId","map","detachFromEndpoint","index","splice","dispose"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/Teleport/teleportInBlock.js"],"sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets.js\";\nimport { NodeMaterialBlock } from \"../../nodeMaterialBlock.js\";\n/**\n * Defines a block used to teleport a value to an endpoint\n */\nexport class NodeMaterialTeleportInBlock extends NodeMaterialBlock {\n /** Gets the list of attached endpoints */\n get endpoints() {\n return this._endpoints;\n }\n /**\n * Gets or sets the target of the block\n */\n get target() {\n const input = this._inputs[0];\n if (input.isConnected) {\n const block = input.connectedPoint.ownerBlock;\n if (block.target !== NodeMaterialBlockTargets.VertexAndFragment) {\n return block.target;\n }\n if (input.connectedPoint.target !== NodeMaterialBlockTargets.VertexAndFragment) {\n return input.connectedPoint.target;\n }\n }\n return this._target;\n }\n set target(value) {\n if ((this._target & value) !== 0) {\n return;\n }\n this._target = value;\n }\n /**\n * Create a new NodeMaterialTeleportInBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this._endpoints = [];\n this.registerInput(\"input\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"NodeMaterialTeleportInBlock\";\n }\n /**\n * Gets the input component\n */\n get input() {\n return this._inputs[0];\n }\n /**\n * @returns a boolean indicating that this connection will be used in the fragment shader\n */\n isConnectedInFragmentShader() {\n return this.endpoints.some((e) => e.output.isConnectedInFragmentShader);\n }\n _dumpCode(uniqueNames, alreadyDumped) {\n let codeString = super._dumpCode(uniqueNames, alreadyDumped);\n for (const endpoint of this.endpoints) {\n if (alreadyDumped.indexOf(endpoint) === -1) {\n codeString += endpoint._dumpCode(uniqueNames, alreadyDumped);\n }\n }\n return codeString;\n }\n /**\n * Checks if the current block is an ancestor of a given block\n * @param block defines the potential descendant block to check\n * @returns true if block is a descendant\n */\n isAnAncestorOf(block) {\n for (const endpoint of this.endpoints) {\n if (endpoint === block) {\n return true;\n }\n if (endpoint.isAnAncestorOf(block)) {\n return true;\n }\n }\n return false;\n }\n /**\n * Add an enpoint to this block\n * @param endpoint define the endpoint to attach to\n */\n attachToEndpoint(endpoint) {\n endpoint.detach();\n this._endpoints.push(endpoint);\n endpoint._entryPoint = this;\n endpoint._outputs[0]._typeConnectionSource = this._inputs[0];\n endpoint._tempEntryPointUniqueId = null;\n endpoint.name = \"> \" + this.name;\n this._outputs = this._endpoints.map((e) => e.output);\n }\n /**\n * Remove enpoint from this block\n * @param endpoint define the endpoint to remove\n */\n detachFromEndpoint(endpoint) {\n const index = this._endpoints.indexOf(endpoint);\n if (index !== -1) {\n this._endpoints.splice(index, 1);\n endpoint._outputs[0]._typeConnectionSource = null;\n endpoint._entryPoint = null;\n this._outputs = this._endpoints.map((e) => e.output);\n }\n }\n /**\n * Release resources\n */\n dispose() {\n super.dispose();\n for (const endpoint of this._endpoints) {\n this.detachFromEndpoint(endpoint);\n }\n this._endpoints = [];\n }\n}\nRegisterClass(\"BABYLON.NodeMaterialTeleportInBlock\", NodeMaterialTeleportInBlock);\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,qCAAqC,QAAQ,sDAAsD;AAC5G,SAASC,wBAAwB,QAAQ,yCAAyC;AAClF,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,SAASD,iBAAiB,CAAC;EAC/D;EACA,IAAIE,SAASA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACC,UAAU;EAC1B;EACA;AACJ;AACA;EACI,IAAIC,MAAMA,CAAA,EAAG;IACT,MAAMC,KAAK,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC,CAAC;IAC7B,IAAID,KAAK,CAACE,WAAW,EAAE;MACnB,MAAMC,KAAK,GAAGH,KAAK,CAACI,cAAc,CAACC,UAAU;MAC7C,IAAIF,KAAK,CAACJ,M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