@loaders.gl/i3s 4.0.0-alpha.16 → 4.0.0-alpha.18

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 (57) hide show
  1. package/dist/dist.min.js +97 -58
  2. package/dist/es5/arcgis-webscene-loader.js +1 -1
  3. package/dist/es5/i3s-attribute-loader.js +1 -1
  4. package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
  5. package/dist/es5/i3s-content-loader.js +1 -1
  6. package/dist/es5/i3s-loader.js +6 -6
  7. package/dist/es5/i3s-loader.js.map +1 -1
  8. package/dist/es5/i3s-node-page-loader.js +1 -1
  9. package/dist/es5/i3s-slpk-loader.js +1 -1
  10. package/dist/es5/index.js.map +1 -1
  11. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +9 -5
  12. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  13. package/dist/es5/lib/parsers/parse-i3s.js +29 -19
  14. package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
  15. package/dist/es5/lib/utils/url-utils.js +3 -3
  16. package/dist/es5/lib/utils/url-utils.js.map +1 -1
  17. package/dist/es5/types.js.map +1 -1
  18. package/dist/esm/arcgis-webscene-loader.js +1 -1
  19. package/dist/esm/i3s-attribute-loader.js +1 -1
  20. package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
  21. package/dist/esm/i3s-content-loader.js +1 -1
  22. package/dist/esm/i3s-loader.js +3 -4
  23. package/dist/esm/i3s-loader.js.map +1 -1
  24. package/dist/esm/i3s-node-page-loader.js +1 -1
  25. package/dist/esm/i3s-slpk-loader.js +1 -1
  26. package/dist/esm/index.js.map +1 -1
  27. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +9 -5
  28. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  29. package/dist/esm/lib/parsers/parse-i3s.js +20 -10
  30. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
  31. package/dist/esm/lib/utils/url-utils.js +2 -3
  32. package/dist/esm/lib/utils/url-utils.js.map +1 -1
  33. package/dist/esm/types.js.map +1 -1
  34. package/dist/i3s-content-worker-node.js +47 -47
  35. package/dist/i3s-content-worker-node.js.map +3 -3
  36. package/dist/i3s-content-worker.js +53 -26
  37. package/dist/i3s-loader.js +2 -4
  38. package/dist/index.d.ts +2 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +5 -3
  41. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
  42. package/dist/lib/helpers/i3s-nodepages-tiles.js +7 -5
  43. package/dist/lib/parsers/parse-i3s.d.ts +2 -2
  44. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
  45. package/dist/lib/parsers/parse-i3s.js +21 -12
  46. package/dist/lib/utils/url-utils.d.ts +5 -4
  47. package/dist/lib/utils/url-utils.d.ts.map +1 -1
  48. package/dist/lib/utils/url-utils.js +5 -4
  49. package/dist/types.d.ts +102 -34
  50. package/dist/types.d.ts.map +1 -1
  51. package/package.json +9 -9
  52. package/src/i3s-loader.ts +2 -4
  53. package/src/index.ts +4 -0
  54. package/src/lib/helpers/i3s-nodepages-tiles.ts +16 -9
  55. package/src/lib/parsers/parse-i3s.ts +25 -16
  56. package/src/lib/utils/url-utils.ts +6 -5
  57. package/src/types.ts +99 -35
package/src/types.ts CHANGED
@@ -1,17 +1,28 @@
1
1
  import type {Matrix4, Quaternion, Vector3} from '@math.gl/core';
2
2
  import type {TypedArray, MeshAttribute, TextureLevel} from '@loaders.gl/schema';
3
- import {Tile3D, Tileset3D} from '@loaders.gl/tiles';
3
+ import {TILESET_TYPE, TILE_REFINEMENT, TILE_TYPE, Tile3D, Tileset3D} from '@loaders.gl/tiles';
4
+ import I3SNodePagesTiles from './lib/helpers/i3s-nodepages-tiles';
4
5
 
5
6
  export type COLOR = [number, number, number, number];
6
7
 
7
8
  /**
8
- * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md
9
+ * Extension of SceneLayer3D JSON with postprocessed loader data
9
10
  */
