@loaders.gl/i3s 3.1.0-beta.7 → 3.1.0

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 (86) hide show
  1. package/dist/bundle.js +126 -139
  2. package/dist/es5/bundle.js +1 -1
  3. package/dist/es5/bundle.js.map +1 -1
  4. package/dist/es5/i3s-attribute-loader.js +147 -62
  5. package/dist/es5/i3s-attribute-loader.js.map +1 -1
  6. package/dist/es5/i3s-building-scene-layer-loader.js +36 -8
  7. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
  8. package/dist/es5/i3s-content-loader.js +36 -10
  9. package/dist/es5/i3s-content-loader.js.map +1 -1
  10. package/dist/es5/i3s-loader.js +175 -51
  11. package/dist/es5/i3s-loader.js.map +1 -1
  12. package/dist/es5/i3s-node-page-loader.js +51 -8
  13. package/dist/es5/i3s-node-page-loader.js.map +1 -1
  14. package/dist/es5/index.js +6 -6
  15. package/dist/es5/index.js.map +1 -1
  16. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +328 -173
  17. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  18. package/dist/es5/lib/parsers/constants.js +9 -28
  19. package/dist/es5/lib/parsers/constants.js.map +1 -1
  20. package/dist/es5/lib/parsers/parse-i3s-attribute.js +69 -27
  21. package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
  22. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +62 -28
  23. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
  24. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +416 -314
  25. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  26. package/dist/es5/lib/parsers/parse-i3s.js +109 -49
  27. package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
  28. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +8 -4
  29. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
  30. package/dist/es5/lib/utils/url-utils.js +14 -17
  31. package/dist/es5/lib/utils/url-utils.js.map +1 -1
  32. package/dist/es5/types.js +10 -2
  33. package/dist/es5/types.js.map +1 -1
  34. package/dist/esm/i3s-attribute-loader.js +1 -1
  35. package/dist/esm/i3s-attribute-loader.js.map +1 -1
  36. package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
  37. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
  38. package/dist/esm/i3s-content-loader.js +1 -1
  39. package/dist/esm/i3s-content-loader.js.map +1 -1
  40. package/dist/esm/i3s-loader.js +1 -1
  41. package/dist/esm/i3s-loader.js.map +1 -1
  42. package/dist/esm/i3s-node-page-loader.js +1 -1
  43. package/dist/esm/i3s-node-page-loader.js.map +1 -1
  44. package/dist/esm/index.js.map +1 -1
  45. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +33 -23
  46. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  47. package/dist/esm/lib/parsers/constants.js +2 -18
  48. package/dist/esm/lib/parsers/constants.js.map +1 -1
  49. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +44 -61
  50. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  51. package/dist/esm/lib/parsers/parse-i3s.js +40 -25
  52. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
  53. package/dist/esm/lib/utils/url-utils.js +2 -3
  54. package/dist/esm/lib/utils/url-utils.js.map +1 -1
  55. package/dist/esm/types.js +7 -0
  56. package/dist/esm/types.js.map +1 -1
  57. package/dist/i3s-content-worker.js +62 -81
  58. package/dist/index.d.ts +1 -1
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +20 -20
  61. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
  62. package/dist/lib/helpers/i3s-nodepages-tiles.js +33 -32
  63. package/dist/lib/parsers/constants.d.ts +1 -17
  64. package/dist/lib/parsers/constants.d.ts.map +1 -1
  65. package/dist/lib/parsers/constants.js +3 -21
  66. package/dist/lib/parsers/parse-i3s-attribute.d.ts +1 -1
  67. package/dist/lib/parsers/parse-i3s-tile-content.d.ts +2 -2
  68. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  69. package/dist/lib/parsers/parse-i3s-tile-content.js +35 -61
  70. package/dist/lib/parsers/parse-i3s.d.ts +5 -3
  71. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
  72. package/dist/lib/parsers/parse-i3s.js +37 -32
  73. package/dist/lib/utils/url-utils.d.ts +6 -6
  74. package/dist/lib/utils/url-utils.d.ts.map +1 -1
  75. package/dist/lib/utils/url-utils.js +5 -5
  76. package/dist/types.d.ts +289 -74
  77. package/dist/types.d.ts.map +1 -1
  78. package/dist/types.js +6 -1
  79. package/package.json +8 -8
  80. package/src/index.ts +3 -3
  81. package/src/lib/helpers/i3s-nodepages-tiles.ts +71 -55
  82. package/src/lib/parsers/constants.ts +2 -22
  83. package/src/lib/parsers/parse-i3s-tile-content.ts +74 -103
  84. package/src/lib/parsers/parse-i3s.ts +48 -37
  85. package/src/lib/utils/url-utils.ts +7 -7
  86. package/src/types.ts +302 -93
