610e9ef3470c0e51f318642d46aa08ce217d35344afd816152d9774d8b29549e.json 11 KB

1
  1. {"ast":null,"code":"import { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector.js\";\n/**\n * Block used to lerp between 2 values\n */\nexport class GeometryLerpBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryLerpBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"gradient\", NodeGeometryBlockConnectionPointTypes.Float, true, 0, 0, 1);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\n this._linkConnectionTypes(0, 1);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"GeometryLerpBlock\";\n }\n /**\n * Gets the left operand input component\n */\n get left() {\n return this._inputs[0];\n }\n /**\n * Gets the right operand input component\n */\n get right() {\n return this._inputs[1];\n }\n /**\n * Gets the gradient operand input component\n */\n get gradient() {\n return this._inputs[2];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock() {\n if (!this.left.isConnected || !this.right.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (gradient, left, right) => {\n return (1 - gradient) * left + gradient * right;\n };\n this.output._storedFunction = state => {\n const left = this.left.getConnectedValue(state);\n const right = this.right.getConnectedValue(state);\n const gradient = this.gradient.getConnectedValue(state);\n switch (this.left.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float:\n {\n return func(gradient, left, right);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2:\n {\n return new Vector2(func(gradient, left.x, right.x), func(gradient, left.y, right.y));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3:\n {\n return new Vector3(func(gradient, left.x, right.x), func(gradient, left.y, right.y), func(gradient, left.z, right.z));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4:\n {\n return new Vector4(func(gradient, left.x, right.x), func(gradient, left.y, right.y), func(gradient, left.z, right.z), func(gradient, left.w, right.w));\n }\n }\n return 0;\n };\n return this;\n }\n}\nRegisterClass(\"BABYLON.GeometryLerpBlock\", GeometryLerpBlock);","map":{"version":3,"names":["RegisterClass","NodeGeometryBlock","NodeGeometryBlockConnectionPointTypes","Vector2","Vector3","Vector4","GeometryLerpBlock","constructor","name","registerInput","AutoDetect","Float","registerOutput","BasedOnInput","_outputs","_typeConnectionSource","_inputs","_linkConnectionTypes","excludedConnectionPointTypes","push","Matrix","Geometry","Texture","getClassName","left","right","gradient","output","_buildBlock","isConnected","_storedFunction","_storedValue","func","state","getConnectedValue","type","Int","x","y","z","w"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/geometryLerpBlock.js"],"sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector.js\";\n/**\n * Block used to lerp between 2 values\n */\nexport class GeometryLerpBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryLerpBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"gradient\", NodeGeometryBlockConnectionPointTypes.Float, true, 0, 0, 1);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\n this._linkConnectionTypes(0, 1);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"GeometryLerpBlock\";\n }\n /**\n * Gets the left operand input component\n */\n get left() {\n return this._inputs[0];\n }\n /**\n * Gets the right operand input component\n */\n get right() {\n return this._inputs[1];\n }\n /**\n * Gets the gradient operand input component\n */\n get gradient() {\n return this._inputs[2];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock() {\n if (!this.left.isConnected || !this.right.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (gradient, left, right) => {\n return (1 - gradient) * left + gradient * right;\n };\n this.output._storedFunction = (state) => {\n const left = this.left.getConnectedValue(state);\n const right = this.right.getConnectedValue(state);\n const gradient = this.gradient.getConnectedValue(state);\n switch (this.left.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float: {\n return func(gradient, left, right);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\n return new Vector2(func(gradient, left.x, right.x), func(gradient, left.y, right.y));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\n return new Vector3(func(gradient, left.x, right.x), func(gradient, left.y, right.y), func(gradient, left.z, right.z));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\n return new Vector4(func(gradient, left.x, right.x), func(gradient, left.y, right.y), func(gradient, left.z, right.z), func(gradient, left.w, right.w));\n }\n }\n return 0;\n };\n return this;\n }\n}\nRegisterClass(\"BABYLON.GeometryLerpBlock\", GeometryLerpBlock);\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,OAAO,EAAEC,OAAO,EAAEC,OAAO,QAAQ,+BAA+B;AACzE;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,SAASL,iBAAiB,CAAC;EACrD;AACJ;AACA;AACA;EACIM,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,CAAC;IACX,IAAI,CAACC,aAAa,CAAC,MAAM,EAAEP,qCAAqC,CAACQ,UAAU,CAAC;IAC5E,IAAI,CAACD,aAAa,CAAC,OAAO,EAAEP,qCAAqC,CAACQ,UAAU,CAAC;IAC7E,IAAI,CAACD,aAAa,CAAC,UAAU,EAAEP,qCAAqC,CAACS,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1F,IAAI,CAACC,cAAc,CAAC,QAAQ,EAAEV,qCAAqC,CAACW,YAAY,CAAC;IACjF,IAAI,CAACC,QAAQ,CAAC,CAAC,CAAC,CAACC,qBAAqB,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC,CAAC;IACxD,IAAI,CAACC,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/B,IAAI,CAACD,OAAO,CAAC,CAAC,CAAC,CAACE,4BAA4B,CAACC,IAAI,CAACjB,qCAAqC,CAACkB,MAAM,CAAC;IAC/F,IAAI,CAACJ,OAAO,CAAC,CAAC,CAAC,CAACE,4BAA4B,CAACC,IAAI,CAACjB,qCAAqC,CAACmB,QAAQ,CAAC;IACjG,IAAI,CAACL,OAAO,CAAC,CA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