0ba87b7e41b15a5dac93ed19596077af5d55424ab8dcfb9ab17c2cb174766895.json 11 KB

1
  1. {"ast":null,"code":"import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { VertexDataMaterialInfo } from \"../../../../Meshes/mesh.vertexData.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\n/**\n * Block used to affect a material ID to a geometry\n */\nexport class SetMaterialIDBlock extends NodeGeometryBlock {\n /**\n * Create a new SetMaterialIDBlock\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.registerInput(\"id\", NodeGeometryBlockConnectionPointTypes.Int, true, 0);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\n this.id.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"SetMaterialIDBlock\";\n }\n /**\n * Gets the geometry input component\n */\n get geometry() {\n return this._inputs[0];\n }\n /**\n * Gets the id input component\n */\n get id() {\n return this._inputs[1];\n }\n /**\n * Gets the geometry output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n if (!this.geometry.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = state => {\n const vertexData = this.geometry.getConnectedValue(state);\n if (!vertexData || !vertexData.indices || !vertexData.positions) {\n return vertexData;\n }\n const materialInfo = new VertexDataMaterialInfo();\n materialInfo.materialIndex = this.id.getConnectedValue(state) | 0;\n materialInfo.indexStart = 0;\n materialInfo.indexCount = vertexData.indices.length;\n materialInfo.verticesStart = 0;\n materialInfo.verticesCount = vertexData.positions.length / 3;\n vertexData.materialInfos = [materialInfo];\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 const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\n return codeString;\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 if (serializationObject.evaluateContext !== undefined) {\n this.evaluateContext = serializationObject.evaluateContext;\n }\n }\n}\n__decorate([editableInPropertyPage(\"Evaluate context\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", {\n embedded: true,\n notifiers: {\n rebuild: true\n }\n})], SetMaterialIDBlock.prototype, \"evaluateContext\", void 0);\nRegisterClass(\"BABYLON.SetMaterialIDBlock\", SetMaterialIDBlock);","map":{"version":3,"names":["__decorate","NodeGeometryBlock","RegisterClass","NodeGeometryBlockConnectionPointTypes","VertexDataMaterialInfo","editableInPropertyPage","SetMaterialIDBlock","constructor","name","evaluateContext","registerInput","Geometry","Int","registerOutput","id","acceptedConnectionPointTypes","push","Float","getClassName","geometry","_inputs","output","_outputs","_buildBlock","state","isConnected","_storedFunction","_storedValue","func","vertexData","getConnectedValue","indices","positions","materialInfo","materialIndex","indexStart","indexCount","length","verticesStart","verticesCount","materialInfos","_dumpPropertiesCode","codeString","_codeVariableName","serialize","serializationObject","_deserialize","undefined","embedded","notifiers","rebuild","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/Set/setMaterialIDBlock.js"],"sourcesContent":["import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { VertexDataMaterialInfo } from \"../../../../Meshes/mesh.vertexData.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\n/**\n * Block used to affect a material ID to a geometry\n */\nexport class SetMaterialIDBlock extends NodeGeometryBlock {\n /**\n * Create a new SetMaterialIDBlock\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.registerInput(\"id\", NodeGeometryBlockConnectionPointTypes.Int, true, 0);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\n this.id.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"SetMaterialIDBlock\";\n }\n /**\n * Gets the geometry input component\n */\n get geometry() {\n return this._inputs[0];\n }\n /**\n * Gets the id input component\n */\n get id() {\n return this._inputs[1];\n }\n /**\n * Gets the geometry output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n if (!this.geometry.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (state) => {\n const vertexData = this.geometry.getConnectedValue(state);\n if (!vertexData || !vertexData.indices || !vertexData.positions) {\n return vertexData;\n }\n const materialInfo = new VertexDataMaterialInfo();\n materialInfo.materialIndex = this.id.getConnectedValue(state) | 0;\n materialInfo.indexStart = 0;\n materialInfo.indexCount = vertexData.indices.length;\n materialInfo.verticesStart = 0;\n materialInfo.verticesCount = vertexData.positions.length / 3;\n vertexData.materialInfos = [materialInfo];\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 const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\n return codeString;\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 if (serializationObject.evaluateContext !== undefined) {\n this.evaluateContext = serializationObject.evaluateContext;\n }\n }\n}\n__decorate([\n editableInPropertyPage(\"Evaluate context\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\n], SetMaterialIDBlock.prototype, \"evaluateContext\", void 0);\nRegisterClass(\"BABYLON.SetMaterialIDBlock\", SetMaterialIDBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,qCAAqC,QAAQ,iDAAiD;AACvG,SAASC,sBAAsB,QAAQ,uCAAuC;AAC9E,SAASC,sBAAsB,QAAQ,yCAAyC;AAChF;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,SAASL,iBAAiB,CAAC;EACtD;AACJ;AACA;AACA;EACIM,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,CAAC;IACX;AACR;AACA;AACA;IACQ,IAAI,CAACC,eAAe,GAAG,IAAI;IAC3B,IAAI,CAACC,aAAa,CAAC,UAAU,EAAEP,qCAAqC,CAACQ,QAAQ,CAAC;IAC9E,IAAI,CAACD,aAAa,CAAC,IAAI,EAAEP,qCAAqC,CAACS,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5E,IAAI,CAAC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