{ "version": 3, "sources": ["index.js", "lib/parse-quantized-mesh.js", "lib/decode-quantized-mesh.js", "lib/helpers/skirt.js", "lib/parse-terrain.js", "lib/delatin/index.js", "lib/utils/version.js", "terrain-loader.js", "quantized-mesh-loader.js"], "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { parseFromContext } from '@loaders.gl/loader-utils';\nimport { parseQuantizedMesh } from \"./lib/parse-quantized-mesh.js\";\nimport { makeTerrainMeshFromImage } from \"./lib/parse-terrain.js\";\nimport { TerrainLoader as TerrainWorkerLoader } from \"./terrain-loader.js\";\nimport { QuantizedMeshLoader as QuantizedMeshWorkerLoader } from \"./quantized-mesh-loader.js\";\n// TerrainLoader\nexport { TerrainWorkerLoader };\nexport const TerrainLoader = {\n ...TerrainWorkerLoader,\n parse: parseTerrain\n};\nexport async function parseTerrain(arrayBuffer, options, context) {\n const loadImageOptions = {\n ...options,\n mimeType: 'application/x.image',\n image: { ...options?.image, type: 'data' }\n };\n const image = await parseFromContext(arrayBuffer, [], loadImageOptions, context);\n // Extend function to support additional mesh generation options (square grid or delatin)\n const terrainOptions = { ...TerrainLoader.options.terrain, ...options?.terrain };\n // @ts-expect-error sort out image typing asap\n return makeTerrainMeshFromImage(image, terrainOptions);\n}\n// QuantizedMeshLoader\nexport { QuantizedMeshWorkerLoader };\n/**\n * Loader for quantized meshes\n */\nexport const QuantizedMeshLoader = {\n ...QuantizedMeshWorkerLoader,\n parseSync: (arrayBuffer, options) => parseQuantizedMesh(arrayBuffer, options?.['quantized-mesh']),\n parse: async (arrayBuffer, options) => parseQuantizedMesh(arrayBuffer, options?.['quantized-mesh'])\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getMeshBoundingBox } from '@loaders.gl/schema';\nimport decode, { DECODING_STEPS } from \"./decode-quantized-mesh.js\";\nimport { addSkirt } from \"./helpers/skirt.js\";\nexport function parseQuantizedMesh(arrayBuffer, options = {}) {\n const { bounds } = options;\n // Don't parse edge indices or format extensions\n const { header, vertexData, triangleIndices: originalTriangleIndices, westIndices, northIndices, eastIndices, southIndices } = decode(arrayBuffer, DECODING_STEPS.triangleIndices);\n let triangleIndices = originalTriangleIndices;\n let attributes = getMeshAttributes(vertexData, header, bounds);\n // Compute bounding box before adding skirt so that z values are not skewed\n // TODO: Find bounding box from header, instead of doing extra pass over\n // vertices.\n const boundingBox = getMeshBoundingBox(attributes);\n if (options?.skirtHeight) {\n const { attributes: newAttributes, triangles: newTriangles } = addSkirt(attributes, triangleIndices, options.skirtHeight, {\n westIndices,\n northIndices,\n eastIndices,\n southIndices\n });\n attributes = newAttributes;\n triangleIndices = newTriangles;\n }\n return {\n // Data return by this loader implementation\n loaderData: {\n header: {}\n },\n header: {\n // @ts-ignore\n vertexCount: triangleIndices.length,\n boundingBox\n },\n // TODO\n schema: undefined,\n topology: 'triangle-list',\n mode: 4, // TRIANGLES\n indices: { value: triangleIndices, size: 1 },\n attributes\n };\n}\nfunction getMeshAttributes(vertexData, header, bounds) {\n const { minHeight, maxHeight } = header;\n const [minX, minY, maxX, maxY] = bounds || [0, 0, 1, 1];\n const xScale = maxX - minX;\n const yScale = maxY - minY;\n const zScale = maxHeight - minHeight;\n const nCoords = vertexData.length / 3;\n // vec3. x, y defined by bounds, z in meters\n const positions = new Float32Array(nCoords * 3);\n // vec2. 1 to 1 relationship with position. represents the uv on the texture image. 0,0 to 1,1.\n const texCoords = new Float32Array(nCoords * 2);\n // Data is not interleaved; all u, then all v, then all heights\n for (let i = 0; i < nCoords; i++) {\n const x = vertexData[i] / 32767;\n const y = vertexData[i + nCoords] / 32767;\n const z = vertexData[i + nCoords * 2] / 32767;\n positions[3 * i + 0] = x * xScale + minX;\n positions[3 * i + 1] = y * yScale + minY;\n positions[3 * i + 2] = z * zScale + minHeight;\n texCoords[2 * i + 0] = x;\n texCoords[2 * i + 1] = y;\n }\n return {\n POSITION: { value: positions, size: 3 },\n TEXCOORD_0: { value: texCoords, size: 2 }\n // TODO: Parse normals if they exist in the file\n // NORMAL: {}, - optional, but creates the high poly look with lighting\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Copyright (C) 2018-2019 HERE Europe B.V.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\nconst QUANTIZED_MESH_HEADER = new Map([\n ['centerX', Float64Array.BYTES_PER_ELEMENT],\n ['centerY', Float64Array.BYTES_PER_ELEMENT],\n ['centerZ', Float64Array.BYTES_PER_ELEMENT],\n ['minHeight', Float32Array.BYTES_PER_ELEMENT],\n ['maxHeight', Float32Array.BYTES_PER_ELEMENT],\n ['boundingSphereCenterX', Float64Array.BYTES_PER_ELEMENT],\n ['boundingSphereCenterY', Float64Array.BYTES_PER_ELEMENT],\n ['boundingSphereCenterZ', Float64Array.BYTES_PER_ELEMENT],\n ['boundingSphereRadius', Float64Array.BYTES_PER_ELEMENT],\n ['horizonOcclusionPointX', Float64Array.BYTES_PER_ELEMENT],\n ['horizonOcclusionPointY', Float64Array.BYTES_PER_ELEMENT],\n ['horizonOcclusionPointZ', Float64Array.BYTES_PER_ELEMENT]\n]);\nfunction decodeZigZag(value) {\n return (value >> 1) ^ -(value & 1);\n}\nfunction decodeHeader(dataView) {\n let position = 0;\n const header = {};\n for (const [key, bytesCount] of QUANTIZED_MESH_HEADER) {\n const getter = bytesCount === 8 ? dataView.getFloat64 : dataView.getFloat32;\n header[key] = getter.call(dataView, position, true);\n position += bytesCount;\n }\n return { header, headerEndPosition: position };\n}\nfunction decodeVertexData(dataView, headerEndPosition) {\n let position = headerEndPosition;\n const elementsPerVertex = 3;\n const vertexCount = dataView.getUint32(position, true);\n const vertexData = new Uint16Array(vertexCount * elementsPerVertex);\n position += Uint32Array.BYTES_PER_ELEMENT;\n const bytesPerArrayElement = Uint16Array.BYTES_PER_ELEMENT;\n const elementArrayLength = vertexCount * bytesPerArrayElement;\n const uArrayStartPosition = position;\n const vArrayStartPosition = uArrayStartPosition + elementArrayLength;\n const heightArrayStartPosition = vArrayStartPosition + elementArrayLength;\n let u = 0;\n let v = 0;\n let height = 0;\n for (let i = 0; i < vertexCount; i++) {\n u += decodeZigZag(dataView.getUint16(uArrayStartPosition + bytesPerArrayElement * i, true));\n v += decodeZigZag(dataView.getUint16(vArrayStartPosition + bytesPerArrayElement * i, true));\n height += decodeZigZag(dataView.getUint16(heightArrayStartPosition + bytesPerArrayElement * i, true));\n vertexData[i] = u;\n vertexData[i + vertexCount] = v;\n vertexData[i + vertexCount * 2] = height;\n }\n position += elementArrayLength * 3;\n return { vertexData, vertexDataEndPosition: position };\n}\nfunction decodeIndex(buffer, position, indicesCount, bytesPerIndex, encoded = true) {\n let indices;\n if (bytesPerIndex === 2) {\n indices = new Uint16Array(buffer, position, indicesCount);\n }\n else {\n indices = new Uint32Array(buffer, position, indicesCount);\n }\n if (!encoded) {\n return indices;\n }\n let highest = 0;\n for (let i = 0; i < indices.length; ++i) {\n const code = indices[i];\n indices[i] = highest - code;\n if (code === 0) {\n ++highest;\n }\n }\n return indices;\n}\nfunction decodeTriangleIndices(dataView, vertexData, vertexDataEndPosition) {\n let position = vertexDataEndPosition;\n const elementsPerVertex = 3;\n const vertexCount = vertexData.length / elementsPerVertex;\n const bytesPerIndex = vertexCount > 65536 ? Uint32Array.BYTES_PER_ELEMENT : Uint16Array.BYTES_PER_ELEMENT;\n if (position % bytesPerIndex !== 0) {\n position += bytesPerIndex - (position % bytesPerIndex);\n }\n const triangleCount = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n const triangleIndicesCount = triangleCount * 3;\n const triangleIndices = decodeIndex(dataView.buffer, position, triangleIndicesCount, bytesPerIndex);\n position += triangleIndicesCount * bytesPerIndex;\n return {\n triangleIndicesEndPosition: position,\n triangleIndices\n };\n}\nfunction decodeEdgeIndices(dataView, vertexData, triangleIndicesEndPosition) {\n let position = triangleIndicesEndPosition;\n const elementsPerVertex = 3;\n const vertexCount = vertexData.length / elementsPerVertex;\n const bytesPerIndex = vertexCount > 65536 ? Uint32Array.BYTES_PER_ELEMENT : Uint16Array.BYTES_PER_ELEMENT;\n const westVertexCount = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n const westIndices = decodeIndex(dataView.buffer, position, westVertexCount, bytesPerIndex, false);\n position += westVertexCount * bytesPerIndex;\n const southVertexCount = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n const southIndices = decodeIndex(dataView.buffer, position, southVertexCount, bytesPerIndex, false);\n position += southVertexCount * bytesPerIndex;\n const eastVertexCount = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n const eastIndices = decodeIndex(dataView.buffer, position, eastVertexCount, bytesPerIndex, false);\n position += eastVertexCount * bytesPerIndex;\n const northVertexCount = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n const northIndices = decodeIndex(dataView.buffer, position, northVertexCount, bytesPerIndex, false);\n position += northVertexCount * bytesPerIndex;\n return {\n edgeIndicesEndPosition: position,\n westIndices,\n southIndices,\n eastIndices,\n northIndices\n };\n}\nfunction decodeVertexNormalsExtension(extensionDataView) {\n return new Uint8Array(extensionDataView.buffer, extensionDataView.byteOffset, extensionDataView.byteLength);\n}\nfunction decodeWaterMaskExtension(extensionDataView) {\n return extensionDataView.buffer.slice(extensionDataView.byteOffset, extensionDataView.byteOffset + extensionDataView.byteLength);\n}\nfunction decodeExtensions(dataView, indicesEndPosition) {\n const extensions = {};\n if (dataView.byteLength <= indicesEndPosition) {\n return { extensions, extensionsEndPosition: indicesEndPosition };\n }\n let position = indicesEndPosition;\n while (position < dataView.byteLength) {\n const extensionId = dataView.getUint8(position, true);\n position += Uint8Array.BYTES_PER_ELEMENT;\n const extensionLength = dataView.getUint32(position, true);\n position += Uint32Array.BYTES_PER_ELEMENT;\n const extensionView = new DataView(dataView.buffer, position, extensionLength);\n switch (extensionId) {\n case 1: {\n extensions.vertexNormals = decodeVertexNormalsExtension(extensionView);\n break;\n }\n case 2: {\n extensions.waterMask = decodeWaterMaskExtension(extensionView);\n break;\n }\n default: {\n // console.warn(`Unknown extension with id ${extensionId}`)\n }\n }\n position += extensionLength;\n }\n return { extensions, extensionsEndPosition: position };\n}\nexport const DECODING_STEPS = {\n header: 0,\n vertices: 1,\n triangleIndices: 2,\n edgeIndices: 3,\n extensions: 4\n};\nconst DEFAULT_OPTIONS = {\n maxDecodingStep: DECODING_STEPS.extensions\n};\nexport default function decode(data, userOptions) {\n const options = Object.assign({}, DEFAULT_OPTIONS, userOptions);\n const view = new DataView(data);\n const { header, headerEndPosition } = decodeHeader(view);\n if (options.maxDecodingStep < DECODING_STEPS.vertices) {\n return { header };\n }\n const { vertexData, vertexDataEndPosition } = decodeVertexData(view, headerEndPosition);\n if (options.maxDecodingStep < DECODING_STEPS.triangleIndices) {\n return { header, vertexData };\n }\n const { triangleIndices, triangleIndicesEndPosition } = decodeTriangleIndices(view, vertexData, vertexDataEndPosition);\n if (options.maxDecodingStep < DECODING_STEPS.edgeIndices) {\n return { header, vertexData, triangleIndices };\n }\n const { westIndices, southIndices, eastIndices, northIndices, edgeIndicesEndPosition } = decodeEdgeIndices(view, vertexData, triangleIndicesEndPosition);\n if (options.maxDecodingStep < DECODING_STEPS.extensions) {\n return {\n header,\n vertexData,\n triangleIndices,\n westIndices,\n northIndices,\n eastIndices,\n southIndices\n };\n }\n const { extensions } = decodeExtensions(view, edgeIndicesEndPosition);\n return {\n header,\n vertexData,\n triangleIndices,\n westIndices,\n northIndices,\n eastIndices,\n southIndices,\n extensions\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { concatenateTypedArrays } from '@loaders.gl/loader-utils';\n/**\n * Add skirt to existing mesh\n * @param {object} attributes - POSITION and TEXCOOD_0 attributes data\n * @param {any} triangles - indices array of the mesh geometry\n * @param skirtHeight - height of the skirt geometry\n * @param outsideIndices - edge indices from quantized mesh data\n * @returns - geometry data with added skirt\n */\nexport function addSkirt(attributes, triangles, skirtHeight, outsideIndices) {\n const outsideEdges = outsideIndices\n ? getOutsideEdgesFromIndices(outsideIndices, attributes.POSITION.value)\n : getOutsideEdgesFromTriangles(triangles);\n // 2 new vertices for each outside edge\n const newPosition = new attributes.POSITION.value.constructor(outsideEdges.length * 6);\n const newTexcoord0 = new attributes.TEXCOORD_0.value.constructor(outsideEdges.length * 4);\n // 2 new triangles for each outside edge\n const newTriangles = new triangles.constructor(outsideEdges.length * 6);\n for (let i = 0; i < outsideEdges.length; i++) {\n const edge = outsideEdges[i];\n updateAttributesForNewEdge({\n edge,\n edgeIndex: i,\n attributes,\n skirtHeight,\n newPosition,\n newTexcoord0,\n newTriangles\n });\n }\n attributes.POSITION.value = concatenateTypedArrays(attributes.POSITION.value, newPosition);\n attributes.TEXCOORD_0.value = concatenateTypedArrays(attributes.TEXCOORD_0.value, newTexcoord0);\n const resultTriangles = triangles instanceof Array\n ? triangles.concat(newTriangles)\n : concatenateTypedArrays(triangles, newTriangles);\n return {\n attributes,\n triangles: resultTriangles\n };\n}\n/**\n * Get geometry edges that located on a border of the mesh\n * @param {any} triangles - indices array of the mesh geometry\n * @returns {number[][]} - outside edges data\n */\nfunction getOutsideEdgesFromTriangles(triangles) {\n const edges = [];\n for (let i = 0; i < triangles.length; i += 3) {\n edges.push([triangles[i], triangles[i + 1]]);\n edges.push([triangles[i + 1], triangles[i + 2]]);\n edges.push([triangles[i + 2], triangles[i]]);\n }\n edges.sort((a, b) => Math.min(...a) - Math.min(...b) || Math.max(...a) - Math.max(...b));\n const outsideEdges = [];\n let index = 0;\n while (index < edges.length) {\n if (edges[index][0] === edges[index + 1]?.[1] && edges[index][1] === edges[index + 1]?.[0]) {\n index += 2;\n }\n else {\n outsideEdges.push(edges[index]);\n index++;\n }\n }\n return outsideEdges;\n}\n/**\n * Get geometry edges that located on a border of the mesh\n * @param {object} indices - edge indices from quantized mesh data\n * @param {TypedArray} position - position attribute geometry data\n * @returns {number[][]} - outside edges data\n */\nfunction getOutsideEdgesFromIndices(indices, position) {\n // Sort skirt indices to create adjacent triangles\n indices.westIndices.sort((a, b) => position[3 * a + 1] - position[3 * b + 1]);\n // Reverse (b - a) to match triangle winding\n indices.eastIndices.sort((a, b) => position[3 * b + 1] - position[3 * a + 1]);\n indices.southIndices.sort((a, b) => position[3 * b] - position[3 * a]);\n // Reverse (b - a) to match triangle winding\n indices.northIndices.sort((a, b) => position[3 * a] - position[3 * b]);\n const edges = [];\n for (const index in indices) {\n const indexGroup = indices[index];\n for (let i = 0; i < indexGroup.length - 1; i++) {\n edges.push([indexGroup[i], indexGroup[i + 1]]);\n }\n }\n return edges;\n}\n/**\n * Get geometry edges that located on a border of the mesh\n * @param {object} args\n * @param {number[]} args.edge - edge indices in geometry\n * @param {number} args.edgeIndex - edge index in outsideEdges array\n * @param {object} args.attributes - POSITION and TEXCOORD_0 attributes\n * @param {number} args.skirtHeight - height of the skirt geometry\n * @param {TypedArray} args.newPosition - POSITION array for skirt data\n * @param {TypedArray} args.newTexcoord0 - TEXCOORD_0 array for skirt data\n * @param {TypedArray | Array} args.newTriangles - trinagle indices array for skirt data\n * @returns {void}\n */\nfunction updateAttributesForNewEdge({ edge, edgeIndex, attributes, skirtHeight, newPosition, newTexcoord0, newTriangles }) {\n const positionsLength = attributes.POSITION.value.length;\n const vertex1Offset = edgeIndex * 2;\n const vertex2Offset = edgeIndex * 2 + 1;\n // Define POSITION for new 1st vertex\n newPosition.set(attributes.POSITION.value.subarray(edge[0] * 3, edge[0] * 3 + 3), vertex1Offset * 3);\n newPosition[vertex1Offset * 3 + 2] = newPosition[vertex1Offset * 3 + 2] - skirtHeight; // put down elevation on the skirt height\n // Define POSITION for new 2nd vertex\n newPosition.set(attributes.POSITION.value.subarray(edge[1] * 3, edge[1] * 3 + 3), vertex2Offset * 3);\n newPosition[vertex2Offset * 3 + 2] = newPosition[vertex2Offset * 3 + 2] - skirtHeight; // put down elevation on the skirt height\n // Use same TEXCOORDS for skirt vertices\n newTexcoord0.set(attributes.TEXCOORD_0.value.subarray(edge[0] * 2, edge[0] * 2 + 2), vertex1Offset * 2);\n newTexcoord0.set(attributes.TEXCOORD_0.value.subarray(edge[1] * 2, edge[1] * 2 + 2), vertex2Offset * 2);\n // Define new triangles\n const triangle1Offset = edgeIndex * 2 * 3;\n newTriangles[triangle1Offset] = edge[0];\n newTriangles[triangle1Offset + 1] = positionsLength / 3 + vertex2Offset;\n newTriangles[triangle1Offset + 2] = edge[1];\n newTriangles[triangle1Offset + 3] = positionsLength / 3 + vertex2Offset;\n newTriangles[triangle1Offset + 4] = edge[0];\n newTriangles[triangle1Offset + 5] = positionsLength / 3 + vertex1Offset;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getMeshBoundingBox } from '@loaders.gl/schema';\nimport Martini from '@mapbox/martini';\nimport Delatin from \"./delatin/index.js\";\nimport { addSkirt } from \"./helpers/skirt.js\";\n/**\n * Returns generated mesh object from image data\n *\n * @param terrainImage terrain image data\n * @param terrainOptions terrain options\n * @returns mesh object\n */\nexport function makeTerrainMeshFromImage(terrainImage, terrainOptions) {\n const { meshMaxError, bounds, elevationDecoder } = terrainOptions;\n const { data, width, height } = terrainImage;\n let terrain;\n let mesh;\n switch (terrainOptions.tesselator) {\n case 'martini':\n terrain = getTerrain(data, width, height, elevationDecoder, terrainOptions.tesselator);\n mesh = getMartiniTileMesh(meshMaxError, width, terrain);\n break;\n case 'delatin':\n terrain = getTerrain(data, width, height, elevationDecoder, terrainOptions.tesselator);\n mesh = getDelatinTileMesh(meshMaxError, width, height, terrain);\n break;\n // auto\n default:\n if (width === height && !(height & (width - 1))) {\n terrain = getTerrain(data, width, height, elevationDecoder, 'martini');\n mesh = getMartiniTileMesh(meshMaxError, width, terrain);\n }\n else {\n terrain = getTerrain(data, width, height, elevationDecoder, 'delatin');\n mesh = getDelatinTileMesh(meshMaxError, width, height, terrain);\n }\n break;\n }\n const { vertices } = mesh;\n let { triangles } = mesh;\n let attributes = getMeshAttributes(vertices, terrain, width, height, bounds);\n // Compute bounding box before adding skirt so that z values are not skewed\n const boundingBox = getMeshBoundingBox(attributes);\n if (terrainOptions.skirtHeight) {\n const { attributes: newAttributes, triangles: newTriangles } = addSkirt(attributes, triangles, terrainOptions.skirtHeight);\n attributes = newAttributes;\n triangles = newTriangles;\n }\n return {\n // Data return by this loader implementation\n loaderData: {\n header: {}\n },\n header: {\n vertexCount: triangles.length,\n boundingBox\n },\n mode: 4, // TRIANGLES\n indices: { value: Uint32Array.from(triangles), size: 1 },\n attributes\n };\n}\n/**\n * Get Martini generated vertices and triangles\n *\n * @param {number} meshMaxError threshold for simplifying mesh\n * @param {number} width width of the input data\n * @param {number[] | Float32Array} terrain elevation data\n * @returns {{vertices: Uint16Array, triangles: Uint32Array}} vertices and triangles data\n */\nfunction getMartiniTileMesh(meshMaxError, width, terrain) {\n const gridSize = width + 1;\n const martini = new Martini(gridSize);\n const tile = martini.createTile(terrain);\n const { vertices, triangles } = tile.getMesh(meshMaxError);\n return { vertices, triangles };\n}\n/**\n * Get Delatin generated vertices and triangles\n *\n * @param {number} meshMaxError threshold for simplifying mesh\n * @param {number} width width of the input data array\n * @param {number} height height of the input data array\n * @param {number[] | Float32Array} terrain elevation data\n * @returns {{vertices: number[], triangles: number[]}} vertices and triangles data\n */\nfunction getDelatinTileMesh(meshMaxError, width, height, terrain) {\n const tin = new Delatin(terrain, width + 1, height + 1);\n tin.run(meshMaxError);\n // @ts-expect-error\n const { coords, triangles } = tin;\n const vertices = coords;\n return { vertices, triangles };\n}\nfunction getTerrain(imageData, width, height, elevationDecoder, tesselator) {\n const { rScaler, bScaler, gScaler, offset } = elevationDecoder;\n // From Martini demo\n // https://observablehq.com/@mourner/martin-real-time-rtin-terrain-mesh\n const terrain = new Float32Array((width + 1) * (height + 1));\n // decode terrain values\n for (let i = 0, y = 0; y < height; y++) {\n for (let x = 0; x < width; x++, i++) {\n const k = i * 4;\n const r = imageData[k + 0];\n const g = imageData[k + 1];\n const b = imageData[k + 2];\n terrain[i + y] = r * rScaler + g * gScaler + b * bScaler + offset;\n }\n }\n if (tesselator === 'martini') {\n // backfill bottom border\n for (let i = (width + 1) * width, x = 0; x < width; x++, i++) {\n terrain[i] = terrain[i - width - 1];\n }\n // backfill right border\n for (let i = height, y = 0; y < height + 1; y++, i += height + 1) {\n terrain[i] = terrain[i - 1];\n }\n }\n return terrain;\n}\nfunction getMeshAttributes(vertices, terrain, width, height, bounds) {\n const gridSize = width + 1;\n const numOfVerticies = vertices.length / 2;\n // vec3. x, y in pixels, z in meters\n const positions = new Float32Array(numOfVerticies * 3);\n // vec2. 1 to 1 relationship with position. represents the uv on the texture image. 0,0 to 1,1.\n const texCoords = new Float32Array(numOfVerticies * 2);\n const [minX, minY, maxX, maxY] = bounds || [0, 0, width, height];\n const xScale = (maxX - minX) / width;\n const yScale = (maxY - minY) / height;\n for (let i = 0; i < numOfVerticies; i++) {\n const x = vertices[i * 2];\n const y = vertices[i * 2 + 1];\n const pixelIdx = y * gridSize + x;\n positions[3 * i + 0] = x * xScale + minX;\n positions[3 * i + 1] = -y * yScale + maxY;\n positions[3 * i + 2] = terrain[pixelIdx];\n texCoords[2 * i + 0] = x / width;\n texCoords[2 * i + 1] = y / height;\n }\n return {\n POSITION: { value: positions, size: 3 },\n TEXCOORD_0: { value: texCoords, size: 2 }\n // NORMAL: {}, - optional, but creates the high poly look with lighting\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// ISC License\n// Copyright(c) 2019, Michael Fogleman, Vladimir Agafonkin\n// @ts-nocheck\n/* eslint-disable complexity, max-params, max-statements, max-depth, no-constant-condition */\nexport default class Delatin {\n constructor(data, width, height = width) {\n this.data = data; // height data\n this.width = width;\n this.height = height;\n this.coords = []; // vertex coordinates (x, y)\n this.triangles = []; // mesh triangle indices\n // additional triangle data\n this._halfedges = [];\n this._candidates = [];\n this._queueIndices = [];\n this._queue = []; // queue of added triangles\n this._errors = [];\n this._rms = [];\n this._pending = []; // triangles pending addition to queue\n this._pendingLen = 0;\n this._rmsSum = 0;\n const x1 = width - 1;\n const y1 = height - 1;\n const p0 = this._addPoint(0, 0);\n const p1 = this._addPoint(x1, 0);\n const p2 = this._addPoint(0, y1);\n const p3 = this._addPoint(x1, y1);\n // add initial two triangles\n const t0 = this._addTriangle(p3, p0, p2, -1, -1, -1);\n this._addTriangle(p0, p3, p1, t0, -1, -1);\n this._flush();\n }\n // refine the mesh until its maximum error gets below the given one\n run(maxError = 1) {\n while (this.getMaxError() > maxError) {\n this.refine();\n }\n }\n // refine the mesh with a single point\n refine() {\n this._step();\n this._flush();\n }\n // max error of the current mesh\n getMaxError() {\n return this._errors[0];\n }\n // root-mean-square deviation of the current mesh\n getRMSD() {\n return this._rmsSum > 0 ? Math.sqrt(this._rmsSum / (this.width * this.height)) : 0;\n }\n // height value at a given position\n heightAt(x, y) {\n return this.data[this.width * y + x];\n }\n // rasterize and queue all triangles that got added or updated in _step\n _flush() {\n const coords = this.coords;\n for (let i = 0; i < this._pendingLen; i++) {\n const t = this._pending[i];\n // rasterize triangle to find maximum pixel error\n const a = 2 * this.triangles[t * 3 + 0];\n const b = 2 * this.triangles[t * 3 + 1];\n const c = 2 * this.triangles[t * 3 + 2];\n this._findCandidate(coords[a], coords[a + 1], coords[b], coords[b + 1], coords[c], coords[c + 1], t);\n }\n this._pendingLen = 0;\n }\n // rasterize a triangle, find its max error, and queue it for processing\n _findCandidate(p0x, p0y, p1x, p1y, p2x, p2y, t) {\n // triangle bounding box\n const minX = Math.min(p0x, p1x, p2x);\n const minY = Math.min(p0y, p1y, p2y);\n const maxX = Math.max(p0x, p1x, p2x);\n const maxY = Math.max(p0y, p1y, p2y);\n // forward differencing variables\n let w00 = orient(p1x, p1y, p2x, p2y, minX, minY);\n let w01 = orient(p2x, p2y, p0x, p0y, minX, minY);\n let w02 = orient(p0x, p0y, p1x, p1y, minX, minY);\n const a01 = p1y - p0y;\n const b01 = p0x - p1x;\n const a12 = p2y - p1y;\n const b12 = p1x - p2x;\n const a20 = p0y - p2y;\n const b20 = p2x - p0x;\n // pre-multiplied z values at vertices\n const a = orient(p0x, p0y, p1x, p1y, p2x, p2y);\n const z0 = this.heightAt(p0x, p0y) / a;\n const z1 = this.heightAt(p1x, p1y) / a;\n const z2 = this.heightAt(p2x, p2y) / a;\n // iterate over pixels in bounding box\n let maxError = 0;\n let mx = 0;\n let my = 0;\n let rms = 0;\n for (let y = minY; y <= maxY; y++) {\n // compute starting offset\n let dx = 0;\n if (w00 < 0 && a12 !== 0) {\n dx = Math.max(dx, Math.floor(-w00 / a12));\n }\n if (w01 < 0 && a20 !== 0) {\n dx = Math.max(dx, Math.floor(-w01 / a20));\n }\n if (w02 < 0 && a01 !== 0) {\n dx = Math.max(dx, Math.floor(-w02 / a01));\n }\n let w0 = w00 + a12 * dx;\n let w1 = w01 + a20 * dx;\n let w2 = w02 + a01 * dx;\n let wasInside = false;\n for (let x = minX + dx; x <= maxX; x++) {\n // check if inside triangle\n if (w0 >= 0 && w1 >= 0 && w2 >= 0) {\n wasInside = true;\n // compute z using barycentric coordinates\n const z = z0 * w0 + z1 * w1 + z2 * w2;\n const dz = Math.abs(z - this.heightAt(x, y));\n rms += dz * dz;\n if (dz > maxError) {\n maxError = dz;\n mx = x;\n my = y;\n }\n }\n else if (wasInside) {\n break;\n }\n w0 += a12;\n w1 += a20;\n w2 += a01;\n }\n w00 += b12;\n w01 += b20;\n w02 += b01;\n }\n if ((mx === p0x && my === p0y) || (mx === p1x && my === p1y) || (mx === p2x && my === p2y)) {\n maxError = 0;\n }\n // update triangle metadata\n this._candidates[2 * t] = mx;\n this._candidates[2 * t + 1] = my;\n this._rms[t] = rms;\n // add triangle to priority queue\n this._queuePush(t, maxError, rms);\n }\n // process the next triangle in the queue, splitting it with a new point\n _step() {\n // pop triangle with highest error from priority queue\n const t = this._queuePop();\n const e0 = t * 3 + 0;\n const e1 = t * 3 + 1;\n const e2 = t * 3 + 2;\n const p0 = this.triangles[e0];\n const p1 = this.triangles[e1];\n const p2 = this.triangles[e2];\n const ax = this.coords[2 * p0];\n const ay = this.coords[2 * p0 + 1];\n const bx = this.coords[2 * p1];\n const by = this.coords[2 * p1 + 1];\n const cx = this.coords[2 * p2];\n const cy = this.coords[2 * p2 + 1];\n const px = this._candidates[2 * t];\n const py = this._candidates[2 * t + 1];\n const pn = this._addPoint(px, py);\n if (orient(ax, ay, bx, by, px, py) === 0) {\n this._handleCollinear(pn, e0);\n }\n else if (orient(bx, by, cx, cy, px, py) === 0) {\n this._handleCollinear(pn, e1);\n }\n else if (orient(cx, cy, ax, ay, px, py) === 0) {\n this._handleCollinear(pn, e2);\n }\n else {\n const h0 = this._halfedges[e0];\n const h1 = this._halfedges[e1];\n const h2 = this._halfedges[e2];\n const t0 = this._addTriangle(p0, p1, pn, h0, -1, -1, e0);\n const t1 = this._addTriangle(p1, p2, pn, h1, -1, t0 + 1);\n const t2 = this._addTriangle(p2, p0, pn, h2, t0 + 2, t1 + 1);\n this._legalize(t0);\n this._legalize(t1);\n this._legalize(t2);\n }\n }\n // add coordinates for a new vertex\n _addPoint(x, y) {\n const i = this.coords.length >> 1;\n this.coords.push(x, y);\n return i;\n }\n // add or update a triangle in the mesh\n _addTriangle(a, b, c, ab, bc, ca, e = this.triangles.length) {\n const t = e / 3; // new triangle index\n // add triangle vertices\n this.triangles[e + 0] = a;\n this.triangles[e + 1] = b;\n this.triangles[e + 2] = c;\n // add triangle halfedges\n this._halfedges[e + 0] = ab;\n this._halfedges[e + 1] = bc;\n this._halfedges[e + 2] = ca;\n // link neighboring halfedges\n if (ab >= 0) {\n this._halfedges[ab] = e + 0;\n }\n if (bc >= 0) {\n this._halfedges[bc] = e + 1;\n }\n if (ca >= 0) {\n this._halfedges[ca] = e + 2;\n }\n // init triangle metadata\n this._candidates[2 * t + 0] = 0;\n this._candidates[2 * t + 1] = 0;\n this._queueIndices[t] = -1;\n this._rms[t] = 0;\n // add triangle to pending queue for later rasterization\n this._pending[this._pendingLen++] = t;\n // return first halfedge index\n return e;\n }\n _legalize(a) {\n // if the pair of triangles doesn't satisfy the Delaunay condition\n // (p1 is inside the circumcircle of [p0, pl, pr]), flip them,\n // then do the same check/flip recursively for the new pair of triangles\n //\n // pl pl\n // /||\\ / \\\n // al/ || \\bl al/ \\a\n // / || \\ / \\\n // / a||b \\ flip /___ar___\\\n // p0\\ || /p1 => p0\\---bl---/p1\n // \\ || / \\ /\n // ar\\ || /br b\\ /br\n // \\||/ \\ /\n // pr pr\n const b = this._halfedges[a];\n if (b < 0) {\n return;\n }\n const a0 = a - (a % 3);\n const b0 = b - (b % 3);\n const al = a0 + ((a + 1) % 3);\n const ar = a0 + ((a + 2) % 3);\n const bl = b0 + ((b + 2) % 3);\n const br = b0 + ((b + 1) % 3);\n const p0 = this.triangles[ar];\n const pr = this.triangles[a];\n const pl = this.triangles[al];\n const p1 = this.triangles[bl];\n const coords = this.coords;\n if (!inCircle(coords[2 * p0], coords[2 * p0 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1])) {\n return;\n }\n const hal = this._halfedges[al];\n const har = this._halfedges[ar];\n const hbl = this._halfedges[bl];\n const hbr = this._halfedges[br];\n this._queueRemove(a0 / 3);\n this._queueRemove(b0 / 3);\n const t0 = this._addTriangle(p0, p1, pl, -1, hbl, hal, a0);\n const t1 = this._addTriangle(p1, p0, pr, t0, har, hbr, b0);\n this._legalize(t0 + 1);\n this._legalize(t1 + 2);\n }\n // handle a case where new vertex is on the edge of a triangle\n _handleCollinear(pn, a) {\n const a0 = a - (a % 3);\n const al = a0 + ((a + 1) % 3);\n const ar = a0 + ((a + 2) % 3);\n const p0 = this.triangles[ar];\n const pr = this.triangles[a];\n const pl = this.triangles[al];\n const hal = this._halfedges[al];\n const har = this._halfedges[ar];\n const b = this._halfedges[a];\n if (b < 0) {\n const t0 = this._addTriangle(pn, p0, pr, -1, har, -1, a0);\n const t1 = this._addTriangle(p0, pn, pl, t0, -1, hal);\n this._legalize(t0 + 1);\n this._legalize(t1 + 2);\n return;\n }\n const b0 = b - (b % 3);\n const bl = b0 + ((b + 2) % 3);\n const br = b0 + ((b + 1) % 3);\n const p1 = this.triangles[bl];\n const hbl = this._halfedges[bl];\n const hbr = this._halfedges[br];\n this._queueRemove(b0 / 3);\n const t0 = this._addTriangle(p0, pr, pn, har, -1, -1, a0);\n const t1 = this._addTriangle(pr, p1, pn, hbr, -1, t0 + 1, b0);\n const t2 = this._addTriangle(p1, pl, pn, hbl, -1, t1 + 1);\n const t3 = this._addTriangle(pl, p0, pn, hal, t0 + 2, t2 + 1);\n this._legalize(t0);\n this._legalize(t1);\n this._legalize(t2);\n this._legalize(t3);\n }\n // priority queue methods\n _queuePush(t, error, rms) {\n const i = this._queue.length;\n this._queueIndices[t] = i;\n this._queue.push(t);\n this._errors.push(error);\n this._rmsSum += rms;\n this._queueUp(i);\n }\n _queuePop() {\n const n = this._queue.length - 1;\n this._queueSwap(0, n);\n this._queueDown(0, n);\n return this._queuePopBack();\n }\n _queuePopBack() {\n const t = this._queue.pop();\n this._errors.pop();\n this._rmsSum -= this._rms[t];\n this._queueIndices[t] = -1;\n return t;\n }\n _queueRemove(t) {\n const i = this._queueIndices[t];\n if (i < 0) {\n const it = this._pending.indexOf(t);\n if (it !== -1) {\n this._pending[it] = this._pending[--this._pendingLen];\n }\n else {\n throw new Error('Broken triangulation (something went wrong).');\n }\n return;\n }\n const n = this._queue.length - 1;\n if (n !== i) {\n this._queueSwap(i, n);\n if (!this._queueDown(i, n)) {\n this._queueUp(i);\n }\n }\n this._queuePopBack();\n }\n _queueLess(i, j) {\n return this._errors[i] > this._errors[j];\n }\n _queueSwap(i, j) {\n const pi = this._queue[i];\n const pj = this._queue[j];\n this._queue[i] = pj;\n this._queue[j] = pi;\n this._queueIndices[pi] = j;\n this._queueIndices[pj] = i;\n const e = this._errors[i];\n this._errors[i] = this._errors[j];\n this._errors[j] = e;\n }\n _queueUp(j0) {\n let j = j0;\n while (true) {\n const i = (j - 1) >> 1;\n if (i === j || !this._queueLess(j, i)) {\n break;\n }\n this._queueSwap(i, j);\n j = i;\n }\n }\n _queueDown(i0, n) {\n let i = i0;\n while (true) {\n const j1 = 2 * i + 1;\n if (j1 >= n || j1 < 0) {\n break;\n }\n const j2 = j1 + 1;\n let j = j1;\n if (j2 < n && this._queueLess(j2, j1)) {\n j = j2;\n }\n if (!this._queueLess(j, i)) {\n break;\n }\n this._queueSwap(i, j);\n i = j;\n }\n return i > i0;\n }\n}\nfunction orient(ax, ay, bx, by, cx, cy) {\n return (bx - cx) * (ay - cy) - (by - cy) * (ax - cx);\n}\nfunction inCircle(ax, ay, bx, by, cx, cy, px, py) {\n const dx = ax - px;\n const dy = ay - py;\n const ex = bx - px;\n const ey = by - py;\n const fx = cx - px;\n const fy = cy - py;\n const ap = dx * dx + dy * dy;\n const bp = ex * ex + ey * ey;\n const cp = fx * fx + fy * fy;\n return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.1\" !== 'undefined' ? \"4.3.1\" : 'latest';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { VERSION } from \"./lib/utils/version.js\";\n/**\n * Worker loader for image encoded terrain\n */\nexport const TerrainLoader = {\n dataType: null,\n batchType: null,\n name: 'Terrain',\n id: 'terrain',\n module: 'terrain',\n version: VERSION,\n worker: true,\n extensions: ['png', 'pngraw', 'jpg', 'jpeg', 'gif', 'webp', 'bmp'],\n mimeTypes: ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/bmp'],\n options: {\n terrain: {\n tesselator: 'auto',\n bounds: undefined,\n meshMaxError: 10,\n elevationDecoder: {\n rScaler: 1,\n gScaler: 0,\n bScaler: 0,\n offset: 0\n },\n skirtHeight: undefined\n }\n }\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { VERSION } from \"./lib/utils/version.js\";\n/**\n * Worker loader for quantized meshes\n */\nexport const QuantizedMeshLoader = {\n dataType: null, // Mesh,\n batchType: null,\n name: 'Quantized Mesh',\n id: 'quantized-mesh',\n module: 'terrain',\n version: VERSION,\n worker: true,\n extensions: ['terrain'],\n mimeTypes: ['application/vnd.quantized-mesh'],\n options: {\n 'quantized-mesh': {\n bounds: [0, 0, 1, 1],\n skirtHeight: null\n }\n }\n};\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,6BAAAA;AAAA,EAAA;AAAA,uBAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,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;AAAA,EACJ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,YAAY,CAAC,SAAS;AAAA,EACtB,WAAW,CAAC,gCAAgC;AAAA,EAC5C,SAAS;AAAA,IACL,kBAAkB;AAAA,MACd,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;AAAA,MACnB,aAAa;AAAA,IACjB;AAAA,EACJ;AACJ;;;ARbO,IAAME,iBAAgB;AAAA,EACzB,GAAG;AAAA,EACH,OAAO;AACX;AACA,eAAsB,aAAa,aAAa,SAAS,SAAS;AAC9D,QAAM,mBAAmB;AAAA,IACrB,GAAG;AAAA,IACH,UAAU;AAAA,IACV,OAAO,EAAE,GAAG,mCAAS,OAAO,MAAM,OAAO;AAAA,EAC7C;AACA,QAAM,QAAQ,UAAM,uCAAiB,aAAa,CAAC,GAAG,kBAAkB,OAAO;AAE/E,QAAM,iBAAiB,EAAE,GAAGA,eAAc,QAAQ,SAAS,GAAG,mCAAS,QAAQ;AAE/E,SAAO,yBAAyB,OAAO,cAAc;AACzD;AAMO,IAAMC,uBAAsB;AAAA,EAC/B,GAAG;AAAA,EACH,WAAW,CAAC,aAAa,YAAY,mBAAmB,aAAa,mCAAU,iBAAiB;AAAA,EAChG,OAAO,OAAO,aAAa,YAAY,mBAAmB,aAAa,mCAAU,iBAAiB;AACtG;", "names": ["QuantizedMeshLoader", "TerrainLoader", "import_loader_utils", "import_schema", "t0", "t1", "getMeshAttributes", "Martini", "TerrainLoader", "QuantizedMeshLoader"] }