10
- // TODO Replace "[key: string]: any" with actual defenition
11
11
  export interface I3STilesetHeader extends SceneLayer3D {
12
12
  /** Not in spec, but is necessary for woking */
13
13
  url?: string;
14
- [key: string]: any;
14
+ /** Base path that non-absolute paths in tileset are relative to. */
15
+ basePath?: string;
16
+ /** root node metadata */
17
+ root: I3STileHeader;
18
+ /** instance of the NodePages to tiles loader */
19
+ nodePagesTile?: I3SNodePagesTiles;
20
+ /** Type of the tileset */
21
+ type: TILESET_TYPE.I3S;
22
+ /** LOD metric type per I3S spec*/
23
+ lodMetricType?: string;
24
+ /** LOD metric value */
25
+ lodMetricValue?: number;
15
26
  }
16
27
  /** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePage.cmn.md */
17
28
  export type NodePage = {
@@ -57,20 +68,62 @@ type meshAttribute = {
57
68
  resource: number;
58
69
  };
59
70
 
71
+ /**
72
+ * Texture format
73
+ * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/textureSetDefinitionFormat.cmn.md
74
+ */
60
75
  export type I3STextureFormat = 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2';
61
76
 
62
- // TODO Replace "[key: string]: any" with actual defenition
63
- export type I3STileHeader = {
64
- isDracoGeometry: boolean;
65
- textureUrl?: string;
66
- url?: string;
67
- textureFormat?: I3STextureFormat;
68
- textureLoaderOptions?: any;
69
- materialDefinition?: I3SMaterialDefinition;
77
+ /** Postprocessed I3S Node */
78
+ export type I3STileHeader = I3SMinimalNodeData & {
79
+ /** MBS per I3S spec */
70
80
  mbs: Mbs;
71
- obb?: Obb;
81
+ /** Material definition from the layer metadata per I3S spec */
82
+ materialDefinition?: I3SMaterialDefinition;
83
+ /** Bounding volume converted to 3DTiles format. It is generic for `tile` module */
84
+ boundingVolume: {box?: number[]; sphere?: number[]};
85
+ /** LOD metric selected for usage */
86
+ lodMetricType?: string;
87
+ /** LOD metric value */
88
+ lodMetricValue?: number;
89
+ /** Tile content type */
90
+ type: TILE_TYPE.MESH;
91
+ /** Tile refinement type. I3S supports only `REPLACE` */
92
+ refine: TILE_REFINEMENT.REPLACE;
93
+ };
94
+
95
+ /**
96
+ * Minimal I3S node data is needed for loading
97
+ * These data can come from 3DNodeIndexDocument (I3S spec) or from `I3SNodePagesTiles` instance
98
+ * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
99
+ */
100
+ export type I3SMinimalNodeData = {
101
+ /** Node ID */
102
+ id: string;
103
+ /** Node base path */
104
+ url?: string;
105
+ /** LOD selection metrics */
72
106
  lodSelection?: LodSelection[];
73
- [key: string]: any;
107
+ // OBB per I3S spec
108
+ obb?: Obb;
109
+ /** MBS per I3S spec */
110
+ mbs?: Mbs;
111
+ /** Geometry content URL */
112
+ contentUrl?: string;
113
+ /** Texture image URL */
114
+ textureUrl?: string;
115
+ /** Feature attributes URLs */
116
+ attributeUrls?: string[];
117
+ /** Material definition from I3S layer metadata */
118
+ materialDefinition?: I3SMaterialDefinition;
119
+ /** Texture format per I3S spec */
120
+ textureFormat: I3STextureFormat;
121
+ /** Loader options for texture loader. The loader might be `CompressedTextureLoader` for `dds`, BasisLoader for `ktx2` or ImageLoader for `jpg`and `png` */
122
+ textureLoaderOptions?: {[key: string]: any};
123
+ /** Child Nodes references */
124
+ children: NodeReference[];
125
+ /** Is the node has Draco compressed geometry */
126
+ isDracoGeometry: boolean;
74
127
  };
75
128
 
76
129
  export type I3SParseOptions = {
@@ -96,13 +149,20 @@ export type I3SParseOptions = {
96
149
  * Supported coordinate systems: METER_OFFSETS, LNGLAT_OFFSETS
97
150
  */
98
151
  coordinateSystem?: number;
152
+ /** Options to colorize 3DObjects by attribute value */
99
153
  colorsByAttribute?: {
154
+ /** Feature attribute name */
100
155
  attributeName: string;
156
+ /** Minimum attribute value */
101
157
  minValue: number;
158
+ /** Maximum attribute value */
102
159
  maxValue: number;
160
+ /** Minimum color. 3DObject will be colorized with gradient from `minColor to `maxColor` */
103
161
  minColor: COLOR;
162
+ /** Maximum color. 3DObject will be colorized with gradient from `minColor to `maxColor` */
104
163
  maxColor: COLOR;
105
- mode: string;
164
+ /** Colorization mode. `replace` - replace vertex colors with a new colors, `multiply` - multiply vertex colors with new colors */
165
+ mode: 'multiply' | 'replace';
106
166
  };
107
167
 
108
168
  /** @deprecated */
@@ -157,12 +217,20 @@ export type BoundingVolumes = {
157
217
  obb: Obb;
158
218
  };
159
219
 
220
+ /**
221
+ * Oriented bounding box per I3S spec
222
+ * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md
223
+ */
160
224
  export type Obb = {
161
225
  center: number[] | Vector3;
162
226
  halfSize: number[] | Vector3;
163
227
  quaternion: number[] | Quaternion;
164
228
  };
165
229
 
230
+ /**
231
+ * Minimum bounding sphere per I3S spec
232
+ * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md#properties
233
+ */
166
234
  export type Mbs = [number, number, number, number];
167
235
 
168
236
  /** SceneLayer3D based on I3S specification - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md */
@@ -370,36 +438,32 @@ export type Node3DIndexDocument = {
370
438
  };
371
439
 
372
440
  /**
373
- * Minimal I3S node data is needed for loading
441
+ * LOD selection metrics per I3S spec
442
+ * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/lodSelection.cmn.md
374
443
  */
375
- export type I3SMinimalNodeData = {
376
- id: string;
377
- url?: string;
378
- transform?: number[];
379
- lodSelection?: LodSelection[];
380
- obb?: Obb;
381
- mbs?: Mbs;
382
- contentUrl?: string;
383
- textureUrl?: string;
384
- attributeUrls?: string[];
385
- materialDefinition?: I3SMaterialDefinition;
386
- textureFormat?: I3STextureFormat;
387
- textureLoaderOptions?: {[key: string]: any};
388
- children?: NodeReference[];
389
- isDracoGeometry: boolean;
390
- };
391
-
392
444
  export type LodSelection = {
445
+ /** */
393
446
  metricType?: string;
394
447
  maxError: number;
395
448
  };
396
449
 
450
+ /**
451
+ * Node reference per I3S spec
452
+ * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/nodeReference.cmn.md
453
+ */
397
454
  export type NodeReference = {
455
+ /** Tree Key ID of the referenced node represented as string. */
398
456
  id: string;
457
+ /** Version (store update session ID) of the referenced node. */
399
458
  version?: string;
459
+ /** An array of four doubles, corresponding to x, y, z and radius of the minimum bounding sphere of a node. */
400
460
  mbs?: Mbs;
461
+ /** Describes oriented bounding box. */
401
462
  obb?: Obb;
463
+ /** Number of values per element. */
402
464
  href?: string;
465
+ /** Number of features in the referenced node and its descendants, down to the leaf nodes. */
466
+ featureCount?: number;
403
467
  };
404
468
 
405
469
  export type Resource = {
@@ -789,7 +853,7 @@ type TextureSetDefinition = {
789
853
 
790
854
  /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryDefinition.cmn.md */
791
855
  type GeometryDefinition = {
792
- topology: 'triangle' | string;
856
+ topology?: 'triangle';
793
857
  geometryBuffers: GeometryBuffer[];
794
858
  };
795
859
  /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryBuffer.cmn.md */
@@ -805,7 +869,7 @@ type GeometryBuffer = {
805
869
  compressedAttributes?: {encoding: string; attributes: string[]};
806
870
  };
807
871
 
808
- type GeometryBufferItem = {type: string; component: number; encoding?: string; binding: string};
872
+ type GeometryBufferItem = {type: string; component: number; encoding?: string; binding?: string};
809
873
 
810
874
  type AttributeValue = {valueType: string; encoding?: string; valuesPerElement?: number};
811
875