@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.
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/dist.min.js +10374 -0
- package/dist/i3s-attribute-loader.d.ts +14 -0
- package/dist/i3s-attribute-loader.d.ts.map +1 -0
- package/dist/i3s-attribute-loader.js +1 -1
- package/dist/i3s-building-scene-layer-loader.d.ts +6 -0
- package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -0
- package/dist/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s-content-loader.d.ts +6 -0
- package/dist/i3s-content-loader.d.ts.map +1 -0
- package/dist/i3s-content-loader.js +1 -1
- package/dist/i3s-content-worker.js +391 -270
- package/dist/i3s-loader.d.ts +6 -0
- package/dist/i3s-loader.d.ts.map +1 -0
- package/dist/i3s-loader.js +1 -1
- package/dist/i3s-node-page-loader.d.ts +6 -0
- package/dist/i3s-node-page-loader.d.ts.map +1 -0
- package/dist/i3s-node-page-loader.js +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +73 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.js +33 -23
- package/dist/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/lib/parsers/constants.d.ts +40 -0
- package/dist/lib/parsers/constants.d.ts.map +1 -0
- package/dist/lib/parsers/constants.js +54 -38
- package/dist/lib/parsers/constants.js.map +1 -1
- package/dist/lib/parsers/parse-i3s-attribute.d.ts +10 -0
- package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +9 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js +2 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts +4 -0
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-tile-content.js +76 -79
- package/dist/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/lib/parsers/parse-i3s.d.ts +6 -0
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s.js +40 -25
- package/dist/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts +2 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts.map +1 -0
- package/dist/lib/utils/url-utils.d.ts +22 -0
- package/dist/lib/utils/url-utils.d.ts.map +1 -0
- package/dist/lib/utils/url-utils.js +2 -3
- package/dist/lib/utils/url-utils.js.map +1 -1
- package/dist/types.d.ts +643 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +20 -1
- package/dist/types.js.map +1 -1
- package/dist/workers/i3s-content-worker.d.ts +2 -0
- package/dist/workers/i3s-content-worker.d.ts.map +1 -0
- package/package.json +12 -12
- package/src/index.ts +3 -3
- package/src/lib/helpers/i3s-nodepages-tiles.ts +71 -55
- package/src/lib/parsers/constants.ts +67 -54
- package/src/lib/parsers/parse-i3s-building-scene-layer.ts +2 -1
- package/src/lib/parsers/parse-i3s-tile-content.ts +150 -146
- package/src/lib/parsers/parse-i3s.ts +48 -37
- package/src/lib/utils/url-utils.ts +7 -7
- package/src/types.ts +412 -73
package/dist/types.js
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
export
|
|
1
|
+
export let DATA_TYPE;
|
|
2
|
+
|
|
3
|
+
(function (DATA_TYPE) {
|
|
4
|
+
DATA_TYPE["UInt8"] = "UInt8";
|
|
5
|
+
DATA_TYPE["UInt16"] = "UInt16";
|
|
6
|
+
DATA_TYPE["UInt32"] = "UInt32";
|
|
7
|
+
DATA_TYPE["UInt64"] = "UInt64";
|
|
8
|
+
DATA_TYPE["Int16"] = "Int16";
|
|
9
|
+
DATA_TYPE["Int32"] = "Int32";
|
|
10
|
+
DATA_TYPE["Int64"] = "Int64";
|
|
11
|
+
DATA_TYPE["Float32"] = "Float32";
|
|
12
|
+
DATA_TYPE["Float64"] = "Float64";
|
|
13
|
+
})(DATA_TYPE || (DATA_TYPE = {}));
|
|
14
|
+
|
|
15
|
+
export let HeaderAttributeProperty;
|
|
16
|
+
|
|
17
|
+
(function (HeaderAttributeProperty) {
|
|
18
|
+
HeaderAttributeProperty["vertexCount"] = "vertexCount";
|
|
19
|
+
HeaderAttributeProperty["featureCount"] = "featureCount";
|
|
20
|
+
})(HeaderAttributeProperty || (HeaderAttributeProperty = {}));
|
|
2
21
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"names":["DATA_TYPE","HeaderAttributeProperty"],"mappings":"AAIA,WAAYA,SAAZ;;WAAYA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,KAAAA,S;;AAmmBZ,WAAYC,uBAAZ;;WAAYA,uB;AAAAA,EAAAA,uB;AAAAA,EAAAA,uB;GAAAA,uB,KAAAA,uB","sourcesContent":["import type {GLTFMaterial} from '@loaders.gl/gltf';\nimport type {Matrix4, Quaternion, Vector3} from '@math.gl/core';\nimport type {TypedArray, MeshAttribute, TextureLevel} from '@loaders.gl/schema';\n\nexport enum DATA_TYPE {\n UInt8 = 'UInt8',\n UInt16 = 'UInt16',\n UInt32 = 'UInt32',\n UInt64 = 'UInt64',\n Int16 = 'Int16',\n Int32 = 'Int32',\n Int64 = 'Int64',\n Float32 = 'Float32',\n Float64 = 'Float64'\n}\n/**\n * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md\n */\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport interface I3STilesetHeader extends SceneLayer3D {\n /** Not in spec, but is necessary for woking */\n url?: string;\n [key: string]: any;\n}\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePage.cmn.md */\nexport type NodePage = {\n /** Array of nodes. */\n nodes: NodeInPage[];\n};\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/mesh.cmn.md\n */\ntype NodeMesh = {\n /**\n * The material definition.\n */\n material: MeshMaterial;\n /** The geometry definition. */\n geometry: MeshGeometry;\n /** The attribute set definition. */\n attribute: meshAttribute;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshMaterial.cmn.md */\nexport type MeshMaterial = {\n /** The index in layer.materialDefinitions array. */\n definition: number;\n /** Resource id for the material textures. i.e: layers/0/nodes/{material.resource}/textures/{tex_name}. Is required if material declares any textures. */\n resource?: number;\n /** Estimated number of texel for the highest resolution base color texture. */\n texelCountHint?: number;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshGeometry.cmn.md */\nexport type MeshGeometry = {\n /** The index in layer.geometryDefinitions array */\n definition: number;\n /** The resource locator to be used to query geometry resources: layers/0/nodes/{this.resource}/geometries/{layer.geometryDefinitions[this.definition].geometryBuffers[0 or 1]}. */\n resource: number;\n /** 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 */\n vertexCount?: number;\n /** Number of features for this mesh. Default=0. (Must omit or set to 0 if mesh doesn't use features.) */\n featureCount?: number;\n};\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshAttribute.cmn.md */\ntype meshAttribute = {\n /** The resource identifier to be used to locate attribute resources of this mesh. i.e. layers/0/nodes/<resource id>/attributes/... */\n resource: number;\n};\n\nexport type I3STextureFormat = 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2';\n\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport type I3STileHeader = {\n isDracoGeometry: boolean;\n textureUrl?: string;\n url?: string;\n textureFormat?: I3STextureFormat;\n textureLoaderOptions?: any;\n materialDefinition?: I3SMaterialDefinition;\n mbs: Mbs;\n obb?: Obb;\n lodSelection?: LodSelection[];\n [key: string]: any;\n};\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport type I3STileContent = {\n attributes: I3SMeshAttributes;\n indices: TypedArray | null;\n featureIds: number[] | TypedArray;\n vertexCount: number;\n modelMatrix: Matrix4;\n coordinateSystem: number;\n byteLength: number;\n texture: TileContentTexture;\n [key: string]: any;\n};\n\nexport type TileContentTexture =\n | ArrayBuffer\n | {\n compressed: boolean;\n mipmaps: boolean;\n width: number;\n height: number;\n data: TextureLevel[];\n }\n | null;\n\nexport type BoundingVolumes = {\n mbs: Mbs;\n obb: Obb;\n};\n\nexport type Obb = {\n center: number[] | Vector3;\n halfSize: number[] | Vector3;\n quaternion: Quaternion;\n};\n\nexport type Mbs = [number, number, number, number];\n\n/** SceneLayer3D based on I3S specification - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md */\nexport type SceneLayer3D = {\n /** Unique numeric ID of the layer. */\n id: number;\n /** The relative URL to the 3DSceneLayerResource. Only present as part of the SceneServiceInfo resource. */\n href?: string;\n /** The user-visible layer type */\n layerType: '3DObject' | 'IntegratedMesh';\n /** The spatialReference of the layer including the vertical coordinate reference system (CRS). Well Known Text (WKT) for CRS is included to support custom CRS. */\n spatialReference?: SpatialReference;\n /** Enables consuming clients to quickly determine whether this layer is compatible (with respect to its horizontal and vertical coordinate system) with existing content. */\n heightModelInfo?: HeightModelInfo;\n /** The ID of the last update session in which any resource belonging to this layer has been updated. */\n version: string;\n /** The name of this layer. */\n name?: string;\n /** The time of the last update. */\n serviceUpdateTimeStamp?: {lastUpdate: number};\n /** The display alias to be used for this layer. */\n alias?: string;\n /** Description string for this layer. */\n description?: string;\n /** Copyright and usage information for the data in this layer. */\n copyrightText?: string;\n /** Capabilities supported by this layer. */\n capabilities: string[];\n /** ZFactor to define conversion factor for elevation unit. */\n ZFactor?: number;\n /** Indicates if any styling information represented as drawingInfo is captured as part of the binary mesh representation. */\n cachedDrawingInfo?: CachedDrawingInfo;\n /** An object containing drawing information. */\n drawingInfo?: DrawingInfo;\n /** An object containing elevation drawing information. If absent, any content of the scene layer is drawn at its z coordinate. */\n elevationInfo?: ElevationInfo;\n /** PopupInfo of the scene layer. */\n popupInfo?: PopupInfo;\n /** Indicates if client application will show the popup information. Default is FALSE. */\n disablePopup: boolean;\n /**\n * The store object describes the exact physical storage of a layer and\n * enables the client to detect when multiple layers are served from\n * the same store.\n */\n store: Store;\n /** A collection of objects that describe each attribute field regarding its field name, datatype, and a user friendly name {name,type,alias}. */\n fields?: Field[];\n /** Provides the schema and layout used for storing attribute content in binary format in I3S. */\n attributeStorageInfo?: AttributeStorageInfo[];\n /** Contains the statistical information for a layer. */\n statisticsInfo?: StatisticsInfo[];\n /** The paged-access index description. */\n nodePages?: NodePageDefinition;\n /** List of materials classes used in this layer. */\n materialDefinitions?: I3SMaterialDefinition[];\n /** Defines the set of textures that can be referenced by meshes. */\n textureSetDefinitions?: TextureSetDefinition[];\n /** Define the layouts of mesh geometry and its attributes */\n geometryDefinitions?: GeometryDefinition[];\n /** 3D extent. */\n fullExtent?: FullExtent;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/cachedDrawingInfo.cmn.md */\nexport type CachedDrawingInfo = {\n /** If true, the drawingInfo is captured as part of the binary scene layer representation. */\n color: boolean;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/drawingInfo.cmn.md */\nexport type DrawingInfo = {\n /** An object defining the symbology for the layer. See more information about supported renderer types in ArcGIS clients. */\n renderer: any;\n /** Scale symbols for the layer. */\n scaleSymbols: boolean;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/elevationInfo.cmn.md */\nexport type ElevationInfo = {\n mode: 'relativeToGround' | 'absoluteHeight' | 'onTheGround' | 'relativeToScene';\n /** Offset is always added to the result of the above logic except for onTheGround where offset is ignored. */\n offset: number;\n /** A string value indicating the unit for the values in elevationInfo */\n unit: string;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/statisticsInfo.cmn.md */\nexport type StatisticsInfo = {\n /** Key indicating the resource of the statistics. */\n key: string;\n /** Name of the field of the statistical information. */\n name: string;\n /** The URL to the statistics information. */\n href: string;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePageDefinition.cmn.md */\nexport type NodePageDefinition = {\n /** Number of nodes per page for this layer. Must be a power-of-two less than 4096 */\n nodesPerPage: number;\n /** Index of the root node. Default = 0. */\n rootIndex?: number;\n /** Defines the meaning of nodes[].lodThreshold for this layer. */\n lodSelectionMetricType: 'maxScreenThresholdSQ';\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitions.cmn.md */\nexport type I3SMaterialDefinition = {\n /** 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. */\n pbrMetallicRoughness: I3SPbrMetallicRoughness;\n /** The normal texture map. */\n normalTexture: I3SMaterialTexture;\n /** The occlusion texture map. */\n occlusionTexture: I3SMaterialTexture;\n /** The emissive texture map. */\n emissiveTexture: I3SMaterialTexture;\n /** The emissive color of the material. */\n emissiveFactor: [number, number, number];\n /** Defines the meaning of the alpha-channel/alpha-mask. */\n alphaMode: 'opaque' | 'mask' | 'blend';\n /** The alpha cutoff value of the material. */\n alphaCutoff: number;\n /** Specifies whether the material is double sided. */\n doubleSided: boolean;\n /** Winding order is counterclockwise. */\n cullFace: 'none' | 'front' | 'back';\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/pbrMetallicRoughness.cmn.md */\nexport type I3SPbrMetallicRoughness = {\n /** The material's base color factor. default=[1,1,1,1] */\n baseColorFactor: [number, number, number, number];\n /** The base color texture. */\n baseColorTexture: I3SMaterialTexture;\n /** the metalness of the material. default=1.0 */\n metallicFactor: number;\n /** the roughness of the material. default=1.0 */\n roughnessFactor: number;\n /** the metallic-roughness texture. */\n metallicRoughnessTexture: I3SMaterialTexture;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialTexture.cmn.md */\nexport type I3SMaterialTexture = {\n /** The index in layer.textureSetDefinitions. */\n textureSetDefinitionId: number;\n /** The set index of texture's TEXCOORD attribute used for texture coordinate mapping. Default is 0. Deprecated. */\n texCoord?: number;\n /** 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 */\n factor?: number;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/attributeStorageInfo.cmn.md */\nexport type AttributeStorageInfo = {\n key: string;\n name: string;\n header: {property: string; valueType: string}[];\n ordering?: string[];\n attributeValues?: AttributeValue;\n attributeByteCounts?: AttributeValue;\n objectIds?: AttributeValue;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/field.cmn.md */\nexport type Field = {\n name: string;\n type: ESRIField;\n alias?: string;\n domain?: Domain;\n};\n\nexport type ESRIField =\n | 'esriFieldTypeDate'\n | 'esriFieldTypeSingle'\n | 'esriFieldTypeDouble'\n | 'esriFieldTypeGUID'\n | 'esriFieldTypeGlobalID'\n | 'esriFieldTypeInteger'\n | 'esriFieldTypeOID'\n | 'esriFieldTypeSmallInteger'\n | 'esriFieldTypeString';\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/popupInfo.cmn.md */\nexport type PopupInfo = {\n title?: string;\n description?: string;\n expressionInfos?: any[];\n fieldInfos?: FieldInfo[];\n mediaInfos?: any[];\n popupElements?: {text?: string; type?: string; fieldInfos?: FieldInfo[]}[];\n};\n\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n */\nexport type Node3DIndexDocument = {\n id: string;\n version?: string;\n path?: string;\n level?: number;\n mbs?: Mbs;\n obb?: Obb;\n lodSelection?: LodSelection[];\n children?: NodeReference[];\n neighbors?: NodeReference[];\n parentNode?: NodeReference;\n sharedResource?: Resource;\n featureData?: Resource[];\n geometryData?: Resource[];\n textureData?: Resource[];\n attributeData?: Resource[];\n created?: string;\n expires?: string;\n};\n\n/**\n * Minimal I3S node data is needed for loading\n */\nexport type I3SMinimalNodeData = {\n id: string;\n url?: string;\n transform?: number[];\n lodSelection?: LodSelection[];\n obb?: Obb;\n mbs?: Mbs;\n contentUrl?: string;\n textureUrl?: string;\n attributeUrls?: string[];\n materialDefinition?: I3SMaterialDefinition;\n textureFormat?: I3STextureFormat;\n textureLoaderOptions?: {[key: string]: any};\n children?: NodeReference[];\n isDracoGeometry: boolean;\n};\n\nexport type LodSelection = {\n metricType?: string;\n maxError: number;\n};\n\nexport type NodeReference = {\n id: string;\n version?: string;\n mbs?: Mbs;\n obb?: Obb;\n href?: string;\n};\n\nexport type Resource = {\n href: string;\n layerContent?: string[];\n featureRange?: number[];\n multiTextureBundle?: string;\n vertexElements?: number[];\n faceElements?: number[];\n nodePath?: string;\n};\n\nexport type MaxScreenThresholdSQ = {\n maxError: number;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/node.cmn.md */\nexport type NodeInPage = {\n /**\n * The index in the node array. May be different than material, geometry and attribute resource id. See mesh for more information.\n */\n index: number;\n /**\n * The index of the parent node in the node array.\n */\n parentIndex?: number;\n /**\n * When to switch LoD. See https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePageDefinition.cmn.md for more information.\n */\n lodThreshold?: number;\n /**\n * Oriented bounding box for this node.\n */\n obb: Obb;\n /**\n * index of the children nodes indices.\n */\n children?: number[];\n /**\n * The mesh for this node. WARNING: only SINGLE mesh is supported at version 1.7 (i.e. length must be 0 or 1).\n */\n mesh?: NodeMesh;\n};\n\nexport type SharedResources = {\n materialDefinitions?: GLTFMaterial[];\n textureDefinitions?: TextureDefinitionInfo[];\n nodePath: string;\n};\n\ntype TextureImage = {\n id: string;\n size?: number;\n pixelInWorldUnits?: number;\n href?: string[];\n byteOffset?: string[];\n length?: number[];\n mimeType?: string;\n bufferView?: {\n data: ArrayBuffer;\n };\n image?: {\n height: number;\n width: number;\n };\n};\n\nexport type Attribute = 'OBJECTID' | 'string' | 'double' | 'Int32' | string;\n\nexport type Extent = [number, number, number, number];\n\nexport type FeatureAttribute = {\n id: AttributeValue;\n faceRange: AttributeValue;\n};\n\nexport type BuildingSceneLayerTileset = {\n header: BuildingSceneLayer;\n sublayers: BuildingSceneSublayer[];\n};\n\nexport type BuildingSceneLayer = {\n id: number;\n name: string;\n version: string;\n alias?: string;\n layerType: 'Building';\n description?: string;\n copyrightText?: string;\n fullExtent: FullExtent;\n spatialReference: SpatialReference;\n heightModelInfo?: HeightModelInfo;\n sublayers: BuildingSceneSublayer[];\n filters?: Filter[];\n activeFilterID?: string;\n statisticsHRef?: string;\n};\n\nexport type BuildingSceneSublayer = {\n id: number;\n name: string;\n alias?: string;\n discipline?: 'Mechanical' | 'Architectural' | 'Piping' | 'Electrical' | 'Structural';\n modelName?: string;\n layerType: 'group' | '3DObject' | 'Point';\n visibility?: boolean;\n sublayers?: BuildingSceneSublayer[];\n isEmpty?: boolean;\n url?: string;\n};\n\ntype Filter = {\n id: string;\n name: string;\n description: string;\n isDefaultFilter?: boolean;\n isVisible?: boolean;\n filterBlocks: FilterBlock[];\n filterAuthoringInfo?: FilterAuthoringInfo;\n};\n\ntype FilterAuthoringInfo = {\n type: string;\n filterBlocks: FilterBlockAuthoringInfo[];\n};\n\ntype FilterBlockAuthoringInfo = {\n filterTypes: FilterType[];\n};\n\ntype FilterType = {\n filterType: string;\n filterValues: string[];\n};\n\ntype FilterBlock = {\n title: string;\n filterMode: FilterModeSolid | FilterModeWireFrame;\n filterExpression: string;\n};\n\ntype Edges = {\n type: string;\n color: number[];\n size: number;\n transparency: number;\n extensionLength: number;\n};\n\ntype FilterModeSolid = {\n type: 'solid';\n};\n\ntype FilterModeWireFrame = {\n type: 'wireFrame';\n edges: Edges;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/spatialReference.cmn.md */\nexport type SpatialReference = {\n /** The current WKID value of the vertical coordinate system. */\n latestVcsWkid: number;\n /** dentifies the current WKID value associated with the same spatial reference. */\n latestWkid: number;\n /** The WKID value of the vertical coordinate system. */\n vcsWkid: number;\n /** WKID, or Well-Known ID, of the CRS. Specify either WKID or WKT of the CRS. */\n wkid: number;\n /** WKT, or Well-Known Text, of the CRS. Specify either WKT or WKID of the CRS but not both. */\n wkt?: string;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md */\ntype FullExtent = {\n /** left */\n xmin: number;\n /** right */\n xmax: number;\n /** bottom */\n ymin: number;\n /** top */\n ymax: number;\n /** lowest elevation */\n zmin: number;\n /** highest elevation */\n zmax: number;\n spatialReference?: SpatialReference;\n};\n\ntype TextureDefinitionInfo = {\n encoding: string[];\n wrap?: string[];\n atlas?: boolean;\n uvSet?: string;\n channels?: 'rbg' | 'rgba' | string;\n images: TextureImage[];\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/domain.cmn.md */\ntype Domain = {\n type: string;\n name: string;\n description?: string;\n fieldType?: string;\n range?: [number, number];\n codedValues?: {name: string; code: string | number}[];\n mergePolicy?: string;\n splitPolicy?: string;\n};\n/**\n * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/store.cmn.md\n */\ntype Store = {\n id: string | number;\n profile: string;\n version: number | string;\n resourcePattern: string[];\n rootNode: string;\n extent: number[];\n indexCRS: string;\n vertexCRS: string;\n normalReferenceFrame: string;\n attributeEncoding: string;\n textureEncoding: string[];\n lodType: string;\n lodModel: string;\n defaultGeometrySchema: DefaultGeometrySchema;\n};\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/defaultGeometrySchema.cmn.md\n */\ntype DefaultGeometrySchema = {\n geometryType?: 'triangles';\n topology: 'PerAttributeArray' | 'Indexed';\n header: HeaderAttribute[];\n ordering: string[];\n vertexAttributes: VertexAttribute;\n faces?: VertexAttribute;\n featureAttributeOrder: string[];\n featureAttributes: FeatureAttribute;\n // TODO Do we realy need this Property?\n attributesOrder?: string[];\n};\n/**\n * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/headerAttribute.cmn.md\n */\nexport type HeaderAttribute = {\n property: HeaderAttributeProperty.vertexCount | HeaderAttributeProperty.featureCount | string;\n type:\n | DATA_TYPE.UInt8\n | DATA_TYPE.UInt16\n | DATA_TYPE.UInt32\n | DATA_TYPE.UInt64\n | DATA_TYPE.Int16\n | DATA_TYPE.Int32\n | DATA_TYPE.Int64\n | DATA_TYPE.Float32\n | DATA_TYPE.Float64;\n};\nexport enum HeaderAttributeProperty {\n vertexCount = 'vertexCount',\n featureCount = 'featureCount'\n}\nexport type VertexAttribute = {\n position: GeometryAttribute;\n normal: GeometryAttribute;\n uv0: GeometryAttribute;\n color: GeometryAttribute;\n region?: GeometryAttribute;\n};\nexport type GeometryAttribute = {\n byteOffset?: number;\n valueType:\n | DATA_TYPE.UInt8\n | DATA_TYPE.UInt16\n | DATA_TYPE.Int16\n | DATA_TYPE.Int32\n | DATA_TYPE.Int64\n | DATA_TYPE.Float32\n | DATA_TYPE.Float64;\n valuesPerElement: number;\n};\nexport type I3SMeshAttributes = {\n [key: string]: I3SMeshAttribute;\n};\nexport interface I3SMeshAttribute extends MeshAttribute {\n type?: number;\n metadata?: any;\n}\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/heightModelInfo.cmn.md */\ntype HeightModelInfo = {\n heightModel: 'gravity_related_height' | 'ellipsoidal';\n vertCRS: string;\n heightUnit:\n | 'meter'\n | 'us-foot'\n | 'foot'\n | 'clarke-foot'\n | 'clarke-yard'\n | 'clarke-link'\n | 'sears-yard'\n | 'sears-foot'\n | 'sears-chain'\n | 'benoit-1895-b-chain'\n | 'indian-yard'\n | 'indian-1937-yard'\n | 'gold-coast-foot'\n | 'sears-1922-truncated-chain'\n | 'us-inch'\n | 'us-mile'\n | 'us-yard'\n | 'millimeter'\n | 'decimeter'\n | 'centimeter'\n | 'kilometer';\n};\n\nexport type TextureSetDefinitionFormats = {name: string; format: I3STextureFormat}[];\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureSetDefinition.cmn.md */\ntype TextureSetDefinition = {\n formats: TextureSetDefinitionFormats;\n atlas?: boolean;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryDefinition.cmn.md */\ntype GeometryDefinition = {\n topology: 'triangle' | string;\n geometryBuffers: GeometryBuffer[];\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryBuffer.cmn.md */\ntype GeometryBuffer = {\n offset?: number;\n position?: GeometryBufferItem;\n normal?: GeometryBufferItem;\n uv0?: GeometryBufferItem;\n color?: GeometryBufferItem;\n uvRegion?: GeometryBufferItem;\n featureId?: GeometryBufferItem;\n faceRange?: GeometryBufferItem;\n compressedAttributes?: {encoding: string; attributes: string[]};\n};\n\ntype GeometryBufferItem = {type: string; component: number; encoding?: string; binding: string};\n\ntype AttributeValue = {valueType: string; encoding?: string; valuesPerElement?: number};\n\nexport type FieldInfo = {\n fieldName: string;\n visible: boolean;\n isEditable: boolean;\n label: string;\n};\n"],"file":"types.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i3s-content-worker.d.ts","sourceRoot":"","sources":["../../src/workers/i3s-content-worker.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/i3s",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"description": "i3s .",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"tile",
|
|
18
18
|
"mesh"
|
|
19
19
|
],
|
|
20
|
-
"types": "
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
21
|
"main": "dist/index.js",
|
|
22
22
|
"module": "dist/index.js",
|
|
23
23
|
"sideEffects": false,
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
30
|
"pre-build": "npm run build-bundle && npm run build-worker",
|
|
31
|
-
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/
|
|
32
|
-
"build-worker": "esbuild src/workers/i3s-content-worker.ts --bundle --outfile=dist/i3s-content-worker.js"
|
|
31
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js",
|
|
32
|
+
"build-worker": "esbuild src/workers/i3s-content-worker.ts --bundle --outfile=dist/i3s-content-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@loaders.gl/draco": "4.0.0-alpha.
|
|
36
|
-
"@loaders.gl/images": "4.0.0-alpha.
|
|
37
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
38
|
-
"@loaders.gl/schema": "4.0.0-alpha.
|
|
39
|
-
"@loaders.gl/textures": "4.0.0-alpha.
|
|
40
|
-
"@loaders.gl/tiles": "4.0.0-alpha.
|
|
35
|
+
"@loaders.gl/draco": "4.0.0-alpha.5",
|
|
36
|
+
"@loaders.gl/images": "4.0.0-alpha.5",
|
|
37
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.5",
|
|
38
|
+
"@loaders.gl/schema": "4.0.0-alpha.5",
|
|
39
|
+
"@loaders.gl/textures": "4.0.0-alpha.5",
|
|
40
|
+
"@loaders.gl/tiles": "4.0.0-alpha.5",
|
|
41
41
|
"@luma.gl/constants": "^8.5.4",
|
|
42
42
|
"@math.gl/core": "^3.5.1",
|
|
43
43
|
"@math.gl/culling": "^3.5.1",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"probe.gl": "^3.4.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@loaders.gl/core": "
|
|
48
|
+
"@loaders.gl/core": "4.0.0-alpha.4"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "7a71a54bdf1ddf985cc3af3db90b82e7fa97d025"
|
|
51
51
|
}
|
package/src/index.ts
CHANGED
|
@@ -15,13 +15,13 @@ export type {
|
|
|
15
15
|
LodSelection,
|
|
16
16
|
NodeReference,
|
|
17
17
|
Resource,
|
|
18
|
-
I3SGeometry,
|
|
19
18
|
MaxScreenThresholdSQ,
|
|
20
19
|
NodeInPage,
|
|
21
20
|
SharedResources,
|
|
22
|
-
TextureImage,
|
|
23
21
|
Attribute,
|
|
24
22
|
Extent,
|
|
25
|
-
FeatureAttribute
|
|
23
|
+
FeatureAttribute,
|
|
24
|
+
FieldInfo,
|
|
25
|
+
I3SMaterialDefinition
|
|
26
26
|
} from './types';
|
|
27
27
|
export {COORDINATE_SYSTEM} from './lib/parsers/constants';
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
import {load} from '@loaders.gl/core';
|
|
2
2
|
import {getSupportedGPUTextureFormats, selectSupportedBasisFormat} from '@loaders.gl/textures';
|
|
3
|
-
import {Tileset, NodePage} from '../../types';
|
|
4
3
|
import {I3SNodePageLoader} from '../../i3s-node-page-loader';
|
|
5
4
|
import {normalizeTileNonUrlData} from '../parsers/parse-i3s';
|
|
6
5
|
import {getUrlWithToken, generateTilesetAttributeUrls} from '../utils/url-utils';
|
|
6
|
+
import type {LoaderOptions} from '@loaders.gl/loader-utils';
|
|
7
|
+
import {
|
|
8
|
+
I3STilesetHeader,
|
|
9
|
+
LodSelection,
|
|
10
|
+
NodePage,
|
|
11
|
+
NodeInPage,
|
|
12
|
+
Obb,
|
|
13
|
+
MeshMaterial,
|
|
14
|
+
I3SMaterialDefinition,
|
|
15
|
+
I3STextureFormat,
|
|
16
|
+
MeshGeometry,
|
|
17
|
+
I3STileHeader
|
|
18
|
+
} from '../../types';
|
|
7
19
|
|
|
8
20
|
/**
|
|
9
21
|
* class I3SNodePagesTiles - loads nodePages and form i3s tiles from them
|
|
10
22
|
*/
|
|
11
23
|
export default class I3SNodePagesTiles {
|
|
12
|
-
tileset:
|
|
24
|
+
tileset: I3STilesetHeader;
|
|
13
25
|
nodePages: NodePage[] = [];
|
|
14
26
|
pendingNodePages: {promise: Promise<NodePage>; status: 'Pending' | 'Done'}[] = [];
|
|
15
27
|
nodesPerPage: number;
|
|
16
|
-
options:
|
|
17
|
-
lodSelectionMetricType
|
|
18
|
-
textureDefinitionsSelectedFormats:
|
|
28
|
+
options: LoaderOptions;
|
|
29
|
+
lodSelectionMetricType?: string;
|
|
30
|
+
textureDefinitionsSelectedFormats: ({format: I3STextureFormat; name: string} | null)[] = [];
|
|
19
31
|
private textureLoaderOptions: {[key: string]: any} = {};
|
|
20
32
|
|
|
21
33
|
/**
|
|
@@ -24,10 +36,10 @@ export default class I3SNodePagesTiles {
|
|
|
24
36
|
* @param tileset - i3s tileset header ('layers/0')
|
|
25
37
|
* @param options - i3s loader options
|
|
26
38
|
*/
|
|
27
|
-
constructor(tileset:
|
|
39
|
+
constructor(tileset: I3STilesetHeader, options: LoaderOptions) {
|
|
28
40
|
this.tileset = {...tileset}; // spread the tileset to avoid circular reference
|
|
29
|
-
this.nodesPerPage = tileset.nodePages
|
|
30
|
-
this.lodSelectionMetricType = tileset.nodePages
|
|
41
|
+
this.nodesPerPage = tileset.nodePages?.nodesPerPage || 64;
|
|
42
|
+
this.lodSelectionMetricType = tileset.nodePages?.lodSelectionMetricType;
|
|
31
43
|
this.options = options;
|
|
32
44
|
|
|
33
45
|
this.initSelectedFormatsForTextureDefinitions(tileset);
|
|
@@ -37,7 +49,7 @@ export default class I3SNodePagesTiles {
|
|
|
37
49
|
* Loads some nodePage and return a particular node from it
|
|
38
50
|
* @param id - id of node through all node pages
|
|
39
51
|
*/
|
|
40
|
-
async getNodeById(id: number) {
|
|
52
|
+
async getNodeById(id: number): Promise<NodeInPage> {
|
|
41
53
|
const pageIndex = Math.floor(id / this.nodesPerPage);
|
|
42
54
|
if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {
|
|
43
55
|
const nodePageUrl = getUrlWithToken(
|
|
@@ -63,34 +75,33 @@ export default class I3SNodePagesTiles {
|
|
|
63
75
|
* @param id - id of node through all node pages
|
|
64
76
|
*/
|
|
65
77
|
// eslint-disable-next-line complexity
|
|
66
|
-
async formTileFromNodePages(id: number) {
|
|
67
|
-
const node = await this.getNodeById(id);
|
|
68
|
-
const children:
|
|
78
|
+
async formTileFromNodePages(id: number): Promise<I3STileHeader> {
|
|
79
|
+
const node: NodeInPage = await this.getNodeById(id);
|
|
80
|
+
const children: {id: string; obb: Obb}[] = [];
|
|
69
81
|
for (const child of node.children || []) {
|
|
70
82
|
const childNode = await this.getNodeById(child);
|
|
71
83
|
children.push({
|
|
72
|
-
id: child,
|
|
84
|
+
id: child.toString(),
|
|
73
85
|
obb: childNode.obb
|
|
74
86
|
});
|
|
75
87
|
}
|
|
76
88
|
|
|
77
|
-
let contentUrl
|
|
78
|
-
let textureUrl: string |
|
|
79
|
-
let materialDefinition
|
|
80
|
-
let textureFormat = '
|
|
89
|
+
let contentUrl: string | undefined;
|
|
90
|
+
let textureUrl: string | undefined;
|
|
91
|
+
let materialDefinition: I3SMaterialDefinition | undefined;
|
|
92
|
+
let textureFormat: I3STextureFormat = 'jpg';
|
|
81
93
|
let attributeUrls: string[] = [];
|
|
82
|
-
let isDracoGeometry = false;
|
|
94
|
+
let isDracoGeometry: boolean = false;
|
|
83
95
|
|
|
84
96
|
if (node && node.mesh) {
|
|
85
97
|
// Get geometry resource URL and type (compressed / non-compressed)
|
|
86
98
|
const {url, isDracoGeometry: isDracoGeometryResult} = (node.mesh.geometry &&
|
|
87
|
-
this.getContentUrl(node.mesh.geometry)) || {
|
|
99
|
+
this.getContentUrl(node.mesh.geometry)) || {isDracoGeometry: false};
|
|
88
100
|
contentUrl = url;
|
|
89
101
|
isDracoGeometry = isDracoGeometryResult;
|
|
90
102
|
|
|
91
|
-
const
|
|
92
|
-
node.mesh.material
|
|
93
|
-
);
|
|
103
|
+
const {textureData, materialDefinition: nodeMaterialDefinition} =
|
|
104
|
+
this.getInformationFromMaterial(node.mesh.material);
|
|
94
105
|
materialDefinition = nodeMaterialDefinition;
|
|
95
106
|
textureFormat = textureData.format || textureFormat;
|
|
96
107
|
if (textureData.name) {
|
|
@@ -105,7 +116,7 @@ export default class I3SNodePagesTiles {
|
|
|
105
116
|
const lodSelection = this.getLodSelection(node);
|
|
106
117
|
|
|
107
118
|
return normalizeTileNonUrlData({
|
|
108
|
-
id,
|
|
119
|
+
id: id.toString(),
|
|
109
120
|
lodSelection,
|
|
110
121
|
obb: node.obb,
|
|
111
122
|
contentUrl,
|
|
@@ -121,13 +132,14 @@ export default class I3SNodePagesTiles {
|
|
|
121
132
|
|
|
122
133
|
/**
|
|
123
134
|
* Forms url and type of geometry resource by nodepage's data and `geometryDefinitions` in the tileset
|
|
124
|
-
* @param
|
|
125
|
-
* @returns
|
|
135
|
+
* @param - data about the node's mesh from the nodepage
|
|
136
|
+
* @returns -
|
|
126
137
|
* {string} url - url to the geometry resource
|
|
127
138
|
* {boolean} isDracoGeometry - whether the geometry resource contain DRACO compressed geometry
|
|
128
139
|
*/
|
|
129
|
-
private getContentUrl(meshGeometryData) {
|
|
130
|
-
let result =
|
|
140
|
+
private getContentUrl(meshGeometryData: MeshGeometry) {
|
|
141
|
+
let result: {url: string; isDracoGeometry: boolean} | null = null;
|
|
142
|
+
// @ts-ignore
|
|
131
143
|
const geometryDefinition = this.tileset.geometryDefinitions[meshGeometryData.definition];
|
|
132
144
|
let geometryIndex = -1;
|
|
133
145
|
// Try to find DRACO geometryDefinition of `useDracoGeometry` option is set
|
|
@@ -156,21 +168,21 @@ export default class I3SNodePagesTiles {
|
|
|
156
168
|
|
|
157
169
|
/**
|
|
158
170
|
* Forms 1.6 compatible LOD selection object from a nodepage's node data
|
|
159
|
-
* @param
|
|
160
|
-
* @returns
|
|
161
|
-
* {string} metricType - the label of the LOD metric
|
|
162
|
-
* {number} maxError - the value of the metric
|
|
171
|
+
* @param node - a node from nodepage
|
|
172
|
+
* @returns- Array of LodSelection
|
|
163
173
|
*/
|
|
164
|
-
private getLodSelection(node):
|
|
165
|
-
const lodSelection:
|
|
174
|
+
private getLodSelection(node: NodeInPage): LodSelection[] {
|
|
175
|
+
const lodSelection: LodSelection[] = [];
|
|
166
176
|
if (this.lodSelectionMetricType === 'maxScreenThresholdSQ') {
|
|
167
177
|
lodSelection.push({
|
|
168
178
|
metricType: 'maxScreenThreshold',
|
|
179
|
+
// @ts-ignore
|
|
169
180
|
maxError: Math.sqrt(node.lodThreshold / (Math.PI * 0.25))
|
|
170
181
|
});
|
|
171
182
|
}
|
|
172
183
|
lodSelection.push({
|
|
173
184
|
metricType: this.lodSelectionMetricType,
|
|
185
|
+
// @ts-ignore
|
|
174
186
|
maxError: node.lodThreshold
|
|
175
187
|
});
|
|
176
188
|
return lodSelection;
|
|
@@ -178,43 +190,47 @@ export default class I3SNodePagesTiles {
|
|
|
178
190
|
|
|
179
191
|
/**
|
|
180
192
|
* Returns information about texture and material from `materialDefinitions`
|
|
181
|
-
* @param
|
|
182
|
-
* @returns
|
|
193
|
+
* @param material - material data from nodepage
|
|
194
|
+
* @returns - Couple {textureData, materialDefinition}
|
|
183
195
|
* {string} textureData.name - path name of the texture
|
|
184
196
|
* {string} textureData.format - format of the texture
|
|
185
197
|
* materialDefinition - PBR-like material definition from `materialDefinitions`
|
|
186
198
|
*/
|
|
187
|
-
private getInformationFromMaterial(material) {
|
|
188
|
-
const
|
|
199
|
+
private getInformationFromMaterial(material: MeshMaterial) {
|
|
200
|
+
const informationFromMaterial: {
|
|
201
|
+
textureData: {name: string | null; format?: I3STextureFormat};
|
|
202
|
+
materialDefinition?: I3SMaterialDefinition;
|
|
203
|
+
} = {textureData: {name: null}};
|
|
204
|
+
|
|
189
205
|
if (material) {
|
|
190
|
-
const materialDefinition = this.tileset.materialDefinitions[material.definition];
|
|
191
|
-
|
|
192
|
-
materialDefinition
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
206
|
+
const materialDefinition = this.tileset.materialDefinitions?.[material.definition];
|
|
207
|
+
if (materialDefinition) {
|
|
208
|
+
informationFromMaterial.materialDefinition = materialDefinition;
|
|
209
|
+
const textureSetDefinitionIndex =
|
|
210
|
+
materialDefinition?.pbrMetallicRoughness?.baseColorTexture?.textureSetDefinitionId;
|
|
211
|
+
|
|
212
|
+
if (typeof textureSetDefinitionIndex === 'number') {
|
|
213
|
+
informationFromMaterial.textureData =
|
|
214
|
+
this.textureDefinitionsSelectedFormats[textureSetDefinitionIndex] ||
|
|
215
|
+
informationFromMaterial.textureData;
|
|
216
|
+
}
|
|
200
217
|
}
|
|
201
|
-
return [textureDataDefault, materialDefinition];
|
|
202
218
|
}
|
|
203
|
-
return
|
|
219
|
+
return informationFromMaterial;
|
|
204
220
|
}
|
|
205
221
|
|
|
206
222
|
/**
|
|
207
223
|
* Sets preferable and supported format for each textureDefinition of the tileset
|
|
208
|
-
* @param
|
|
209
|
-
* @returns
|
|
224
|
+
* @param tileset - I3S layer data
|
|
225
|
+
* @returns
|
|
210
226
|
*/
|
|
211
|
-
private initSelectedFormatsForTextureDefinitions(tileset) {
|
|
227
|
+
private initSelectedFormatsForTextureDefinitions(tileset: I3STilesetHeader): void {
|
|
212
228
|
this.textureDefinitionsSelectedFormats = [];
|
|
213
229
|
const possibleI3sFormats = this.getSupportedTextureFormats();
|
|
214
230
|
const textureSetDefinitions = tileset.textureSetDefinitions || [];
|
|
215
231
|
for (const textureSetDefinition of textureSetDefinitions) {
|
|
216
232
|
const formats = (textureSetDefinition && textureSetDefinition.formats) || [];
|
|
217
|
-
let selectedFormat: {
|
|
233
|
+
let selectedFormat: {name: string; format: I3STextureFormat} | null = null;
|
|
218
234
|
for (const i3sFormat of possibleI3sFormats) {
|
|
219
235
|
const format = formats.find((value) => value.format === i3sFormat);
|
|
220
236
|
if (format) {
|
|
@@ -239,8 +255,8 @@ export default class I3SNodePagesTiles {
|
|
|
239
255
|
* Returns the array of supported texture format
|
|
240
256
|
* @returns list of format strings
|
|
241
257
|
*/
|
|
242
|
-
private getSupportedTextureFormats():
|
|
243
|
-
const formats:
|
|
258
|
+
private getSupportedTextureFormats(): I3STextureFormat[] {
|
|
259
|
+
const formats: I3STextureFormat[] = [];
|
|
244
260
|
if (!this.options.i3s || this.options.i3s.useCompressedTextures) {
|
|
245
261
|
// I3S 1.7 selection
|
|
246
262
|
const supportedCompressedFormats = getSupportedGPUTextureFormats();
|
|
@@ -1,48 +1,54 @@
|
|
|
1
1
|
import GL from '@luma.gl/constants';
|
|
2
|
+
import {DATA_TYPE} from '../../types';
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
export function getConstructorForDataFormat(dataType: string) {
|
|
5
|
+
switch (dataType) {
|
|
6
|
+
case DATA_TYPE.UInt8:
|
|
7
|
+
return Uint8Array;
|
|
8
|
+
case DATA_TYPE.UInt16:
|
|
9
|
+
return Uint16Array;
|
|
10
|
+
case DATA_TYPE.UInt32:
|
|
11
|
+
return Uint32Array;
|
|
12
|
+
case DATA_TYPE.Float32:
|
|
13
|
+
return Float32Array;
|
|
14
|
+
case DATA_TYPE.UInt64:
|
|
15
|
+
return Float64Array;
|
|
16
|
+
default:
|
|
17
|
+
throw new Error(`parse i3s tile content: unknown type of data: ${dataType}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
|
|
11
|
-
export const GL_TYPE_MAP = {
|
|
21
|
+
export const GL_TYPE_MAP: {[key: string]: number} = {
|
|
12
22
|
UInt8: GL.UNSIGNED_BYTE,
|
|
13
23
|
UInt16: GL.UNSIGNED_INT,
|
|
14
24
|
Float32: GL.FLOAT,
|
|
15
25
|
UInt32: GL.UNSIGNED_INT,
|
|
16
26
|
UInt64: GL.DOUBLE
|
|
17
27
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
UInt32: 4,
|
|
43
|
-
Float32: 4,
|
|
44
|
-
UInt64: 8
|
|
45
|
-
};
|
|
28
|
+
/**
|
|
29
|
+
* Returns how many bytes a type occupies
|
|
30
|
+
* @param dataType
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
export function sizeOf(dataType: string): number {
|
|
34
|
+
switch (dataType) {
|
|
35
|
+
case DATA_TYPE.UInt8:
|
|
36
|
+
return 1;
|
|
37
|
+
case DATA_TYPE.UInt16:
|
|
38
|
+
case DATA_TYPE.Int16:
|
|
39
|
+
return 2;
|
|
40
|
+
case DATA_TYPE.UInt32:
|
|
41
|
+
case DATA_TYPE.Int32:
|
|
42
|
+
case DATA_TYPE.Float32:
|
|
43
|
+
return 4;
|
|
44
|
+
case DATA_TYPE.UInt64:
|
|
45
|
+
case DATA_TYPE.Int64:
|
|
46
|
+
case DATA_TYPE.Float64:
|
|
47
|
+
return 8;
|
|
48
|
+
default:
|
|
49
|
+
throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
46
52
|
|
|
47
53
|
export const STRING_ATTRIBUTE_TYPE = 'String';
|
|
48
54
|
export const OBJECT_ID_ATTRIBUTE_TYPE = 'Oid32';
|
|
@@ -51,21 +57,28 @@ export const INT_16_ATTRIBUTE_TYPE = 'Int16';
|
|
|
51
57
|
|
|
52
58
|
// https://github.com/visgl/deck.gl/blob/9548f43cba2234a1f4877b6b17f6c88eb35b2e08/modules/core/src/lib/constants.js#L27
|
|
53
59
|
// Describes the format of positions
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
export enum COORDINATE_SYSTEM {
|
|
61
|
+
/**
|
|
62
|
+
* `LNGLAT` if rendering into a geospatial viewport, `CARTESIAN` otherwise
|
|
63
|
+
*/
|
|
64
|
+
DEFAULT = -1,
|
|
65
|
+
/**
|
|
66
|
+
* Positions are interpreted as [lng, lat, elevation]
|
|
67
|
+
* lng lat are degrees, elevation is meters. distances as meters.
|
|
68
|
+
*/
|
|
69
|
+
LNGLAT = 1,
|
|
70
|
+
/**
|
|
71
|
+
* Positions are interpreted as meter offsets, distances as meters
|
|
72
|
+
*/
|
|
73
|
+
METER_OFFSETS = 2,
|
|
74
|
+
/**
|
|
75
|
+
* Positions are interpreted as lng lat offsets: [deltaLng, deltaLat, elevation]
|
|
76
|
+
* deltaLng, deltaLat are delta degrees, elevation is meters.
|
|
77
|
+
* distances as meters.
|
|
78
|
+
*/
|
|
79
|
+
LNGLAT_OFFSETS = 3,
|
|
80
|
+
/**
|
|
81
|
+
* Non-geospatial
|
|
82
|
+
*/
|
|
83
|
+
CARTESIAN = 0
|
|
84
|
+
}
|
|
@@ -34,7 +34,7 @@ function parseSublayersTree(
|
|
|
34
34
|
|
|
35
35
|
for (let index = 0; index < sublayers.length; index++) {
|
|
36
36
|
const subLayer = sublayers[index];
|
|
37
|
-
const {id, layerType, ...rest} = subLayer;
|
|
37
|
+
const {id, layerType, visibility = true, ...rest} = subLayer;
|
|
38
38
|
|
|
39
39
|
// Add support only for 3DObject layer type for I3S purposes.
|
|
40
40
|
if (layerType === OBJECT_3D_LAYER_TYPE) {
|
|
@@ -44,6 +44,7 @@ function parseSublayersTree(
|
|
|
44
44
|
url: sublayerUrl,
|
|
45
45
|
id,
|
|
46
46
|
layerType,
|
|
47
|
+
visibility,
|
|
47
48
|
...rest
|
|
48
49
|
});
|
|
49
50
|
}
|