@loaders.gl/i3s 4.0.0-alpha.17 → 4.0.0-alpha.19

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