0c7cc32cb7f1eda65e12c48ce9cf61a0ea079dbef20cf83b70b0a5fdf78b3954.json 4.9 KB

1
  1. {"ast":null,"code":"import { VertexData } from \"../../mesh.vertexData.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\n/**\n * Block used to recompute normals for a geometry\n */\nexport class ComputeNormalsBlock extends NodeGeometryBlock {\n /**\n * Creates a new ComputeNormalsBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ComputeNormalsBlock\";\n }\n /**\n * Gets the geometry component\n */\n get geometry() {\n return this._inputs[0];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock() {\n this.output._storedFunction = state => {\n if (!this.geometry.isConnected) {\n return null;\n }\n const vertexData = this.geometry.getConnectedValue(state);\n if (!vertexData.normals) {\n vertexData.normals = [];\n }\n VertexData.ComputeNormals(vertexData.positions, vertexData.indices, vertexData.normals);\n return vertexData;\n };\n }\n}\nRegisterClass(\"BABYLON.ComputeNormalsBlock\", ComputeNormalsBlock);","map":{"version":3,"names":["VertexData","RegisterClass","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","ComputeNormalsBlock","constructor","name","registerInput","Geometry","registerOutput","getClassName","geometry","_inputs","output","_outputs","_buildBlock","_storedFunction","state","isConnected","vertexData","getConnectedValue","normals","ComputeNormals","positions","indices"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/computeNormalsBlock.js"],"sourcesContent":["import { VertexData } from \"../../mesh.vertexData.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\n/**\n * Block used to recompute normals for a geometry\n */\nexport class ComputeNormalsBlock extends NodeGeometryBlock {\n /**\n * Creates a new ComputeNormalsBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ComputeNormalsBlock\";\n }\n /**\n * Gets the geometry component\n */\n get geometry() {\n return this._inputs[0];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock() {\n this.output._storedFunction = (state) => {\n if (!this.geometry.isConnected) {\n return null;\n }\n const vertexData = this.geometry.getConnectedValue(state);\n if (!vertexData.normals) {\n vertexData.normals = [];\n }\n VertexData.ComputeNormals(vertexData.positions, vertexData.indices, vertexData.normals);\n return vertexData;\n };\n }\n}\nRegisterClass(\"BABYLON.ComputeNormalsBlock\", ComputeNormalsBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,SAASD,iBAAiB,CAAC;EACvD;AACJ;AACA;AACA;EACIE,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,CAAC;IACX,IAAI,CAACC,aAAa,CAAC,UAAU,EAAEL,qCAAqC,CAACM,QAAQ,CAAC;IAC9E,IAAI,CAACC,cAAc,CAAC,QAAQ,EAAEP,qCAAqC,CAACM,QAAQ,CAAC;EACjF;EACA;AACJ;AACA;AACA;EACIE,YAAYA,CAAA,EAAG;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