@loaders.gl/terrain 4.0.0-beta.2 → 4.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/dist.dev.js +1214 -0
  2. package/dist/index.cjs +1020 -0
  3. package/dist/{esm/index.js → index.js} +4 -4
  4. package/dist/index.js.map +1 -0
  5. package/dist/lib/decode-quantized-mesh.js.map +1 -0
  6. package/dist/lib/delatin/index.js.map +1 -0
  7. package/dist/lib/helpers/skirt.js.map +1 -0
  8. package/dist/{esm/lib → lib}/parse-quantized-mesh.js +2 -2
  9. package/dist/lib/parse-quantized-mesh.js.map +1 -0
  10. package/dist/{esm/lib → lib}/parse-terrain.js +2 -2
  11. package/dist/lib/parse-terrain.js.map +1 -0
  12. package/dist/lib/utils/version.js +2 -0
  13. package/dist/lib/utils/version.js.map +1 -0
  14. package/dist/{esm/quantized-mesh-loader.js → quantized-mesh-loader.js} +1 -1
  15. package/dist/quantized-mesh-loader.js.map +1 -0
  16. package/dist/quantized-mesh-worker.js +133 -27
  17. package/dist/{esm/terrain-loader.js → terrain-loader.js} +1 -1
  18. package/dist/terrain-loader.js.map +1 -0
  19. package/dist/terrain-worker.js +133 -27
  20. package/dist/{esm/workers → workers}/quantized-mesh-worker.js +1 -1
  21. package/dist/workers/quantized-mesh-worker.js.map +1 -0
  22. package/dist/{esm/workers → workers}/terrain-worker.js +1 -1
  23. package/dist/workers/terrain-worker.js.map +1 -0
  24. package/package.json +17 -9
  25. package/dist/bundle.d.ts +0 -2
  26. package/dist/bundle.d.ts.map +0 -1
  27. package/dist/dist.min.js +0 -1186
  28. package/dist/es5/bundle.js +0 -6
  29. package/dist/es5/bundle.js.map +0 -1
  30. package/dist/es5/index.js +0 -88
  31. package/dist/es5/index.js.map +0 -1
  32. package/dist/es5/lib/decode-quantized-mesh.js +0 -250
  33. package/dist/es5/lib/decode-quantized-mesh.js.map +0 -1
  34. package/dist/es5/lib/delatin/index.js +0 -408
  35. package/dist/es5/lib/delatin/index.js.map +0 -1
  36. package/dist/es5/lib/helpers/skirt.js +0 -105
  37. package/dist/es5/lib/helpers/skirt.js.map +0 -1
  38. package/dist/es5/lib/parse-quantized-mesh.js +0 -95
  39. package/dist/es5/lib/parse-quantized-mesh.js.map +0 -1
  40. package/dist/es5/lib/parse-terrain.js +0 -152
  41. package/dist/es5/lib/parse-terrain.js.map +0 -1
  42. package/dist/es5/lib/utils/version.js +0 -9
  43. package/dist/es5/lib/utils/version.js.map +0 -1
  44. package/dist/es5/quantized-mesh-loader.js +0 -24
  45. package/dist/es5/quantized-mesh-loader.js.map +0 -1
  46. package/dist/es5/terrain-loader.js +0 -32
  47. package/dist/es5/terrain-loader.js.map +0 -1
  48. package/dist/es5/workers/quantized-mesh-worker.js +0 -6
  49. package/dist/es5/workers/quantized-mesh-worker.js.map +0 -1
  50. package/dist/es5/workers/terrain-worker.js +0 -6
  51. package/dist/es5/workers/terrain-worker.js.map +0 -1
  52. package/dist/esm/bundle.js +0 -4
  53. package/dist/esm/bundle.js.map +0 -1
  54. package/dist/esm/index.js.map +0 -1
  55. package/dist/esm/lib/decode-quantized-mesh.js.map +0 -1
  56. package/dist/esm/lib/delatin/index.js.map +0 -1
  57. package/dist/esm/lib/helpers/skirt.js.map +0 -1
  58. package/dist/esm/lib/parse-quantized-mesh.js.map +0 -1
  59. package/dist/esm/lib/parse-terrain.js.map +0 -1
  60. package/dist/esm/lib/utils/version.js +0 -2
  61. package/dist/esm/lib/utils/version.js.map +0 -1
  62. package/dist/esm/quantized-mesh-loader.js.map +0 -1
  63. package/dist/esm/terrain-loader.js.map +0 -1
  64. package/dist/esm/workers/quantized-mesh-worker.js.map +0 -1
  65. package/dist/esm/workers/terrain-worker.js.map +0 -1
  66. package/src/bundle.ts +0 -4
  67. /package/dist/{esm/lib → lib}/decode-quantized-mesh.js +0 -0
  68. /package/dist/{esm/lib → lib}/delatin/index.js +0 -0
  69. /package/dist/{esm/lib → lib}/helpers/skirt.js +0 -0
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  (() => {
2
3
  // ../loader-utils/src/loader-types.ts
3
4
  async function parseFromContext(data, loaders, options, context) {
@@ -6,7 +7,7 @@
6
7
 
7
8
  // ../worker-utils/src/lib/worker-utils/get-transfer-list.ts
8
9
  function getTransferList(object, recursive = true, transfers) {
9
- const transfersSet = transfers || new Set();
10
+ const transfersSet = transfers || /* @__PURE__ */ new Set();
10
11
  if (!object) {
11
12
  } else if (isTransferable(object)) {
12
13
  transfersSet.add(object);
@@ -49,11 +50,15 @@
49
50
  }
50
51
  return parentPort;
51
52
  }
52
- var onMessageWrapperMap = new Map();
53
+ var onMessageWrapperMap = /* @__PURE__ */ new Map();
53
54
  var WorkerBody = class {
55
+ /** Check that we are actually in a worker thread */
54
56
  static inWorkerThread() {
55
57
  return typeof self !== "undefined" || Boolean(getParentPort());
56
58
  }
59
+ /*
60
+ * (type: WorkerMessageType, payload: WorkerMessagePayload) => any
61
+ */
57
62
  static set onmessage(onMessage) {
58
63
  function handleMessage(message) {
59
64
  const parentPort3 = getParentPort();
@@ -97,6 +102,11 @@
97
102
  globalThis.removeEventListener("message", onMessageWrapper);
98
103
  }
99
104
  }
105
+ /**
106
+ * Send a message from a worker to creating thread (main thread)
107
+ * @param type
108
+ * @param payload
109
+ */
100
110
  static postMessage(type, payload) {
101
111
  const data = { source: "loaders.gl", type, payload };
102
112
  const transferList = getTransferList(payload);
@@ -128,6 +138,7 @@
128
138
  loader,
129
139
  arrayBuffer: input,
130
140
  options,
141
+ // @ts-expect-error fetch missing
131
142
  context: {
132
143
  ...context,
133
144
  _parse: parseOnMainThread
@@ -198,7 +209,9 @@
198
209
  const arrays = typedArrays;
199
210
  const TypedArrayConstructor = arrays && arrays.length > 1 && arrays[0].constructor || null;
200
211
  if (!TypedArrayConstructor) {
201
- throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');
212
+ throw new Error(
213
+ '"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types'
214
+ );
202
215
  }
203
216
  const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);
204
217
  const result = new TypedArrayConstructor(sumLength);
@@ -238,7 +251,7 @@
238
251
  }
239
252
 
240
253
  // src/lib/decode-quantized-mesh.ts
241
- var QUANTIZED_MESH_HEADER = new Map([
254
+ var QUANTIZED_MESH_HEADER = /* @__PURE__ */ new Map([
242
255
  ["centerX", Float64Array.BYTES_PER_ELEMENT],
243
256
  ["centerY", Float64Array.BYTES_PER_ELEMENT],
244
257
  ["centerZ", Float64Array.BYTES_PER_ELEMENT],
@@ -282,7 +295,9 @@
282
295
  for (let i = 0; i < vertexCount; i++) {
283
296
  u += decodeZigZag(dataView.getUint16(uArrayStartPosition + bytesPerArrayElement * i, true));
284
297
  v += decodeZigZag(dataView.getUint16(vArrayStartPosition + bytesPerArrayElement * i, true));
285
- height += decodeZigZag(dataView.getUint16(heightArrayStartPosition + bytesPerArrayElement * i, true));
298
+ height += decodeZigZag(
299
+ dataView.getUint16(heightArrayStartPosition + bytesPerArrayElement * i, true)
300
+ );
286
301
  vertexData[i] = u;
287
302
  vertexData[i + vertexCount] = v;
288
303
  vertexData[i + vertexCount * 2] = height;
@@ -321,7 +336,12 @@
321
336
  const triangleCount = dataView.getUint32(position, true);
322
337
  position += Uint32Array.BYTES_PER_ELEMENT;
323
338
  const triangleIndicesCount = triangleCount * 3;
324
- const triangleIndices = decodeIndex(dataView.buffer, position, triangleIndicesCount, bytesPerIndex);
339
+ const triangleIndices = decodeIndex(
340
+ dataView.buffer,
341
+ position,
342
+ triangleIndicesCount,
343
+ bytesPerIndex
344
+ );
325
345
  position += triangleIndicesCount * bytesPerIndex;
326
346
  return {
327
347
  triangleIndicesEndPosition: position,
@@ -339,7 +359,13 @@
339
359
  position += westVertexCount * bytesPerIndex;
340
360
  const southVertexCount = dataView.getUint32(position, true);
341
361
  position += Uint32Array.BYTES_PER_ELEMENT;
342
- const southIndices = decodeIndex(dataView.buffer, position, southVertexCount, bytesPerIndex, false);
362
+ const southIndices = decodeIndex(
363
+ dataView.buffer,
364
+ position,
365
+ southVertexCount,
366
+ bytesPerIndex,
367
+ false
368
+ );
343
369
  position += southVertexCount * bytesPerIndex;
344
370
  const eastVertexCount = dataView.getUint32(position, true);
345
371
  position += Uint32Array.BYTES_PER_ELEMENT;
@@ -347,7 +373,13 @@
347
373
  position += eastVertexCount * bytesPerIndex;
348
374
  const northVertexCount = dataView.getUint32(position, true);
349
375
  position += Uint32Array.BYTES_PER_ELEMENT;
350
- const northIndices = decodeIndex(dataView.buffer, position, northVertexCount, bytesPerIndex, false);
376
+ const northIndices = decodeIndex(
377
+ dataView.buffer,
378
+ position,
379
+ northVertexCount,
380
+ bytesPerIndex,
381
+ false
382
+ );
351
383
  position += northVertexCount * bytesPerIndex;
352
384
  return {
353
385
  edgeIndicesEndPosition: position,
@@ -358,10 +390,17 @@
358
390
  };
359
391
  }
360
392
  function decodeVertexNormalsExtension(extensionDataView) {
361
- return new Uint8Array(extensionDataView.buffer, extensionDataView.byteOffset, extensionDataView.byteLength);
393
+ return new Uint8Array(
394
+ extensionDataView.buffer,
395
+ extensionDataView.byteOffset,
396
+ extensionDataView.byteLength
397
+ );
362
398
  }
363
399
  function decodeWaterMaskExtension(extensionDataView) {
364
- return extensionDataView.buffer.slice(extensionDataView.byteOffset, extensionDataView.byteOffset + extensionDataView.byteLength);
400
+ return extensionDataView.buffer.slice(
401
+ extensionDataView.byteOffset,
402
+ extensionDataView.byteOffset + extensionDataView.byteLength
403
+ );
365
404
  }
366
405
  function decodeExtensions(dataView, indicesEndPosition) {
367
406
  const extensions = {};
@@ -412,7 +451,11 @@
412
451
  if (options.maxDecodingStep < DECODING_STEPS.triangleIndices) {
413
452
  return { header, vertexData };
414
453
  }
415
- const { triangleIndices, triangleIndicesEndPosition } = decodeTriangleIndices(view, vertexData, vertexDataEndPosition);
454
+ const { triangleIndices, triangleIndicesEndPosition } = decodeTriangleIndices(
455
+ view,
456
+ vertexData,
457
+ vertexDataEndPosition
458
+ );
416
459
  if (options.maxDecodingStep < DECODING_STEPS.edgeIndices) {
417
460
  return { header, vertexData, triangleIndices };
418
461
  }
@@ -513,12 +556,24 @@
513
556
  const positionsLength = attributes.POSITION.value.length;
514
557
  const vertex1Offset = edgeIndex * 2;
515
558
  const vertex2Offset = edgeIndex * 2 + 1;
516
- newPosition.set(attributes.POSITION.value.subarray(edge[0] * 3, edge[0] * 3 + 3), vertex1Offset * 3);
559
+ newPosition.set(
560
+ attributes.POSITION.value.subarray(edge[0] * 3, edge[0] * 3 + 3),
561
+ vertex1Offset * 3
562
+ );
517
563
  newPosition[vertex1Offset * 3 + 2] = newPosition[vertex1Offset * 3 + 2] - skirtHeight;
518
- newPosition.set(attributes.POSITION.value.subarray(edge[1] * 3, edge[1] * 3 + 3), vertex2Offset * 3);
564
+ newPosition.set(
565
+ attributes.POSITION.value.subarray(edge[1] * 3, edge[1] * 3 + 3),
566
+ vertex2Offset * 3
567
+ );
519
568
  newPosition[vertex2Offset * 3 + 2] = newPosition[vertex2Offset * 3 + 2] - skirtHeight;
520
- newTexcoord0.set(attributes.TEXCOORD_0.value.subarray(edge[0] * 2, edge[0] * 2 + 2), vertex1Offset * 2);
521
- newTexcoord0.set(attributes.TEXCOORD_0.value.subarray(edge[1] * 2, edge[1] * 2 + 2), vertex2Offset * 2);
569
+ newTexcoord0.set(
570
+ attributes.TEXCOORD_0.value.subarray(edge[0] * 2, edge[0] * 2 + 2),
571
+ vertex1Offset * 2
572
+ );
573
+ newTexcoord0.set(
574
+ attributes.TEXCOORD_0.value.subarray(edge[1] * 2, edge[1] * 2 + 2),
575
+ vertex2Offset * 2
576
+ );
522
577
  const triangle1Offset = edgeIndex * 2 * 3;
523
578
  newTriangles[triangle1Offset] = edge[0];
524
579
  newTriangles[triangle1Offset + 1] = positionsLength / 3 + vertex2Offset;
@@ -544,26 +599,35 @@
544
599
  let attributes = getMeshAttributes(vertexData, header, bounds);
545
600
  const boundingBox = getMeshBoundingBox(attributes);
546
601
  if (options?.skirtHeight) {
547
- const { attributes: newAttributes, triangles: newTriangles } = addSkirt(attributes, triangleIndices, options.skirtHeight, {
548
- westIndices,
549
- northIndices,
550
- eastIndices,
551
- southIndices
552
- });
602
+ const { attributes: newAttributes, triangles: newTriangles } = addSkirt(
603
+ attributes,
604
+ triangleIndices,
605
+ options.skirtHeight,
606
+ {
607
+ westIndices,
608
+ northIndices,
609
+ eastIndices,
610
+ southIndices
611
+ }
612
+ );
553
613
  attributes = newAttributes;
554
614
  triangleIndices = newTriangles;
555
615
  }
556
616
  return {
617
+ // Data return by this loader implementation
557
618
  loaderData: {
558
619
  header: {}
559
620
  },
560
621
  header: {
622
+ // @ts-ignore
561
623
  vertexCount: triangleIndices.length,
562
624
  boundingBox
563
625
  },
626
+ // TODO
564
627
  schema: void 0,
565
628
  topology: "triangle-list",
566
629
  mode: 4,
630
+ // TRIANGLES
567
631
  indices: { value: triangleIndices, size: 1 },
568
632
  attributes
569
633
  };
@@ -590,6 +654,8 @@
590
654
  return {
591
655
  POSITION: { value: positions, size: 3 },
592
656
  TEXCOORD_0: { value: texCoords, size: 2 }
657
+ // TODO: Parse normals if they exist in the file
658
+ // NORMAL: {}, - optional, but creates the high poly look with lighting
593
659
  };
594
660
  }
595
661
 
@@ -599,7 +665,9 @@
599
665
  this.gridSize = gridSize;
600
666
  const tileSize = gridSize - 1;
601
667
  if (tileSize & tileSize - 1)
602
- throw new Error(`Expected grid size to be 2^n+1, got ${gridSize}.`);
668
+ throw new Error(
669
+ `Expected grid size to be 2^n+1, got ${gridSize}.`
670
+ );
603
671
  this.numTriangles = tileSize * tileSize * 2 - 2;
604
672
  this.numParentTriangles = this.numTriangles - tileSize * tileSize;
605
673
  this.indices = new Uint32Array(this.gridSize * this.gridSize);
@@ -644,7 +712,9 @@
644
712
  constructor(terrain, martini) {
645
713
  const size = martini.gridSize;
646
714
  if (terrain.length !== size * size)
647
- throw new Error(`Expected terrain data of length ${size * size} (${size} x ${size}), got ${terrain.length}.`);
715
+ throw new Error(
716
+ `Expected terrain data of length ${size * size} (${size} x ${size}), got ${terrain.length}.`
717
+ );
648
718
  this.terrain = terrain;
649
719
  this.martini = martini;
650
720
  this.errors = new Float32Array(terrain.length);
@@ -753,24 +823,30 @@
753
823
  this._addTriangle(p0, p3, p1, t0, -1, -1);
754
824
  this._flush();
755
825
  }
826
+ // refine the mesh until its maximum error gets below the given one
756
827
  run(maxError = 1) {
757
828
  while (this.getMaxError() > maxError) {
758
829
  this.refine();
759
830
  }
760
831
  }
832
+ // refine the mesh with a single point
761
833
  refine() {
762
834
  this._step();
763
835
  this._flush();
764
836
  }
837
+ // max error of the current mesh
765
838
  getMaxError() {
766
839
  return this._errors[0];
767
840
  }
841
+ // root-mean-square deviation of the current mesh
768
842
  getRMSD() {
769
843
  return this._rmsSum > 0 ? Math.sqrt(this._rmsSum / (this.width * this.height)) : 0;
770
844
  }
845
+ // height value at a given position
771
846
  heightAt(x, y) {
772
847
  return this.data[this.width * y + x];
773
848
  }
849
+ // rasterize and queue all triangles that got added or updated in _step
774
850
  _flush() {
775
851
  const coords = this.coords;
776
852
  for (let i = 0; i < this._pendingLen; i++) {
@@ -778,10 +854,19 @@
778
854
  const a = 2 * this.triangles[t * 3 + 0];
779
855
  const b = 2 * this.triangles[t * 3 + 1];
780
856
  const c = 2 * this.triangles[t * 3 + 2];
781
- this._findCandidate(coords[a], coords[a + 1], coords[b], coords[b + 1], coords[c], coords[c + 1], t);
857
+ this._findCandidate(
858
+ coords[a],
859
+ coords[a + 1],
860
+ coords[b],
861
+ coords[b + 1],
862
+ coords[c],
863
+ coords[c + 1],
864
+ t
865
+ );
782
866
  }
783
867
  this._pendingLen = 0;
784
868
  }
869
+ // rasterize a triangle, find its max error, and queue it for processing
785
870
  _findCandidate(p0x, p0y, p1x, p1y, p2x, p2y, t) {
786
871
  const minX = Math.min(p0x, p1x, p2x);
787
872
  const minY = Math.min(p0y, p1y, p2y);
@@ -849,6 +934,7 @@
849
934
  this._rms[t] = rms;
850
935
  this._queuePush(t, maxError, rms);
851
936
  }
937
+ // process the next triangle in the queue, splitting it with a new point
852
938
  _step() {
853
939
  const t = this._queuePop();
854
940
  const e0 = t * 3 + 0;
@@ -884,11 +970,13 @@
884
970
  this._legalize(t2);
885
971
  }
886
972
  }
973
+ // add coordinates for a new vertex
887
974
  _addPoint(x, y) {
888
975
  const i = this.coords.length >> 1;
889
976
  this.coords.push(x, y);
890
977
  return i;
891
978
  }
979
+ // add or update a triangle in the mesh
892
980
  _addTriangle(a, b, c, ab, bc, ca, e = this.triangles.length) {
893
981
  const t = e / 3;
894
982
  this.triangles[e + 0] = a;
@@ -929,7 +1017,16 @@
929
1017
  const pl = this.triangles[al];
930
1018
  const p1 = this.triangles[bl];
931
1019
  const coords = this.coords;
932
- 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])) {
1020
+ if (!inCircle(
1021
+ coords[2 * p0],
1022
+ coords[2 * p0 + 1],
1023
+ coords[2 * pr],
1024
+ coords[2 * pr + 1],
1025
+ coords[2 * pl],
1026
+ coords[2 * pl + 1],
1027
+ coords[2 * p1],
1028
+ coords[2 * p1 + 1]
1029
+ )) {
933
1030
  return;
934
1031
  }
935
1032
  const hal = this._halfedges[al];
@@ -943,6 +1040,7 @@
943
1040
  this._legalize(t0 + 1);
944
1041
  this._legalize(t1 + 2);
945
1042
  }
1043
+ // handle a case where new vertex is on the edge of a triangle
946
1044
  _handleCollinear(pn, a) {
947
1045
  const a0 = a - a % 3;
948
1046
  const al = a0 + (a + 1) % 3;
@@ -976,6 +1074,7 @@
976
1074
  this._legalize(t2);
977
1075
  this._legalize(t3);
978
1076
  }
1077
+ // priority queue methods
979
1078
  _queuePush(t, error, rms) {
980
1079
  const i = this._queue.length;
981
1080
  this._queueIndices[t] = i;
@@ -1109,11 +1208,16 @@
1109
1208
  let attributes = getMeshAttributes2(vertices, terrain, width, height, bounds);
1110
1209
  const boundingBox = getMeshBoundingBox(attributes);
1111
1210
  if (terrainOptions.skirtHeight) {
1112
- const { attributes: newAttributes, triangles: newTriangles } = addSkirt(attributes, triangles, terrainOptions.skirtHeight);
1211
+ const { attributes: newAttributes, triangles: newTriangles } = addSkirt(
1212
+ attributes,
1213
+ triangles,
1214
+ terrainOptions.skirtHeight
1215
+ );
1113
1216
  attributes = newAttributes;
1114
1217
  triangles = newTriangles;
1115
1218
  }
1116
1219
  return {
1220
+ // Data return by this loader implementation
1117
1221
  loaderData: {
1118
1222
  header: {}
1119
1223
  },
@@ -1122,6 +1226,7 @@
1122
1226
  boundingBox
1123
1227
  },
1124
1228
  mode: 4,
1229
+ // TRIANGLES
1125
1230
  indices: { value: Uint32Array.from(triangles), size: 1 },
1126
1231
  attributes
1127
1232
  };
@@ -1183,11 +1288,12 @@
1183
1288
  return {
1184
1289
  POSITION: { value: positions, size: 3 },
1185
1290
  TEXCOORD_0: { value: texCoords, size: 2 }
1291
+ // NORMAL: {}, - optional, but creates the high poly look with lighting
1186
1292
  };
1187
1293
  }
1188
1294
 
1189
1295
  // src/lib/utils/version.ts
1190
- var VERSION = true ? "4.0.0-beta.2" : "latest";
1296
+ var VERSION = true ? "4.0.0-beta.3" : "latest";
1191
1297
 
1192
1298
  // src/terrain-loader.ts
1193
1299
  var TerrainLoader = {
@@ -1,4 +1,4 @@
1
- import { VERSION } from './lib/utils/version';
1
+ import { VERSION } from "./lib/utils/version.js";
2
2
  export const TerrainLoader = {
3
3
  name: 'Terrain',
4
4
  id: 'terrain',
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terrain-loader.js","names":["VERSION","TerrainLoader","name","id","module","version","worker","extensions","mimeTypes","options","terrain","tesselator","bounds","undefined","meshMaxError","elevationDecoder","rScaler","gScaler","bScaler","offset","skirtHeight"],"sources":["../src/terrain-loader.ts"],"sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\nimport type {ImageLoaderOptions} from '@loaders.gl/images';\nimport {VERSION} from './lib/utils/version';\n\nimport {TerrainOptions} from './lib/parse-terrain';\nimport {Mesh} from '@loaders.gl/schema';\n\nexport type TerrainLoaderOptions = ImageLoaderOptions & {\n terrain?: TerrainOptions;\n};\n\n/**\n * Worker loader for image encoded terrain\n */\nexport const TerrainLoader: Loader<Mesh, never, TerrainLoaderOptions> = {\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"],"mappings":"SAEQA,OAAO;AAYf,OAAO,MAAMC,aAAwD,GAAG;EACtEC,IAAI,EAAE,SAAS;EACfC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEL,OAAO;EAChBM,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;EAClEC,SAAS,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,CAAC;EAC9EC,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,UAAU,EAAE,MAAM;MAClBC,MAAM,EAAEC,SAAU;MAClBC,YAAY,EAAE,EAAE;MAChBC,gBAAgB,EAAE;QAChBC,OAAO,EAAE,CAAC;QACVC,OAAO,EAAE,CAAC;QACVC,OAAO,EAAE,CAAC;QACVC,MAAM,EAAE;MACV,CAAC;MACDC,WAAW,EAAEP;IACf;EACF;AACF,CAAC"}