1 line
28 KiB
Plaintext
1 line
28 KiB
Plaintext
|
{"version":3,"file":"createVectorTileGeometries.js","sources":["../../../../Source/Scene/Vector3DTileBatch.js","../../../../Source/WorkersES6/createVectorTileGeometries.js"],"sourcesContent":["/**\n * Describes a renderable batch of geometry.\n *\n * @alias Vector3DTileBatch\n * @constructor\n *\n * @param {Object} options An object with the following properties:\n * @param {Number} options.offset The offset of the batch into the indices buffer.\n * @param {Number} options.count The number of indices in the batch.\n * @param {Color} options.color The color of the geometry in the batch.\n * @param {Number[]} options.batchIds An array where each element is the batch id of the geometry in the batch.\n *\n * @private\n */\nfunction Vector3DTileBatch(options) {\n /**\n * The offset of the batch into the indices buffer.\n * @type {Number}\n */\n this.offset = options.offset;\n /**\n * The number of indices in the batch.\n * @type {Number}\n */\n this.count = options.count;\n /**\n * The color of the geometry in the batch.\n * @type {Color}\n */\n this.color = options.color;\n /**\n * An array where each element is the batch id of the geometry in the batch.\n * @type {Number[]}\n */\n this.batchIds = options.batchIds;\n}\nexport default Vector3DTileBatch;\n","import BoundingSphere from \"../Core/BoundingSphere.js\";\nimport BoxGeometry from \"../Core/BoxGeometry.js\";\nimport Cartesian3 from \"../Core/Cartesian3.js\";\nimport Color from \"../Core/Color.js\";\nimport CylinderGeometry from \"../Core/CylinderGeometry.js\";\nimport defined from \"../Core/defined.js\";\nimport EllipsoidGeometry from \"../Core/EllipsoidGeometry.js\";\nimport IndexDatatype from \"../Core/IndexDatatype.js\";\nimport Matrix4 from \"../Core/Matrix4.js\";\nimport Vector3DTileBatch from \"../Scene/Vector3DTileBatch.js\";\nimport createTaskProcessorWorker from \"./createTaskProcessorWorker.js\";\n\nconst scratchCartesian = new Cartesian3();\n\nconst packedBoxLength = Matrix4.packedLength + Cartesian3.packedLength;\nconst packedCylinderLength = Matrix4.packedLength + 2;\nconst packedEllipsoidLength = Matrix4.packedLength + Cartesian3.packedLength;\nconst packedSphereLength = Cartesian3.packedLength + 1;\n\nconst scratchModelMatrixAndBV = {\n modelMatrix: new Matrix4(),\n boundingVolume: new BoundingSphere(),\n};\n\nfunction boxModelMatrixAndBoundingVolume(boxes, index) {\n let boxIndex = index * packedBoxLength;\n\n const dimensions = Cartesian3.unpack(boxes, boxIndex, scratchCartesian);\n boxIndex += Cartesian3.packedLength;\n\n const boxModelMatrix = Matrix4.unpack(\n boxes,\n boxIndex,\n scratchModelMatrixAndBV.modelMatrix\n );\n Matrix4.multiplyByScale(boxModelMatrix, dimensions, boxModelMatrix);\n\n const boundingVolume = scratchModelMatrixAndBV.boundingVolume;\n Cartesian3.clone(Cartesian3.ZERO, boundingVolume.center);\n boundingVolume.radius = Math.sqrt(3.0);\n\n return scratchModelMatrixAndBV;\n}\n\nfunction cylinderModelMatrixAndBoundingVolume(cylinders, index) {\n let cylinderIndex = index * packedCylinderLength;\n\n const cylinderRadius = cylinders[cylinderIndex++];\n const length = cylinders[cylinderIndex++];\n const scale = Cartesian3.fromElements(\n cylinderRadius,\n cylinderRadius,\n length,\n scratchCartesian\n );\n\n const cylinderModelMatrix = Matrix4.unpack(\n cylinders,\n cylinderIndex,\n scratchModelMatrixAndBV.modelMatrix\n );\n Matrix4.multiplyByScale(cylinderModelMatrix, scale, cylinderModelMatrix);\n\n const boundingVolume = scratchModelMatrixAndBV.boundingVolume;\n Cartesian3.clone(Cartesian3.ZERO, boundingVolume.center);\n boundingVolume.radius = Math.sqrt(2.0);\n\n return scratchModelMatrixAndBV;\n}\n\nfunction ellipsoidModelMatrixAndBoundingVolume(ellipsoids, index) {\n let ellipsoidIndex = index * packedEllipsoidLength;\n\n const radii = Cartesian3.unpack(ellipsoids, ellipsoidIndex, scratchCartesian);\n ellipsoidIndex += Cartesian3.packedLength;\n\n const ellipsoidModelMatrix = Matrix4.unpack(\n ellipsoids,\n ellipsoidIndex,\n scr
|