package/src/types.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type {GLTFMaterial} from '@loaders.gl/gltf';
2
- import type {Matrix4, Quaternion, Vector3} from '@math.gl/core';
3
- import type {Mesh} from '@loaders.gl/gltf';
4
- import type {TypedArray} from '@loaders.gl/schema';
2
+ import type {TypedArray, MeshAttribute} from '@loaders.gl/schema';
3
+ import type {TextureLevel} from '@loaders.gl/textures/src/types';
4
+ import {Matrix4, Quaternion, Vector3} from '@math.gl/core';
5
5
 
6
6
  export enum DATA_TYPE {
7
7
  UInt8 = 'UInt8',
@@ -18,35 +18,74 @@ export enum DATA_TYPE {
18
18
  * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md
19
19
  */
20
20
  // TODO Replace "[key: string]: any" with actual defenition
21
- export type Tileset = {
22
- /**
23
- * The store object describes the exact physical storage of a layer and enables the client to detect when multiple layers are served from the same store.
24
- */
25
- store: Store;
21
+ export interface I3STilesetHeader extends SceneLayer3D {
22
+ /** Not in spec, but is necessary for woking */
23
+ url?: string;
26
24
  [key: string]: any;
25
+ }
26
+ /** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePage.cmn.md */
27
+ export type NodePage = {
28
+ /** Array of nodes. */
29
+ nodes: NodeInPage[];
27
30
  };
28
- // TODO Replace "[key: string]: any" with actual defenition
29
- export type NodePage = {[key: string]: any};
30
- // TODO Replace "[key: string]: any" with actual defenition
31
- export type Tile = {
32
- content: TileContent;
33
- isDracoGeometry: boolean;
34
- textureUrl: string;
35
- url: string;
31
+ /**
32
+ * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/mesh.cmn.md
33
+ */
34
+ type NodeMesh = {
36
35
  /**
37
- * Resource reference describing a featureData document.
36
+ * The material definition.
38
37
  */
39
- attributeData: Resource[];
40
- textureFormat: 'jpeg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2';
41
- textureLoaderOptions: any;
42
- materialDefinition: GLTFMaterial;
38
+ material: MeshMaterial;
39
+ /** The geometry definition. */
40
+ geometry: MeshGeometry;
41
+ /** The attribute set definition. */
42
+ attribute: meshAttribute;
43
+ };
44
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshMaterial.cmn.md */
45
+ export type MeshMaterial = {
46
+ /** The index in layer.materialDefinitions array. */
47
+ definition: number;
48
+ /** Resource id for the material textures. i.e: layers/0/nodes/{material.resource}/textures/{tex_name}. Is required if material declares any textures. */
49
+ resource?: number;
50
+ /** Estimated number of texel for the highest resolution base color texture. */
51
+ texelCountHint?: number;
52
+ };
53
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshGeometry.cmn.md */
54
+ export type MeshGeometry = {
55
+ /** The index in layer.geometryDefinitions array */
56
+ definition: number;
57
+ /** The resource locator to be used to query geometry resources: layers/0/nodes/{this.resource}/geometries/{layer.geometryDefinitions[this.definition].geometryBuffers[0 or 1]}. */
58
+ resource: number;
59
+ /** Number of vertices in the geometry buffer of this mesh for the umcompressed mesh buffer. Please note that Draco compressed meshes may have less vertices due to de-duplication (actual number of vertices is part of the Draco binary blob). Default=0 */
60
+ vertexCount?: number;
61
+ /** Number of features for this mesh. Default=0. (Must omit or set to 0 if mesh doesn't use features.) */
62
+ featureCount?: number;
63
+ };
64
+ /** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshAttribute.cmn.md */
65
+ type meshAttribute = {
66
+ /** The resource identifier to be used to locate attribute resources of this mesh. i.e. layers/0/nodes/<resource id>/attributes/... */
67
+ resource: number;
68
+ };
69
+
70
+ export type I3STextureFormat = 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2';
71
+
72
+ // TODO Replace "[key: string]: any" with actual defenition
73
+ export type I3STileHeader = {
74
+ isDracoGeometry: boolean;
75
+ textureUrl?: string;
76
+ url?: string;
77
+ textureFormat?: I3STextureFormat;
78
+ textureLoaderOptions?: any;
79
+ materialDefinition?: I3SMaterialDefinition;
43
80
  mbs: Mbs;
81
+ obb?: Obb;
82
+ lodSelection?: LodSelection[];
83
+ [key: string]: any;
44
84
  };
45
85
  // TODO Replace "[key: string]: any" with actual defenition
46
- export type TileContent = {
47
- featureData: DefaultGeometrySchema;
48
- attributes: NormalizedAttributes;
49
- indices: NormalizedAttribute | null;
86
+ export type I3STileContent = {
87
+ attributes: I3SMeshAttributes;
88
+ indices: TypedArray | null;
50
89
  featureIds: number[] | TypedArray;
51
90
  vertexCount: number;
52
91
  modelMatrix: Matrix4;
@@ -63,7 +102,7 @@ export type TileContentTexture =
63
102
  mipmaps: boolean;
64
103
  width: number;
65
104
  height: number;
66
- data: any;
105
+ data: TextureLevel[];
67
106
  }
68
107
  | null;
69
108
 
@@ -80,28 +119,149 @@ export type Obb = {
80
119
 
81
120
  export type Mbs = [number, number, number, number];
82
121
 
83
- // SceneLayer3D based on I3S specification https://github.com/Esri/i3s-spec/tree/master/docs/1.7
84
- // TODO Add description for each property
85
-
122
+ /** SceneLayer3D based on I3S specification - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md */
86
123
  export type SceneLayer3D = {
124
+ /** Unique numeric ID of the layer. */
87
125
  id: number;
126
+ /** The relative URL to the 3DSceneLayerResource. Only present as part of the SceneServiceInfo resource. */
88
127
  href?: string;
89
- layerType: string;
128
+ /** The user-visible layer type */
129
+ layerType: '3DObject' | 'IntegratedMesh';
130
+ /** The spatialReference of the layer including the vertical coordinate reference system (CRS). Well Known Text (WKT) for CRS is included to support custom CRS. */
90
131
  spatialReference?: SpatialReference;
132
+ /** Enables consuming clients to quickly determine whether this layer is compatible (with respect to its horizontal and vertical coordinate system) with existing content. */
91
133
  heightModelInfo?: HeightModelInfo;
134
+ /** The ID of the last update session in which any resource belonging to this layer has been updated. */
92
135
  version: string;
136
+ /** The name of this layer. */
93
137
  name?: string;
138
+ /** The time of the last update. */
139
+ serviceUpdateTimeStamp?: {lastUpdate: number};
140
+ /** The display alias to be used for this layer. */
141
+ alias?: string;
142
+ /** Description string for this layer. */
143
+ description?: string;
144
+ /** Copyright and usage information for the data in this layer. */
145
+ copyrightText?: string;
146
+ /** Capabilities supported by this layer. */
94
147
  capabilities: string[];
148
+ /** ZFactor to define conversion factor for elevation unit. */
149
+ ZFactor?: number;
150
+ /** Indicates if any styling information represented as drawingInfo is captured as part of the binary mesh representation. */
151
+ cachedDrawingInfo?: CachedDrawingInfo;
152
+ /** An object containing drawing information. */
153
+ drawingInfo?: DrawingInfo;
154
+ /** An object containing elevation drawing information. If absent, any content of the scene layer is drawn at its z coordinate. */
155
+ elevationInfo?: ElevationInfo;
156
+ /** PopupInfo of the scene layer. */
157
+ popupInfo?: PopupInfo;
158
+ /** Indicates if client application will show the popup information. Default is FALSE. */
159
+ disablePopup: boolean;
160
+ /**
161
+ * The store object describes the exact physical storage of a layer and
162
+ * enables the client to detect when multiple layers are served from
163
+ * the same store.
164
+ */
95
165
  store: Store;
96
- nodePages?: NodePages;
97
- materialDefinitions?: GLTFMaterial[];
98
- textureSetDefinitions?: TextureSetDefinition[];
99
- geometryDefinitions?: GeometryDefinitions;
100
- attributeStorageInfo?: AttributeStorageInfo[];
166
+ /** A collection of objects that describe each attribute field regarding its field name, datatype, and a user friendly name {name,type,alias}. */
101
167
  fields?: Field[];
102
- popupInfo?: PopupInfo;
168
+ /** Provides the schema and layout used for storing attribute content in binary format in I3S. */
169
+ attributeStorageInfo?: AttributeStorageInfo[];
170
+ /** Contains the statistical information for a layer. */
171
+ statisticsInfo?: StatisticsInfo[];
172
+ /** The paged-access index description. */
173
+ nodePages?: NodePageDefinition;
174
+ /** List of materials classes used in this layer. */
175
+ materialDefinitions?: I3SMaterialDefinition[];
176
+ /** Defines the set of textures that can be referenced by meshes. */
177
+ textureSetDefinitions?: TextureSetDefinition[];
178
+ /** Define the layouts of mesh geometry and its attributes */
179
+ geometryDefinitions?: GeometryDefinition[];
180
+ /** 3D extent. */
181
+ fullExtent?: FullExtent;
182
+ };
183
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/cachedDrawingInfo.cmn.md */
184
+ export type CachedDrawingInfo = {
185
+ /** If true, the drawingInfo is captured as part of the binary scene layer representation. */
186
+ color: boolean;
187
+ };
188
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/drawingInfo.cmn.md */
189
+ export type DrawingInfo = {
190
+ /** An object defining the symbology for the layer. See more information about supported renderer types in ArcGIS clients. */
191
+ renderer: any;
192
+ /** Scale symbols for the layer. */
193
+ scaleSymbols: boolean;
194
+ };
195
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/elevationInfo.cmn.md */
196
+ export type ElevationInfo = {
197
+ mode: 'relativeToGround' | 'absoluteHeight' | 'onTheGround' | 'relativeToScene';
198
+ /** Offset is always added to the result of the above logic except for onTheGround where offset is ignored. */
199
+ offset: number;
200
+ /** A string value indicating the unit for the values in elevationInfo */
201
+ unit: string;
202
+ };
203
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/statisticsInfo.cmn.md */
204
+ export type StatisticsInfo = {
205
+ /** Key indicating the resource of the statistics. */
206
+ key: string;
207
+ /** Name of the field of the statistical information. */
208
+ name: string;
209
+ /** The URL to the statistics information. */
210
+ href: string;
103
211
  };
104
-
212
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePageDefinition.cmn.md */
213
+ export type NodePageDefinition = {
214
+ /** Number of nodes per page for this layer. Must be a power-of-two less than 4096 */
215
+ nodesPerPage: number;
216
+ /** Index of the root node. Default = 0. */
217
+ rootIndex?: number;
218
+ /** Defines the meaning of nodes[].lodThreshold for this layer. */
219
+ lodSelectionMetricType: 'maxScreenThresholdSQ';
220
+ };
221
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitions.cmn.md */
222
+ export type I3SMaterialDefinition = {
223
+ /** A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology. When not specified, all the default values of pbrMetallicRoughness apply. */
224
+ pbrMetallicRoughness: I3SPbrMetallicRoughness;
225
+ /** The normal texture map. */
226
+ normalTexture: I3SMaterialTexture;
227
+ /** The occlusion texture map. */
228
+ occlusionTexture: I3SMaterialTexture;
229
+ /** The emissive texture map. */
230
+ emissiveTexture: I3SMaterialTexture;
231
+ /** The emissive color of the material. */
232
+ emissiveFactor: [number, number, number];
233
+ /** Defines the meaning of the alpha-channel/alpha-mask. */
234
+ alphaMode: 'opaque' | 'mask' | 'blend';
235
+ /** The alpha cutoff value of the material. */
236
+ alphaCutoff: number;
237
+ /** Specifies whether the material is double sided. */
238
+ doubleSided: boolean;
239
+ /** Winding order is counterclockwise. */
240
+ cullFace: 'none' | 'front' | 'back';
241
+ };
242
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/pbrMetallicRoughness.cmn.md */
243
+ export type I3SPbrMetallicRoughness = {
244
+ /** The material's base color factor. default=[1,1,1,1] */
245
+ baseColorFactor: [number, number, number, number];
246
+ /** The base color texture. */
247
+ baseColorTexture: I3SMaterialTexture;
248
+ /** the metalness of the material. default=1.0 */
249
+ metallicFactor: number;
250
+ /** the roughness of the material. default=1.0 */
251
+ roughnessFactor: number;
252
+ /** the metallic-roughness texture. */
253
+ metallicRoughnessTexture: I3SMaterialTexture;
254
+ };
255
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialTexture.cmn.md */
256
+ export type I3SMaterialTexture = {
257
+ /** The index in layer.textureSetDefinitions. */
258
+ textureSetDefinitionId: number;
259
+ /** The set index of texture's TEXCOORD attribute used for texture coordinate mapping. Default is 0. Deprecated. */
260
+ texCoord?: number;
261
+ /** The normal texture: scalar multiplier applied to each normal vector of the normal texture. For occlusion texture,scalar multiplier controlling the amount of occlusion applied. Default=1 */
262
+ factor?: number;
263
+ };
264
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/attributeStorageInfo.cmn.md */
105
265
  export type AttributeStorageInfo = {
106
266
  key: string;
107
267
  name: string;
@@ -112,6 +272,7 @@ export type AttributeStorageInfo = {
112
272
  objectIds?: AttributeValue;
113
273
  };
114
274
 
275
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/field.cmn.md */
115
276
  export type Field = {
116
277
  name: string;
117
278
  type: ESRIField;
@@ -130,6 +291,7 @@ export type ESRIField =
130
291
  | 'esriFieldTypeSmallInteger'
131
292
  | 'esriFieldTypeString';
132
293
 
294
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/popupInfo.cmn.md */
133
295
  export type PopupInfo = {
134
296
  title?: string;
135
297
  description?: string;
@@ -149,7 +311,7 @@ export type Node3DIndexDocument = {
149
311
  level?: number;
150
312
  mbs?: Mbs;
151
313
  obb?: Obb;
152
- lodSelection?: LodSelection;
314
+ lodSelection?: LodSelection[];
153
315
  children?: NodeReference[];
154
316
  neighbors?: NodeReference[];
155
317
  parentNode?: NodeReference;
@@ -162,6 +324,26 @@ export type Node3DIndexDocument = {
162
324
  expires?: string;
163
325
  };
164
326
 
327
+ /**
328
+ * Minimal I3S node data is needed for loading
329
+ */
330
+ export type I3SMinimalNodeData = {
331
+ id: string;
332
+ url?: string;
333
+ transform?: number[];
334
+ lodSelection?: LodSelection[];
335
+ obb?: Obb;
336
+ mbs?: Mbs;
337
+ contentUrl?: string;
338
+ textureUrl?: string;
339
+ attributeUrls?: string[];
340
+ materialDefinition?: I3SMaterialDefinition;
341
+ textureFormat?: I3STextureFormat;
342
+ textureLoaderOptions?: {[key: string]: any};
343
+ children?: NodeReference[];
344
+ isDracoGeometry: boolean;
345
+ };
346
+
165
347
  export type LodSelection = {
166
348
  metricType?: string;
167
349
  maxError: number;
@@ -185,28 +367,36 @@ export type Resource = {
185
367
  nodePath?: string;
186
368
  };
187
369
 
188
- export type I3SGeometry = {
189
- geometry: ArrayBuffer | null;
190
- compressedGeometry?: ArrayBuffer | null;
191
- texture: any | null;
192
- sharedResources: SharedResources | null;
193
- meshMaterial?: GLTFMaterial | null;
194
- vertexCount: number | null;
195
- attributes: any | null;
196
- featureCount: number | null;
197
- geometryBuffer?: ArrayBuffer;
198
- };
199
-
200
370
  export type MaxScreenThresholdSQ = {
201
371
  maxError: number;
202
372
  };
203
373
 
374
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/node.cmn.md */
204
375
  export type NodeInPage = {
205
- index?: number;
206
- lodThreshold: number;
376
+ /**
377
+ * The index in the node array. May be different than material, geometry and attribute resource id. See mesh for more information.
378
+ */
379
+ index: number;
380
+ /**
381
+ * The index of the parent node in the node array.
382
+ */
383
+ parentIndex?: number;
384
+ /**
385
+ * When to switch LoD. See https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePageDefinition.cmn.md for more information.
386
+ */
387
+ lodThreshold?: number;
388
+ /**
389
+ * Oriented bounding box for this node.
390
+ */
207
391
  obb: Obb;
208
- children: any[];
209
- mesh: Mesh;
392
+ /**
393
+ * index of the children nodes indices.
394
+ */
395
+ children?: number[];
396
+ /**
397
+ * The mesh for this node. WARNING: only SINGLE mesh is supported at version 1.7 (i.e. length must be 0 or 1).
398
+ */
399
+ mesh?: NodeMesh;
210
400
  };
211
401
 
212
402
  export type SharedResources = {
@@ -215,7 +405,7 @@ export type SharedResources = {
215
405
  nodePath: string;
216
406
  };
217
407
 
218
- export type TextureImage = {
408
+ type TextureImage = {
219
409
  id: string;
220
410
  size?: number;
221
411
  pixelInWorldUnits?: number;
@@ -323,21 +513,34 @@ type FilterModeWireFrame = {
323
513
  edges: Edges;
324
514
  };
325
515
 
326
- type SpatialReference = {
327
- wkid: number;
516
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/spatialReference.cmn.md */
517
+ export type SpatialReference = {
518
+ /** The current WKID value of the vertical coordinate system. */
519
+ latestVcsWkid: number;
520
+ /** dentifies the current WKID value associated with the same spatial reference. */
328
521
  latestWkid: number;
522
+ /** The WKID value of the vertical coordinate system. */
329
523
  vcsWkid: number;
330
- latestVcsWkid: number;
524
+ /** WKID, or Well-Known ID, of the CRS. Specify either WKID or WKT of the CRS. */
525
+ wkid: number;
526
+ /** WKT, or Well-Known Text, of the CRS. Specify either WKT or WKID of the CRS but not both. */
331
527
  wkt?: string;
332
528
  };
333
529
 
530
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md */
334
531
  type FullExtent = {
335
- xmin: number; // left
336
- xmax: number; // right
337
- ymin: number; // bottom
338
- ymax: number; // top
339
- zmin: number; // lowest elevation
340
- zmax: number; // highest elevation
532
+ /** left */
533
+ xmin: number;
534
+ /** right */
535
+ xmax: number;
536
+ /** bottom */
537
+ ymin: number;
538
+ /** top */
539
+ ymax: number;
540
+ /** lowest elevation */
541
+ zmin: number;
542
+ /** highest elevation */
543
+ zmax: number;
341
544
  spatialReference?: SpatialReference;
342
545
  };
343
546
 
@@ -350,6 +553,7 @@ type TextureDefinitionInfo = {
350
553
  images: TextureImage[];
351
554
  };
352
555
 
556
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/domain.cmn.md */
353
557
  type Domain = {
354
558
  type: string;
355
559
  name: string;
@@ -385,19 +589,7 @@ type Store = {
385
589
  type DefaultGeometrySchema = {
386
590
  geometryType?: 'triangles';
387
591
  topology: 'PerAttributeArray' | 'Indexed';
388
- header: {
389
- property: 'vertexCount' | 'featureCount' | string;
390
- type:
391
- | DATA_TYPE.UInt8
392
- | DATA_TYPE.UInt16
393
- | DATA_TYPE.UInt32
394
- | DATA_TYPE.UInt64
395
- | DATA_TYPE.Int16
396
- | DATA_TYPE.Int32
397
- | DATA_TYPE.Int64
398
- | DATA_TYPE.Float32
399
- | DATA_TYPE.Float64;
400
- }[];
592
+ header: HeaderAttribute[];
401
593
  ordering: string[];
402
594
  vertexAttributes: VertexAttribute;
403
595
  faces?: VertexAttribute;
@@ -406,6 +598,26 @@ type DefaultGeometrySchema = {
406
598
  // TODO Do we realy need this Property?
407
599
  attributesOrder?: string[];
408
600
  };
601
+ /**
602
+ * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/headerAttribute.cmn.md
603
+ */
604
+ export type HeaderAttribute = {
605
+ property: HeaderAttributeProperty.vertexCount | HeaderAttributeProperty.featureCount | string;
606
+ type:
607
+ | DATA_TYPE.UInt8
608
+ | DATA_TYPE.UInt16
609
+ | DATA_TYPE.UInt32
610
+ | DATA_TYPE.UInt64
611
+ | DATA_TYPE.Int16
612
+ | DATA_TYPE.Int32
613
+ | DATA_TYPE.Int64
614
+ | DATA_TYPE.Float32
615
+ | DATA_TYPE.Float64;
616
+ };
617
+ export enum HeaderAttributeProperty {
618
+ vertexCount = 'vertexCount',
619
+ featureCount = 'featureCount'
620
+ }
409
621
  export type VertexAttribute = {
410
622
  position: GeometryAttribute;
411
623
  normal: GeometryAttribute;
@@ -425,16 +637,14 @@ export type GeometryAttribute = {
425
637
  | DATA_TYPE.Float64;
426
638
  valuesPerElement: number;
427
639
  };
428
- export type NormalizedAttributes = {
429
- [key: string]: NormalizedAttribute;
640
+ export type I3SMeshAttributes = {
641
+ [key: string]: I3SMeshAttribute;
430
642
  };
431
- export type NormalizedAttribute = {
432
- value: number[] | TypedArray;
433
- type: number;
434
- size: number;
435
- normalized?: boolean;
643
+ export interface I3SMeshAttribute extends MeshAttribute {
644
+ type?: number;
436
645
  metadata?: any;
437
- };
646
+ }
647
+ /** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/heightModelInfo.cmn.md */
438
648
  type HeightModelInfo = {
439
649
  heightModel: 'gravity_related_height' | 'ellipsoidal';
440
650
  vertCRS: string;
@@ -462,21 +672,20 @@ type HeightModelInfo = {
462
672
  | 'kilometer';
463
673
  };
464
674
 
465
- type NodePages = {
466
- nodesPerPage: number;
467
- lodSelectionMetricType: string;
468
- };
675
+ export type TextureSetDefinitionFormats = {name: string; format: I3STextureFormat}[];
469
676
 
677
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureSetDefinition.cmn.md */
470
678
  type TextureSetDefinition = {
471
- formats: {name: string; format: string}[];
679
+ formats: TextureSetDefinitionFormats;
472
680
  atlas?: boolean;
473
681
  };
474
682
 
475
- type GeometryDefinitions = {
683
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryDefinition.cmn.md */
684
+ type GeometryDefinition = {
476
685
  topology: 'triangle' | string;
477
686
  geometryBuffers: GeometryBuffer[];
478
687
  };
479
-
688
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryBuffer.cmn.md */
480
689
  type GeometryBuffer = {
481
690
  offset?: number;
482
691
  position?: GeometryBufferItem;
@@ -493,7 +702,7 @@ type GeometryBufferItem = {type: string; component: number; encoding?: string; b
493
702
 
494
703
  type AttributeValue = {valueType: string; encoding?: string; valuesPerElement?: number};
495
704
 
496
- type FieldInfo = {
705
+ export type FieldInfo = {
497
706
  fieldName: string;
498
707
  visible: boolean;
499
708
  isEditable: boolean;