d4d9df5153ddceeecf41da0742c361d74abd02b2881a06dca0554e6f5276130d.json 9.2 KB

1
  1. {"ast":null,"code":"import { __decorate } from \"../../../tslib.es6.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\nimport { editableInPropertyPage } from \"../../../Decorators/nodeDecorator.js\";\nimport { FixFlippedFaces } from \"../../../Maths/math.functions.js\";\n/**\n * Block used to clean a geometry\n */\nexport class CleanGeometryBlock extends NodeGeometryBlock {\n /**\n * Creates a new CleanGeometryBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n /**\n * Gets or sets a boolean indicating that this block can evaluate context\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\n */\n this.evaluateContext = true;\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 \"CleanGeometryBlock\";\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(state) {\n const func = state => {\n if (!this.geometry.isConnected) {\n return null;\n }\n const vertexData = this.geometry.getConnectedValue(state).clone();\n if (!vertexData.positions || !vertexData.indices || !vertexData.normals) {\n return vertexData;\n }\n const indices = vertexData.indices;\n const positions = vertexData.positions;\n FixFlippedFaces(positions, indices);\n return vertexData;\n };\n if (this.evaluateContext) {\n this.output._storedFunction = func;\n } else {\n this.output._storedFunction = null;\n this.output._storedValue = func(state);\n }\n }\n _dumpPropertiesCode() {\n return super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\n }\n /**\n * Serializes this block in a JSON representation\n * @returns the serialized block object\n */\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.evaluateContext = this.evaluateContext;\n return serializationObject;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n this.evaluateContext = serializationObject.evaluateContext;\n }\n}\n__decorate([editableInPropertyPage(\"Evaluate context\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", {\n embedded: true,\n notifiers: {\n rebuild: true\n }\n})], CleanGeometryBlock.prototype, \"evaluateContext\", void 0);\nRegisterClass(\"BABYLON.CleanGeometryBlock\", CleanGeometryBlock);","map":{"version":3,"names":["__decorate","RegisterClass","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","editableInPropertyPage","FixFlippedFaces","CleanGeometryBlock","constructor","name","evaluateContext","registerInput","Geometry","registerOutput","getClassName","geometry","_inputs","output","_outputs","_buildBlock","state","func","isConnected","vertexData","getConnectedValue","clone","positions","indices","normals","_storedFunction","_storedValue","_dumpPropertiesCode","_codeVariableName","serialize","serializationObject","_deserialize","embedded","notifiers","rebuild","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/cleanGeometryBlock.js"],"sourcesContent":["import { __decorate } from \"../../../tslib.es6.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\nimport { editableInPropertyPage } from \"../../../Decorators/nodeDecorator.js\";\nimport { FixFlippedFaces } from \"../../../Maths/math.functions.js\";\n/**\n * Block used to clean a geometry\n */\nexport class CleanGeometryBlock extends NodeGeometryBlock {\n /**\n * Creates a new CleanGeometryBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n /**\n * Gets or sets a boolean indicating that this block can evaluate context\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\n */\n this.evaluateContext = true;\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 \"CleanGeometryBlock\";\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(state) {\n const func = (state) => {\n if (!this.geometry.isConnected) {\n return null;\n }\n const vertexData = this.geometry.getConnectedValue(state).clone();\n if (!vertexData.positions || !vertexData.indices || !vertexData.normals) {\n return vertexData;\n }\n const indices = vertexData.indices;\n const positions = vertexData.positions;\n FixFlippedFaces(positions, indices);\n return vertexData;\n };\n if (this.evaluateContext) {\n this.output._storedFunction = func;\n }\n else {\n this.output._storedFunction = null;\n this.output._storedValue = func(state);\n }\n }\n _dumpPropertiesCode() {\n return super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\n }\n /**\n * Serializes this block in a JSON representation\n * @returns the serialized block object\n */\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.evaluateContext = this.evaluateContext;\n return serializationObject;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n this.evaluateContext = serializationObject.evaluateContext;\n }\n}\n__decorate([\n editableInPropertyPage(\"Evaluate context\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\n], CleanGeometryBlock.prototype, \"evaluateContext\", void 0);\nRegisterClass(\"BABYLON.CleanGeometryBlock\", CleanGeometryBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,uBAAuB;AAClD,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,sBAAsB,QAAQ,sCAAsC;AAC7E,SAASC,eAAe,QAAQ,kCAAkC;AAClE;AACA;AACA;AACA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