qd-changjing/public/static/Build/CesiumUnminified/Workers/createVerticesFromGoogleEar...

1 line
40 KiB
Plaintext
Raw Normal View History

2022-07-05 16:56:29 +08:00
{"version":3,"file":"createVerticesFromGoogleEarthEnterpriseBuffer.js","sources":["../../../../Source/WorkersES6/createVerticesFromGoogleEarthEnterpriseBuffer.js"],"sourcesContent":["import AxisAlignedBoundingBox from \"../Core/AxisAlignedBoundingBox.js\";\nimport BoundingSphere from \"../Core/BoundingSphere.js\";\nimport Cartesian2 from \"../Core/Cartesian2.js\";\nimport Cartesian3 from \"../Core/Cartesian3.js\";\nimport Cartographic from \"../Core/Cartographic.js\";\nimport defaultValue from \"../Core/defaultValue.js\";\nimport defined from \"../Core/defined.js\";\nimport Ellipsoid from \"../Core/Ellipsoid.js\";\nimport EllipsoidalOccluder from \"../Core/EllipsoidalOccluder.js\";\nimport CesiumMath from \"../Core/Math.js\";\nimport Matrix4 from \"../Core/Matrix4.js\";\nimport OrientedBoundingBox from \"../Core/OrientedBoundingBox.js\";\nimport Rectangle from \"../Core/Rectangle.js\";\nimport RuntimeError from \"../Core/RuntimeError.js\";\nimport TerrainEncoding from \"../Core/TerrainEncoding.js\";\nimport Transforms from \"../Core/Transforms.js\";\nimport WebMercatorProjection from \"../Core/WebMercatorProjection.js\";\nimport createTaskProcessorWorker from \"./createTaskProcessorWorker.js\";\n\nconst sizeOfUint16 = Uint16Array.BYTES_PER_ELEMENT;\nconst sizeOfInt32 = Int32Array.BYTES_PER_ELEMENT;\nconst sizeOfUint32 = Uint32Array.BYTES_PER_ELEMENT;\nconst sizeOfFloat = Float32Array.BYTES_PER_ELEMENT;\nconst sizeOfDouble = Float64Array.BYTES_PER_ELEMENT;\n\nfunction indexOfEpsilon(arr, elem, elemType) {\n elemType = defaultValue(elemType, CesiumMath);\n const count = arr.length;\n for (let i = 0; i < count; ++i) {\n if (elemType.equalsEpsilon(arr[i], elem, CesiumMath.EPSILON12)) {\n return i;\n }\n }\n\n return -1;\n}\n\nfunction createVerticesFromGoogleEarthEnterpriseBuffer(\n parameters,\n transferableObjects\n) {\n parameters.ellipsoid = Ellipsoid.clone(parameters.ellipsoid);\n parameters.rectangle = Rectangle.clone(parameters.rectangle);\n\n const statistics = processBuffer(\n parameters.buffer,\n parameters.relativeToCenter,\n parameters.ellipsoid,\n parameters.rectangle,\n parameters.nativeRectangle,\n parameters.exaggeration,\n parameters.exaggerationRelativeHeight,\n parameters.skirtHeight,\n parameters.includeWebMercatorT,\n parameters.negativeAltitudeExponentBias,\n parameters.negativeElevationThreshold\n );\n const vertices = statistics.vertices;\n transferableObjects.push(vertices.buffer);\n const indices = statistics.indices;\n transferableObjects.push(indices.buffer);\n\n return {\n vertices: vertices.buffer,\n indices: indices.buffer,\n numberOfAttributes: statistics.encoding.stride,\n minimumHeight: statistics.minimumHeight,\n maximumHeight: statistics.maximumHeight,\n boundingSphere3D: statistics.boundingSphere3D,\n orientedBoundingBox: statistics.orientedBoundingBox,\n occludeePointInScaledSpace: statistics.occludeePointInScaledSpace,\n encoding: statistics.encoding,\n vertexCountWithoutSkirts: statistics.vertexCountWithoutSkirts,\n indexCountWithoutSkirts: statistics.indexCountWithoutSkirts,\n westIndicesSouthToNorth: statistics.westIndicesSouthToNorth,\n southIndicesEastToWest: statistics.southIndicesEastToWest,\n eastIndicesNorthToSouth: statistics.eastIndicesNorthToSouth,\n northIndicesWestToEast: statistics.northIndicesWestToEast,\n };\n}\n\nconst scratchCartographic = new Cartographic();\nconst scratchCartesian = new Cartesian3();\nconst minimumScratch = new Cartesian3();\nconst maximumScratch = new Cartesian3();\nconst matrix4Scratch = new Matrix4();\n\nfunction processBuffer(\n buffer,\n relativeToCenter,\n ellipsoid,\n rectangle,\n nativeRectangle,\n exaggeration,\n exaggerationRelativeHeight,\n skirtHeight,\n includeWebMercatorT,\n negativeAltitudeExponentBias,\n negativeElevationThreshold\n) {\n let geographicWest;\n let geographicSouth;\n let geographicEast;\n let geographicNorth;\n let rectangleWidth, rectangleHeight;\n\n if (!defined(rectangle)) {\n geographicWest