@loaders.gl/i3s 4.0.0-alpha.4 → 4.0.0-alpha.5

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