@loaders.gl/i3s 4.0.0-alpha.7 → 4.0.0-alpha.8
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/dist.min.js +99 -31
- package/dist/es5/arcgis-webscene-loader.js +1 -1
- package/dist/es5/i3s-attribute-loader.js +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
- package/dist/es5/i3s-content-loader.js +1 -1
- package/dist/es5/i3s-loader.js +1 -1
- package/dist/es5/i3s-node-page-loader.js +1 -1
- package/dist/es5/i3s-slpk-loader.js +1 -1
- package/dist/es5/i3s-slpk-loader.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +2 -2
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js +2 -2
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js.map +1 -1
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js +140 -23
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -1
- package/dist/es5/lib/utils/{customizeColors.js → customize-/321/201olors.js} +65 -40
- package/dist/es5/lib/utils/customize-/321/201olors.js.map +1 -0
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/arcgis-webscene-loader.js +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-slpk-loader.js +1 -1
- package/dist/esm/i3s-slpk-loader.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js +2 -2
- package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js.map +1 -1
- package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js +59 -9
- package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -1
- package/dist/esm/lib/utils/{customizeColors.js → customize-/321/201olors.js} +9 -3
- package/dist/esm/lib/utils/customize-/321/201olors.js.map +1 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/i3s-content-worker-node.js +2 -2
- package/dist/i3s-content-worker-node.js.map +3 -3
- package/dist/i3s-content-worker.js +16 -10
- package/dist/i3s-slpk-loader.d.ts +6 -3
- package/dist/i3s-slpk-loader.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +2 -2
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.js +1 -1
- package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts +6 -0
- package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts.map +1 -1
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js +72 -9
- package/dist/lib/utils/{customizeColors.d.ts → customize-/321/201olors.d.ts} +1 -1
- package/dist/lib/utils/customize-/321/201olors.d.ts.map +1 -0
- package/dist/lib/utils/{customizeColors.js → customize-/321/201olors.js} +12 -2
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/i3s-slpk-loader.ts +5 -3
- package/src/index.ts +2 -1
- package/src/lib/parsers/parse-i3s-tile-content.ts +1 -1
- package/src/lib/parsers/parse-slpk/parse-slpk.ts +4 -1
- package/src/lib/parsers/parse-slpk/slpk-archieve.ts +73 -9
- package/src/lib/utils/{customizeColors.ts → customize-/321/201olors.ts} +12 -2
- package/src/types.ts +1 -0
- package/dist/es5/lib/utils/customizeColors.js.map +0 -1
- package/dist/esm/lib/utils/customizeColors.js.map +0 -1
- package/dist/lib/utils/customizeColors.d.ts.map +0 -1
package/dist/es5/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["DATA_TYPE","exports","HeaderAttributeProperty"],"sources":["../../src/types.ts"],"sourcesContent":["import type {Matrix4, Quaternion, Vector3} from '@math.gl/core';\nimport type {TypedArray, MeshAttribute, TextureLevel} from '@loaders.gl/schema';\nimport {Tile3D, Tileset3D} from '@loaders.gl/tiles';\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\nexport type COLOR = [number, number, number, number];\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\nexport type I3SParseOptions = {\n /** ArcGIS access token */\n token?: string;\n /** Is 3DSceneLayer json expected in response */\n isTileset?: string;\n /** Is 3DNodeIndexDocument json expected in response */\n isTileHeader?: string;\n /** Tile3D instance. This property used only to load tile content */\n /** Tile-specific options */\n _tileOptions?: I3STileOptions;\n /** Tileset-specific options */\n _tilesetOptions?: I3STilesetOptions;\n /** Load Draco Compressed geometry if available */\n useDracoGeometry?: boolean;\n /** Load compressed textures if available */\n useCompressedTextures?: boolean;\n /** Set false if don't need to parse textures */\n decodeTextures?: boolean;\n /** deck.gl compatible coordinate system.\n * https://github.com/visgl/deck.gl/blob/master/docs/developer-guide/coordinate-systems.md\n * Supported coordinate systems: METER_OFFSETS, LNGLAT_OFFSETS\n */\n coordinateSystem?: number;\n colorsByAttribute?: {\n attributeName: string;\n minValue: number;\n maxValue: number;\n minColor: COLOR;\n maxColor: COLOR;\n };\n\n /** @deprecated */\n tile?: Tile3D | I3STileOptions;\n /** Tileset3D instance. This property used only to load tile content */\n /** @deprecated */\n tileset?: Tileset3D | I3STilesetOptions;\n};\n\nexport type I3STileOptions = {\n isDracoGeometry: boolean;\n textureUrl?: string;\n textureFormat?: I3STextureFormat;\n textureLoaderOptions?: any;\n materialDefinition?: I3SMaterialDefinition;\n attributeUrls: string[];\n mbs: Mbs;\n};\n\nexport type I3STilesetOptions = {\n store: Store;\n attributeStorageInfo: AttributeStorageInfo[];\n fields: Field[];\n};\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: number[] | 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 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\n/**\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitionInfo.cmn.md\n */\nexport type MaterialDefinitionInfo = {\n /** A name for the material as assigned in the creating application. */\n name?: string;\n /** Indicates the material type, chosen from the supported values. */\n type?: 'standard' | 'water' | 'billboard' | 'leafcard' | 'reference';\n /** The href that resolves to the shared resource bundle in which the material definition is contained. */\n $ref?: string;\n /** Parameter defined for the material.\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialParams.cmn.md\n */\n params: {\n /** Indicates transparency of this material; 0 = opaque, 1 = fully transparent. */\n transparency?: number;\n /** Indicates reflectivity of this material. */\n reflectivity?: number;\n /** Indicates shininess of this material. */\n shininess?: number;\n /** Ambient color of this material. Ambient color is the color of an object where it is in shadow.\n * This color is what the object reflects when illuminated by ambient light rather than direct light. */\n ambient?: number[];\n /** Diffuse color of this material. Diffuse color is the most instinctive meaning of the color of an object.\n * It is that essential color that the object reveals under pure white light. It is perceived as the color\n * of the object itself rather than a reflection of the light. */\n diffuse?: number[];\n /** Specular color of this material. Specular color is the color of the light of a specular reflection\n * (specular reflection is the type of reflection that is characteristic of light reflected from a shiny\n * surface). */\n specular?: number[];\n /** Rendering mode. */\n renderMode: 'textured' | 'solid' | 'untextured' | 'wireframe';\n /** TRUE if features with this material should cast shadows. */\n castShadows?: boolean;\n /** TRUE if features with this material should receive shadows */\n receiveShadows?: boolean;\n /** Indicates the material culling options {back, front, none}. */\n cullFace?: string;\n /** This flag indicates that the vertex color attribute of the geometry should be used to color the geometry\n * for rendering. If texture is present, the vertex colors are multiplied by this color.\n * e.g. pixel_color = [interpolated]vertex_color * texel_color. Default is false. */\n vertexColors?: boolean;\n /** This flag indicates that the geometry has uv region vertex attributes. These are used for adressing\n * subtextures in a texture atlas. The uv coordinates are relative to this subtexture in this case.\n * This is mostly useful for repeated textures in a texture atlas. Default is false. */\n vertexRegions?: boolean;\n /** Indicates whether Vertex Colors also contain a transparency channel. Default is false. */\n useVertexColorAlpha?: boolean;\n };\n};\n\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/sharedResource.cmn.md */\nexport type SharedResources = {\n /** Materials describe how a Feature or a set of Features is to be rendered. */\n materialDefinitions?: {[key: string]: MaterialDefinitionInfo};\n /** A Texture is a set of images, with some parameters specific to the texture/uv mapping to geometries. */\n textureDefinitions?: {[key: string]: TextureDefinitionInfo};\n};\n\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/image.cmn.md */\ntype TextureImage = {\n /** A unique ID for each image. Generated using the BuildID function. */\n id: string;\n /** width of this image, in pixels. */\n size?: number;\n /** The maximum size of a single pixel in world units.\n * This property is used by the client to pick the image to load and render. */\n pixelInWorldUnits?: number;\n /** The href to the image(s), one per encoding, in the same order as the encodings. */\n href?: string[];\n /** The byte offset of this image's encodings. There is one per encoding,\n * in the same order as the encodings, in the block in which this texture image resides. */\n byteOffset?: string[];\n /** The length in bytes of this image's encodings. There is one per encoding,\n * in the same order as the encodings. */\n length?: number[];\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 */\nexport type FullExtent = {\n /** left longitude in decimal degrees */\n xmin: number;\n /** right longitude in decimal degrees */\n xmax: number;\n /** bottom latitude in decimal degrees*/\n ymin: number;\n /** top latitude in decimal degrees*/\n ymax: number;\n /** lowest elevation in meters */\n zmin: number;\n /** highest elevation in meters */\n zmax: number;\n spatialReference?: SpatialReference;\n};\n\n/**\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureDefinitionInfo.cmn.md\n */\nexport type TextureDefinitionInfo = {\n /** MIMEtype - The encoding/content type that is used by all images in this map */\n encoding?: string[];\n /** UV wrapping modes, from {none, repeat, mirror}. */\n wrap?: string[];\n /** TRUE if the Map represents a texture atlas. */\n atlas?: boolean;\n /** The name of the UV set to be used as texture coordinates. */\n uvSet?: string;\n /** Indicates channels description. */\n channels?: 'rbg' | 'rgba' | string;\n /** An image is a binary resource, containing a single raster that can be used to texture a feature or symbol. */\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\nexport type ArcGisWebSceneData = {\n header: ArcGisWebScene;\n layers: OperationalLayer[];\n unsupportedLayers: OperationalLayer[];\n};\n\n/**\n * ArcGis WebScene spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport type ArcGisWebScene = {\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/applicationProperties/\n * Configuration of application and UI elements.\n */\n applicationProperties?: any;\n /**\n * Operational layers contain business data which are used to make thematic scenes.\n */\n operationalLayers: OperationalLayer[];\n /**\n * Basemaps give the web scene a geographic context.\n */\n baseMap: BaseMap;\n /**\n * Ground defines the main surface of the web scene, based on elevation layers.\n */\n ground: Ground;\n /**\n * An object that defines the characteristics of the vertical coordinate system used by the web scene.\n */\n heightModelInfo: HeightModelInfo;\n /**\n * Root element in the web scene specifying a string value indicating the web scene version.\n * Valid values: 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27\n */\n version: string;\n /**\n * String value indicating the application which authored the webmap\n */\n authoringApp: string;\n /**\n * String value indicating the authoring App's version number.\n */\n authoringAppVersion: string;\n /**\n * A presentation consists of multiple slides, where each slide is a specific view into the web scene.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/presentation/\n * @todo Add presentation type.\n */\n presentation: ArcGisPresentation;\n /**\n * An object that provides information about the initial environment settings and viewpoint of the web scene.\n */\n initialState: InitialState;\n /**\n * An object used to specify the spatial reference of the given geometry.\n */\n spatialReference: SpatialReference;\n viewingMode: 'global' | 'local';\n /**\n * @todo add type.\n * Defines area to be clipped for display.\n */\n clippingArea?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/mapFloorInfo/\n * Contains floor-awareness information for the web scene.\n */\n mapFloorInfo?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/mapRangeInfo/\n * Map Range Information\n */\n mapRangeInfo?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/table/\n * An array of table objects.\n */\n tables?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/transportationNetwork/\n * Used to specify the transportation networks of the scene.\n */\n transportationNetworks?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/widgets/\n * The widgets object contains widgets that should be exposed to the user.\n */\n widgets?: any;\n};\n\n/**\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Presentation.html\n */\ntype ArcGisPresentation = {\n slides: Slide[];\n};\n\n/**\n * A slide stores a snapshot of several pre-set properties of the WebScene and SceneView,\n * such as the basemap, viewpoint and visible layers.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html\n */\ntype Slide = {\n id: string;\n title: {\n text: string;\n };\n thumbnail: {\n url: string;\n };\n description: {\n text: string;\n };\n ground: {\n transparency: number;\n };\n baseMap: ArcGisBaseMap;\n visibleLayers: ArcGisVisibleLayer[];\n viewpoint: ArcGisViewPoint;\n};\n\n/**\n * The basemap of the scene. Only the base and reference layers of the basemap are stored in a slide.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html\n */\ntype ArcGisBaseMap = {\n id: string;\n title: string;\n baseMapLayers: ArcGisBaseMapLayer[];\n};\n\n/**\n * The visible layers of the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#visibleLayers\n */\ntype ArcGisVisibleLayer = {\n id: string;\n sublayerIds: number[];\n};\n/**\n * The basemap of the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html\n */\ntype ArcGisBaseMapLayer = {\n id: string;\n title: string;\n url: string;\n layerType: string;\n visibility: boolean;\n};\n\n/**\n * The viewpoint of the slide. This acts like a bookmark, saving a predefined location or point of view from which to view the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Viewpoint.html\n */\ntype ArcGisViewPoint = {\n scale: number;\n rotation?: number;\n /**\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/viewpoint/\n */\n targetGeometry: any;\n camera: ArcGisCamera;\n};\n\n/**\n * The camera defines the position, tilt, and heading of the point from which the SceneView's visible extent is observed.\n * It is not associated with device hardware. This class only applies to 3D SceneViews.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Camera.html\n */\nexport type ArcGisCamera = {\n position: {\n x: number;\n y: number;\n z: number;\n };\n spatialReference: {\n wkid: number;\n latestWkid: number;\n };\n heading: number;\n tilt: number;\n};\n\n/**\n * Operational layers contain your data. Usually, a basemap sits beneath your operational layers to give them geographic context.\n * Spec- https://developers.arcgis.com/web-scene-specification/objects/operationalLayers/\n */\nexport type OperationalLayer = {\n id: string;\n opacity: number;\n title: string;\n url: string;\n visibility: boolean;\n itemId: string;\n layerType: string;\n LayerDefinition: LayerDefinition;\n screenSizePerspective: boolean;\n showLabels?: boolean;\n disablePopup?: boolean;\n showLegend?: boolean;\n layers?: OperationalLayer[];\n};\n\ntype LayerDefinition = {\n elevationInfo: ElevationInfo;\n drawingInfo: DrawingInfo;\n};\n\ntype BaseMap = {\n id: string;\n title: string;\n baseMapLayers: BaseMapLayer[];\n elevationLayers: ElevationLayer[];\n};\n\ntype BaseMapLayer = {\n id: string;\n opacity: number;\n title: string;\n url: string;\n visibility: boolean;\n layerType: string;\n};\n\ntype ElevationLayer = {\n id: string;\n listMode: string;\n title: string;\n url: string;\n visibility: boolean;\n layerType: string;\n};\n\ntype Ground = {\n layers: ElevationLayer[];\n transparency: number;\n navigationConstraint: NavigationConstraint;\n};\n\ntype NavigationConstraint = {\n type: string;\n};\n\ntype InitialState = {\n environment: Enviroment;\n viewpoint: ViewPoint;\n};\n\ntype Enviroment = {\n lighting: Lighting;\n atmosphereEnabled?: string;\n starsEnabled?: string;\n};\n\ntype Lighting = {\n datetime?: number;\n displayUTCOffset?: number;\n};\n\ntype ViewPoint = {\n camera: Camera;\n};\n\ntype Camera = {\n position: CameraPosition;\n heading: number;\n tilt: number;\n};\n\ntype CameraPosition = {\n spatialReference: SpatialReference;\n x: number;\n y: number;\n z: number;\n};\n\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/statsInfo.cmn.md\n */\nexport type StatsInfo = {\n /** Represents the count of the value. */\n totalValuesCount?: number;\n /** Minimum attribute value for the entire layer. */\n min?: number;\n /** Maximum attribute value for the entire layer. */\n max?: number;\n /** Count for the entire layer. */\n count?: number;\n /** Sum of the attribute values over the entire layer. */\n sum?: number;\n /** Representing average or mean value. For example, sum/count. */\n avg?: number;\n /** Representing the standard deviation. */\n stddev?: number;\n /**\tRepresenting variance. For example, stats.stddev *stats.stddev. */\n variance?: number;\n /** Represents the histogram. */\n histogram?: Histogram;\n /** An array of most frequently used values within the point cloud scene layer. */\n mostFrequentValues?: ValueCount[];\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/histogram.cmn.md */\nexport type Histogram = {\n /** Minimum attribute value for the entire layer. */\n minimum: number;\n /** Maximum attribute value for the entire layer. Maximum array size for stats.histo.counts is 256. */\n maximum: number;\n /** Count for the entire layer. */\n counts: number[];\n};\n\nexport type ValueCount = {\n /** Type of the attribute values after decompression, if applicable. Please note that string is not supported for point cloud scene layer attributes. */\n value: number | string;\n /** Count of the number of values. May exceed 32 bits. */\n count: number;\n};\n"],"mappings":";;;;;;IAIYA,SAAS,aAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAAAC,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAAA,IA6tBTE,uBAAuB,aAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;AAAAD,OAAA,CAAAC,uBAAA,GAAAA,uBAAA"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["DATA_TYPE","exports","HeaderAttributeProperty"],"sources":["../../src/types.ts"],"sourcesContent":["import type {Matrix4, Quaternion, Vector3} from '@math.gl/core';\nimport type {TypedArray, MeshAttribute, TextureLevel} from '@loaders.gl/schema';\nimport {Tile3D, Tileset3D} from '@loaders.gl/tiles';\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\nexport type COLOR = [number, number, number, number];\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\nexport type I3SParseOptions = {\n /** ArcGIS access token */\n token?: string;\n /** Is 3DSceneLayer json expected in response */\n isTileset?: string;\n /** Is 3DNodeIndexDocument json expected in response */\n isTileHeader?: string;\n /** Tile3D instance. This property used only to load tile content */\n /** Tile-specific options */\n _tileOptions?: I3STileOptions;\n /** Tileset-specific options */\n _tilesetOptions?: I3STilesetOptions;\n /** Load Draco Compressed geometry if available */\n useDracoGeometry?: boolean;\n /** Load compressed textures if available */\n useCompressedTextures?: boolean;\n /** Set false if don't need to parse textures */\n decodeTextures?: boolean;\n /** deck.gl compatible coordinate system.\n * https://github.com/visgl/deck.gl/blob/master/docs/developer-guide/coordinate-systems.md\n * Supported coordinate systems: METER_OFFSETS, LNGLAT_OFFSETS\n */\n coordinateSystem?: number;\n colorsByAttribute?: {\n attributeName: string;\n minValue: number;\n maxValue: number;\n minColor: COLOR;\n maxColor: COLOR;\n mode: string;\n };\n\n /** @deprecated */\n tile?: Tile3D | I3STileOptions;\n /** Tileset3D instance. This property used only to load tile content */\n /** @deprecated */\n tileset?: Tileset3D | I3STilesetOptions;\n};\n\nexport type I3STileOptions = {\n isDracoGeometry: boolean;\n textureUrl?: string;\n textureFormat?: I3STextureFormat;\n textureLoaderOptions?: any;\n materialDefinition?: I3SMaterialDefinition;\n attributeUrls: string[];\n mbs: Mbs;\n};\n\nexport type I3STilesetOptions = {\n store: Store;\n attributeStorageInfo: AttributeStorageInfo[];\n fields: Field[];\n};\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: number[] | 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 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\n/**\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitionInfo.cmn.md\n */\nexport type MaterialDefinitionInfo = {\n /** A name for the material as assigned in the creating application. */\n name?: string;\n /** Indicates the material type, chosen from the supported values. */\n type?: 'standard' | 'water' | 'billboard' | 'leafcard' | 'reference';\n /** The href that resolves to the shared resource bundle in which the material definition is contained. */\n $ref?: string;\n /** Parameter defined for the material.\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialParams.cmn.md\n */\n params: {\n /** Indicates transparency of this material; 0 = opaque, 1 = fully transparent. */\n transparency?: number;\n /** Indicates reflectivity of this material. */\n reflectivity?: number;\n /** Indicates shininess of this material. */\n shininess?: number;\n /** Ambient color of this material. Ambient color is the color of an object where it is in shadow.\n * This color is what the object reflects when illuminated by ambient light rather than direct light. */\n ambient?: number[];\n /** Diffuse color of this material. Diffuse color is the most instinctive meaning of the color of an object.\n * It is that essential color that the object reveals under pure white light. It is perceived as the color\n * of the object itself rather than a reflection of the light. */\n diffuse?: number[];\n /** Specular color of this material. Specular color is the color of the light of a specular reflection\n * (specular reflection is the type of reflection that is characteristic of light reflected from a shiny\n * surface). */\n specular?: number[];\n /** Rendering mode. */\n renderMode: 'textured' | 'solid' | 'untextured' | 'wireframe';\n /** TRUE if features with this material should cast shadows. */\n castShadows?: boolean;\n /** TRUE if features with this material should receive shadows */\n receiveShadows?: boolean;\n /** Indicates the material culling options {back, front, none}. */\n cullFace?: string;\n /** This flag indicates that the vertex color attribute of the geometry should be used to color the geometry\n * for rendering. If texture is present, the vertex colors are multiplied by this color.\n * e.g. pixel_color = [interpolated]vertex_color * texel_color. Default is false. */\n vertexColors?: boolean;\n /** This flag indicates that the geometry has uv region vertex attributes. These are used for adressing\n * subtextures in a texture atlas. The uv coordinates are relative to this subtexture in this case.\n * This is mostly useful for repeated textures in a texture atlas. Default is false. */\n vertexRegions?: boolean;\n /** Indicates whether Vertex Colors also contain a transparency channel. Default is false. */\n useVertexColorAlpha?: boolean;\n };\n};\n\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/sharedResource.cmn.md */\nexport type SharedResources = {\n /** Materials describe how a Feature or a set of Features is to be rendered. */\n materialDefinitions?: {[key: string]: MaterialDefinitionInfo};\n /** A Texture is a set of images, with some parameters specific to the texture/uv mapping to geometries. */\n textureDefinitions?: {[key: string]: TextureDefinitionInfo};\n};\n\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/image.cmn.md */\ntype TextureImage = {\n /** A unique ID for each image. Generated using the BuildID function. */\n id: string;\n /** width of this image, in pixels. */\n size?: number;\n /** The maximum size of a single pixel in world units.\n * This property is used by the client to pick the image to load and render. */\n pixelInWorldUnits?: number;\n /** The href to the image(s), one per encoding, in the same order as the encodings. */\n href?: string[];\n /** The byte offset of this image's encodings. There is one per encoding,\n * in the same order as the encodings, in the block in which this texture image resides. */\n byteOffset?: string[];\n /** The length in bytes of this image's encodings. There is one per encoding,\n * in the same order as the encodings. */\n length?: number[];\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 */\nexport type FullExtent = {\n /** left longitude in decimal degrees */\n xmin: number;\n /** right longitude in decimal degrees */\n xmax: number;\n /** bottom latitude in decimal degrees*/\n ymin: number;\n /** top latitude in decimal degrees*/\n ymax: number;\n /** lowest elevation in meters */\n zmin: number;\n /** highest elevation in meters */\n zmax: number;\n spatialReference?: SpatialReference;\n};\n\n/**\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureDefinitionInfo.cmn.md\n */\nexport type TextureDefinitionInfo = {\n /** MIMEtype - The encoding/content type that is used by all images in this map */\n encoding?: string[];\n /** UV wrapping modes, from {none, repeat, mirror}. */\n wrap?: string[];\n /** TRUE if the Map represents a texture atlas. */\n atlas?: boolean;\n /** The name of the UV set to be used as texture coordinates. */\n uvSet?: string;\n /** Indicates channels description. */\n channels?: 'rbg' | 'rgba' | string;\n /** An image is a binary resource, containing a single raster that can be used to texture a feature or symbol. */\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\nexport type ArcGisWebSceneData = {\n header: ArcGisWebScene;\n layers: OperationalLayer[];\n unsupportedLayers: OperationalLayer[];\n};\n\n/**\n * ArcGis WebScene spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport type ArcGisWebScene = {\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/applicationProperties/\n * Configuration of application and UI elements.\n */\n applicationProperties?: any;\n /**\n * Operational layers contain business data which are used to make thematic scenes.\n */\n operationalLayers: OperationalLayer[];\n /**\n * Basemaps give the web scene a geographic context.\n */\n baseMap: BaseMap;\n /**\n * Ground defines the main surface of the web scene, based on elevation layers.\n */\n ground: Ground;\n /**\n * An object that defines the characteristics of the vertical coordinate system used by the web scene.\n */\n heightModelInfo: HeightModelInfo;\n /**\n * Root element in the web scene specifying a string value indicating the web scene version.\n * Valid values: 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27\n */\n version: string;\n /**\n * String value indicating the application which authored the webmap\n */\n authoringApp: string;\n /**\n * String value indicating the authoring App's version number.\n */\n authoringAppVersion: string;\n /**\n * A presentation consists of multiple slides, where each slide is a specific view into the web scene.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/presentation/\n * @todo Add presentation type.\n */\n presentation: ArcGisPresentation;\n /**\n * An object that provides information about the initial environment settings and viewpoint of the web scene.\n */\n initialState: InitialState;\n /**\n * An object used to specify the spatial reference of the given geometry.\n */\n spatialReference: SpatialReference;\n viewingMode: 'global' | 'local';\n /**\n * @todo add type.\n * Defines area to be clipped for display.\n */\n clippingArea?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/mapFloorInfo/\n * Contains floor-awareness information for the web scene.\n */\n mapFloorInfo?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/mapRangeInfo/\n * Map Range Information\n */\n mapRangeInfo?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/table/\n * An array of table objects.\n */\n tables?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/transportationNetwork/\n * Used to specify the transportation networks of the scene.\n */\n transportationNetworks?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/widgets/\n * The widgets object contains widgets that should be exposed to the user.\n */\n widgets?: any;\n};\n\n/**\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Presentation.html\n */\ntype ArcGisPresentation = {\n slides: Slide[];\n};\n\n/**\n * A slide stores a snapshot of several pre-set properties of the WebScene and SceneView,\n * such as the basemap, viewpoint and visible layers.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html\n */\ntype Slide = {\n id: string;\n title: {\n text: string;\n };\n thumbnail: {\n url: string;\n };\n description: {\n text: string;\n };\n ground: {\n transparency: number;\n };\n baseMap: ArcGisBaseMap;\n visibleLayers: ArcGisVisibleLayer[];\n viewpoint: ArcGisViewPoint;\n};\n\n/**\n * The basemap of the scene. Only the base and reference layers of the basemap are stored in a slide.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html\n */\ntype ArcGisBaseMap = {\n id: string;\n title: string;\n baseMapLayers: ArcGisBaseMapLayer[];\n};\n\n/**\n * The visible layers of the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#visibleLayers\n */\ntype ArcGisVisibleLayer = {\n id: string;\n sublayerIds: number[];\n};\n/**\n * The basemap of the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html\n */\ntype ArcGisBaseMapLayer = {\n id: string;\n title: string;\n url: string;\n layerType: string;\n visibility: boolean;\n};\n\n/**\n * The viewpoint of the slide. This acts like a bookmark, saving a predefined location or point of view from which to view the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Viewpoint.html\n */\ntype ArcGisViewPoint = {\n scale: number;\n rotation?: number;\n /**\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/viewpoint/\n */\n targetGeometry: any;\n camera: ArcGisCamera;\n};\n\n/**\n * The camera defines the position, tilt, and heading of the point from which the SceneView's visible extent is observed.\n * It is not associated with device hardware. This class only applies to 3D SceneViews.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Camera.html\n */\nexport type ArcGisCamera = {\n position: {\n x: number;\n y: number;\n z: number;\n };\n spatialReference: {\n wkid: number;\n latestWkid: number;\n };\n heading: number;\n tilt: number;\n};\n\n/**\n * Operational layers contain your data. Usually, a basemap sits beneath your operational layers to give them geographic context.\n * Spec- https://developers.arcgis.com/web-scene-specification/objects/operationalLayers/\n */\nexport type OperationalLayer = {\n id: string;\n opacity: number;\n title: string;\n url: string;\n visibility: boolean;\n itemId: string;\n layerType: string;\n LayerDefinition: LayerDefinition;\n screenSizePerspective: boolean;\n showLabels?: boolean;\n disablePopup?: boolean;\n showLegend?: boolean;\n layers?: OperationalLayer[];\n};\n\ntype LayerDefinition = {\n elevationInfo: ElevationInfo;\n drawingInfo: DrawingInfo;\n};\n\ntype BaseMap = {\n id: string;\n title: string;\n baseMapLayers: BaseMapLayer[];\n elevationLayers: ElevationLayer[];\n};\n\ntype BaseMapLayer = {\n id: string;\n opacity: number;\n title: string;\n url: string;\n visibility: boolean;\n layerType: string;\n};\n\ntype ElevationLayer = {\n id: string;\n listMode: string;\n title: string;\n url: string;\n visibility: boolean;\n layerType: string;\n};\n\ntype Ground = {\n layers: ElevationLayer[];\n transparency: number;\n navigationConstraint: NavigationConstraint;\n};\n\ntype NavigationConstraint = {\n type: string;\n};\n\ntype InitialState = {\n environment: Enviroment;\n viewpoint: ViewPoint;\n};\n\ntype Enviroment = {\n lighting: Lighting;\n atmosphereEnabled?: string;\n starsEnabled?: string;\n};\n\ntype Lighting = {\n datetime?: number;\n displayUTCOffset?: number;\n};\n\ntype ViewPoint = {\n camera: Camera;\n};\n\ntype Camera = {\n position: CameraPosition;\n heading: number;\n tilt: number;\n};\n\ntype CameraPosition = {\n spatialReference: SpatialReference;\n x: number;\n y: number;\n z: number;\n};\n\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/statsInfo.cmn.md\n */\nexport type StatsInfo = {\n /** Represents the count of the value. */\n totalValuesCount?: number;\n /** Minimum attribute value for the entire layer. */\n min?: number;\n /** Maximum attribute value for the entire layer. */\n max?: number;\n /** Count for the entire layer. */\n count?: number;\n /** Sum of the attribute values over the entire layer. */\n sum?: number;\n /** Representing average or mean value. For example, sum/count. */\n avg?: number;\n /** Representing the standard deviation. */\n stddev?: number;\n /**\tRepresenting variance. For example, stats.stddev *stats.stddev. */\n variance?: number;\n /** Represents the histogram. */\n histogram?: Histogram;\n /** An array of most frequently used values within the point cloud scene layer. */\n mostFrequentValues?: ValueCount[];\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/histogram.cmn.md */\nexport type Histogram = {\n /** Minimum attribute value for the entire layer. */\n minimum: number;\n /** Maximum attribute value for the entire layer. Maximum array size for stats.histo.counts is 256. */\n maximum: number;\n /** Count for the entire layer. */\n counts: number[];\n};\n\nexport type ValueCount = {\n /** Type of the attribute values after decompression, if applicable. Please note that string is not supported for point cloud scene layer attributes. */\n value: number | string;\n /** Count of the number of values. May exceed 32 bits. */\n count: number;\n};\n"],"mappings":";;;;;;IAIYA,SAAS,aAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAAAC,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAAA,IA8tBTE,uBAAuB,aAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;AAAAD,OAAA,CAAAC,uBAAA,GAAAA,uBAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseWebscene } from './lib/parsers/parse-arcgis-webscene';
|
|
2
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
2
|
+
const VERSION = typeof "4.0.0-alpha.8" !== 'undefined' ? "4.0.0-alpha.8" : 'beta';
|
|
3
3
|
export const ArcGisWebSceneLoader = {
|
|
4
4
|
name: 'ArcGIS Web Scene Loader',
|
|
5
5
|
id: 'arcgis-web-scene',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { load } from '@loaders.gl/core';
|
|
2
2
|
import { parseI3STileAttribute } from './lib/parsers/parse-i3s-attribute';
|
|
3
3
|
import { getUrlWithToken } from './lib/utils/url-utils';
|
|
4
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
4
|
+
const VERSION = typeof "4.0.0-alpha.8" !== 'undefined' ? "4.0.0-alpha.8" : 'latest';
|
|
5
5
|
const EMPTY_VALUE = '';
|
|
6
6
|
const REJECTED_STATUS = 'rejected';
|
|
7
7
|
export const I3SAttributeLoader = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseBuildingSceneLayer } from './lib/parsers/parse-i3s-building-scene-layer';
|
|
2
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
2
|
+
const VERSION = typeof "4.0.0-alpha.8" !== 'undefined' ? "4.0.0-alpha.8" : 'beta';
|
|
3
3
|
export const I3SBuildingSceneLayerLoader = {
|
|
4
4
|
name: 'I3S Building Scene Layer',
|
|
5
5
|
id: 'i3s-building-scene-layer',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseI3STileContent } from './lib/parsers/parse-i3s-tile-content';
|
|
2
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
2
|
+
const VERSION = typeof "4.0.0-alpha.8" !== 'undefined' ? "4.0.0-alpha.8" : 'beta';
|
|
3
3
|
export const I3SContentLoader = {
|
|
4
4
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
5
5
|
id: 'i3s-content',
|
package/dist/esm/i3s-loader.js
CHANGED
|
@@ -2,7 +2,7 @@ import { parse } from '@loaders.gl/core';
|
|
|
2
2
|
import { I3SContentLoader } from './i3s-content-loader';
|
|
3
3
|
import { normalizeTileData, normalizeTilesetData } from './lib/parsers/parse-i3s';
|
|
4
4
|
import { COORDINATE_SYSTEM } from './lib/parsers/constants';
|
|
5
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
5
|
+
const VERSION = typeof "4.0.0-alpha.8" !== 'undefined' ? "4.0.0-alpha.8" : 'latest';
|
|
6
6
|
const TILESET_REGEX = /layers\/[0-9]+$/;
|
|
7
7
|
const TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
8
8
|
const SLPK_HEX = '504b0304';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
1
|
+
const VERSION = typeof "4.0.0-alpha.8" !== 'undefined' ? "4.0.0-alpha.8" : 'latest';
|
|
2
2
|
async function parseNodePage(data, options) {
|
|
3
3
|
return JSON.parse(new TextDecoder().decode(data));
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseSLPK } from './lib/parsers/parse-slpk/parse-slpk';
|
|
2
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
2
|
+
const VERSION = typeof "4.0.0-alpha.8" !== 'undefined' ? "4.0.0-alpha.8" : 'latest';
|
|
3
3
|
export const SLPKLoader = {
|
|
4
4
|
name: 'I3S SLPK (Scene Layer Package)',
|
|
5
5
|
id: 'slpk',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-slpk-loader.js","names":["parseSLPK","VERSION","SLPKLoader","name","id","module","version","mimeTypes","parse","extensions","options"],"sources":["../../src/i3s-slpk-loader.ts"],"sourcesContent":["import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parseSLPK} from './lib/parsers/parse-slpk/parse-slpk';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type SLPKLoaderOptions = LoaderOptions & {\n path?: string;\n
|
|
1
|
+
{"version":3,"file":"i3s-slpk-loader.js","names":["parseSLPK","VERSION","SLPKLoader","name","id","module","version","mimeTypes","parse","extensions","options"],"sources":["../../src/i3s-slpk-loader.ts"],"sourcesContent":["import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parseSLPK} from './lib/parsers/parse-slpk/parse-slpk';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type SLPKLoaderOptions = LoaderOptions & {\n slpk?: {\n path?: string;\n pathMode?: 'http' | 'raw';\n };\n};\n\n/**\n * Loader for SLPK - Scene Layer Package\n */\nexport const SLPKLoader: LoaderWithParser<Buffer, never, SLPKLoaderOptions> = {\n name: 'I3S SLPK (Scene Layer Package)',\n id: 'slpk',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseSLPK,\n extensions: ['slpk'],\n options: {}\n};\n"],"mappings":"AACA,SAAQA,SAAS,QAAO,qCAAqC;AAI7D,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAY3E,OAAO,MAAMC,UAA8D,GAAG;EAC5EC,IAAI,EAAE,gCAAgC;EACtCC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK,EAAER,SAAS;EAChBS,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["COORDINATE_SYSTEM","I3SLoader","SLPKLoader","I3SContentLoader","I3SAttributeLoader","loadFeatureAttributes","I3SBuildingSceneLayerLoader","I3SNodePageLoader","ArcGisWebSceneLoader"],"sources":["../../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type {\n BoundingVolumes,\n Mbs,\n Obb,\n SceneLayer3D,\n AttributeStorageInfo,\n Field,\n ESRIField,\n PopupInfo,\n Node3DIndexDocument,\n LodSelection,\n NodeReference,\n Resource,\n MaxScreenThresholdSQ,\n NodeInPage,\n SharedResources,\n Attribute,\n Extent,\n FeatureAttribute,\n FieldInfo,\n I3SMaterialDefinition,\n TextureDefinitionInfo,\n MaterialDefinitionInfo,\n FullExtent,\n StatisticsInfo,\n StatsInfo,\n Histogram,\n ValueCount,\n BuildingSceneSublayer,\n DATA_TYPE,\n OperationalLayer\n} from './types';\n\nexport {COORDINATE_SYSTEM} from './lib/parsers/constants';\n\nexport {I3SLoader} from './i3s-loader';\nexport {SLPKLoader} from './i3s-slpk-loader';\nexport {I3SContentLoader} from './i3s-content-loader';\nexport {I3SAttributeLoader, loadFeatureAttributes} from './i3s-attribute-loader';\nexport {I3SBuildingSceneLayerLoader} from './i3s-building-scene-layer-loader';\nexport {I3SNodePageLoader} from './i3s-node-page-loader';\nexport {ArcGisWebSceneLoader} from './arcgis-webscene-loader';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["COORDINATE_SYSTEM","I3SLoader","SLPKLoader","I3SContentLoader","I3SAttributeLoader","loadFeatureAttributes","I3SBuildingSceneLayerLoader","I3SNodePageLoader","ArcGisWebSceneLoader"],"sources":["../../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type {\n BoundingVolumes,\n Mbs,\n Obb,\n SceneLayer3D,\n AttributeStorageInfo,\n Field,\n ESRIField,\n PopupInfo,\n Node3DIndexDocument,\n LodSelection,\n NodeReference,\n Resource,\n MaxScreenThresholdSQ,\n NodeInPage,\n SharedResources,\n Attribute,\n Extent,\n FeatureAttribute,\n FieldInfo,\n I3SMaterialDefinition,\n TextureDefinitionInfo,\n MaterialDefinitionInfo,\n FullExtent,\n StatisticsInfo,\n StatsInfo,\n Histogram,\n ValueCount,\n BuildingSceneSublayer,\n DATA_TYPE,\n OperationalLayer,\n TextureSetDefinitionFormats\n} from './types';\n\nexport {COORDINATE_SYSTEM} from './lib/parsers/constants';\n\nexport {I3SLoader} from './i3s-loader';\nexport {SLPKLoader} from './i3s-slpk-loader';\nexport {I3SContentLoader} from './i3s-content-loader';\nexport {I3SAttributeLoader, loadFeatureAttributes} from './i3s-attribute-loader';\nexport {I3SBuildingSceneLayerLoader} from './i3s-building-scene-layer-loader';\nexport {I3SNodePageLoader} from './i3s-node-page-loader';\nexport {ArcGisWebSceneLoader} from './arcgis-webscene-loader';\n"],"mappings":"AAoCA,SAAQA,iBAAiB,QAAO,yBAAyB;AAEzD,SAAQC,SAAS,QAAO,cAAc;AACtC,SAAQC,UAAU,QAAO,mBAAmB;AAC5C,SAAQC,gBAAgB,QAAO,sBAAsB;AACrD,SAAQC,kBAAkB,EAAEC,qBAAqB,QAAO,wBAAwB;AAChF,SAAQC,2BAA2B,QAAO,mCAAmC;AAC7E,SAAQC,iBAAiB,QAAO,wBAAwB;AACxD,SAAQC,oBAAoB,QAAO,0BAA0B"}
|
|
@@ -7,7 +7,7 @@ import { BasisLoader, CompressedTextureLoader } from '@loaders.gl/textures';
|
|
|
7
7
|
import { HeaderAttributeProperty } from '../../types';
|
|
8
8
|
import { getUrlWithToken } from '../utils/url-utils';
|
|
9
9
|
import { GL_TYPE_MAP, getConstructorForDataFormat, sizeOf, COORDINATE_SYSTEM } from './constants';
|
|
10
|
-
import { customizeColors } from '../utils/
|
|
10
|
+
import { customizeColors } from '../utils/customize-сolors';
|
|
11
11
|
const scratchVector = new Vector3([0, 0, 0]);
|
|
12
12
|
function getLoaderForTextureFormat(textureFormat) {
|
|
13
13
|
switch (textureFormat) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-i3s-tile-content.js","names":["load","parse","Vector3","Matrix4","Ellipsoid","ImageLoader","DracoLoader","BasisLoader","CompressedTextureLoader","HeaderAttributeProperty","getUrlWithToken","GL_TYPE_MAP","getConstructorForDataFormat","sizeOf","COORDINATE_SYSTEM","customizeColors","scratchVector","getLoaderForTextureFormat","textureFormat","I3S_ATTRIBUTE_TYPE","parseI3STileContent","arrayBuffer","tileOptions","tilesetOptions","options","context","content","attributes","indices","featureIds","vertexCount","modelMatrix","coordinateSystem","byteLength","texture","textureUrl","_options$i3s","url","i3s","token","loader","response","fetch","decodeTextures","textureLoaderOptions","image","type","e","compressed","mipmaps","width","height","data","material","makePbrMaterial","materialDefinition","parseI3SNodeGeometry","_options$i3s2","contentByteLength","byteOffset","featureCount","isDracoGeometry","_decompressedGeometry","decompressedGeometry","draco","attributeNameEntry","header","value","POSITION","NORMAL","COLOR_0","TEXCOORD_0","featureIndex","uvRegion","position","normal","color","uv0","id","updateAttributesMetadata","getFeatureIdsFromFeatureIndexMetadata","flattenFeatureIdsByFeatureIndices","vertexAttributes","ordering","attributesOrder","featureAttributes","featureAttributeOrder","store","defaultGeometrySchema","headers","parseHeaders","normalizedVertexAttributes","offset","normalizeAttributes","normalizedFeatureAttributes","flattenFeatureIdsByFaceRanges","concatAttributes","METER_OFFSETS","enuMatrix","parsePositions","invert","getModelMatrix","LNGLAT_OFFSETS","positions","normals","colors","normalizeAttribute","texCoords","uvRegions","region","attributeIndex","key","loaderData","dracoAttribute","name","metadata","attribute","normalized","property","TypedArrayTypeHeader","attributeCount","valueType","valuesPerElement","buffer","slice","parseUint64Values","TypedArrayType","size","elementsCount","attributeSize","values","dataView","DataView","index","left","getUint32","right","push","Uint32Array","mbs","cartographicOrigin","cartesianOrigin","WGS84","cartographicToCartesian","eastNorthUpToFixedFrame","offsetsToCartesians","vertices","arguments","length","undefined","Float64Array","scaleX","double","scaleY","i","x","y","z","subarray","_metadata$i3sScale_x","_metadata$i3sScale_y","pbrMaterial","pbrMetallicRoughness","baseColorFactor","baseColorTexture","texCoord","alphaCutoff","alphaMode","toUpperCase","emissiveFactor","convertColorFormat","setMaterialTexture","colorFactor","normalizedColor","source","emissiveTexture","metallicRoughnessTexture","normalTexture","occlusionTexture","faceRange","range","featureIdsLength","orderedFeatureIndices","startIndex","fillId","Number","endValue","prevValue","trianglesCount","endIndex","fill","featureIndices","result","Float32Array","_featureIndex$metadat","_featureIndex$metadat2","intArray"],"sources":["../../../../src/lib/parsers/parse-i3s-tile-content.ts"],"sourcesContent":["import type {TypedArray} from '@loaders.gl/schema';\nimport {load, parse} from '@loaders.gl/core';\nimport {Vector3, Matrix4} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport type {LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport {ImageLoader} from '@loaders.gl/images';\nimport {DracoLoader, DracoMesh} from '@loaders.gl/draco';\nimport {BasisLoader, CompressedTextureLoader} from '@loaders.gl/textures';\n\nimport {\n FeatureAttribute,\n VertexAttribute,\n I3SMeshAttributes,\n I3SMeshAttribute,\n TileContentTexture,\n HeaderAttributeProperty,\n I3SMaterialDefinition,\n I3STileContent,\n I3STileOptions,\n I3STilesetOptions\n} from '../../types';\nimport {getUrlWithToken} from '../utils/url-utils';\n\nimport {GL_TYPE_MAP, getConstructorForDataFormat, sizeOf, COORDINATE_SYSTEM} from './constants';\nimport {I3SLoaderOptions} from '../../i3s-loader';\nimport {customizeColors} from '../utils/customizeColors';\n\nconst scratchVector = new Vector3([0, 0, 0]);\n\nfunction getLoaderForTextureFormat(textureFormat?: 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2') {\n switch (textureFormat) {\n case 'ktx-etc2':\n case 'dds':\n return CompressedTextureLoader;\n case 'ktx2':\n return BasisLoader;\n case 'jpg':\n case 'png':\n default:\n return ImageLoader;\n }\n}\n\nconst I3S_ATTRIBUTE_TYPE = 'i3s-attribute-type';\n\nexport async function parseI3STileContent(\n arrayBuffer: ArrayBuffer,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<I3STileContent> {\n const content: I3STileContent = {\n attributes: {},\n indices: null,\n featureIds: [],\n vertexCount: 0,\n modelMatrix: new Matrix4(),\n coordinateSystem: 0,\n byteLength: 0,\n texture: null\n };\n\n if (tileOptions.textureUrl) {\n // @ts-expect-error options is not properly typed\n const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);\n const loader = getLoaderForTextureFormat(tileOptions.textureFormat);\n const response = await fetch(url, options?.fetch as RequestInit);\n const arrayBuffer = await response.arrayBuffer();\n\n // @ts-expect-error options is not properly typed\n if (options?.i3s.decodeTextures) {\n if (loader === ImageLoader) {\n const options = {...tileOptions.textureLoaderOptions, image: {type: 'data'}};\n try {\n // @ts-ignore context must be defined\n // Image constructor is not supported in worker thread.\n // Do parsing image data on the main thread by using context to avoid worker issues.\n content.texture = await context.parse(arrayBuffer, options);\n } catch (e) {\n // context object is different between worker and node.js conversion script.\n // To prevent error we parse data in ordinary way if it is not parsed by using context.\n // @ts-expect-error\n content.texture = await parse(arrayBuffer, loader, options);\n }\n } else if (loader === CompressedTextureLoader || loader === BasisLoader) {\n let texture = await load(arrayBuffer, loader, tileOptions.textureLoaderOptions);\n if (loader === BasisLoader) {\n // @ts-expect-error\n texture = texture[0];\n }\n content.texture = {\n compressed: true,\n mipmaps: false,\n // @ts-expect-error\n width: texture[0].width,\n // @ts-expect-error\n height: texture[0].height,\n // @ts-expect-error\n data: texture\n };\n }\n } else {\n content.texture = arrayBuffer;\n }\n }\n\n content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);\n if (content.material) {\n content.texture = null;\n }\n\n return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);\n}\n\n/* eslint-disable max-statements */\nasync function parseI3SNodeGeometry(\n arrayBuffer: ArrayBuffer,\n content: I3STileContent,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<I3STileContent> {\n const contentByteLength = arrayBuffer.byteLength;\n let attributes: I3SMeshAttributes;\n let vertexCount: number;\n let byteOffset: number = 0;\n let featureCount: number = 0;\n let indices: TypedArray | undefined;\n\n if (tileOptions.isDracoGeometry) {\n const decompressedGeometry: DracoMesh = await parse(arrayBuffer, DracoLoader, {\n draco: {\n attributeNameEntry: I3S_ATTRIBUTE_TYPE\n }\n });\n // @ts-expect-error\n vertexCount = decompressedGeometry.header.vertexCount;\n indices = decompressedGeometry.indices?.value;\n const {\n POSITION,\n NORMAL,\n COLOR_0,\n TEXCOORD_0,\n ['feature-index']: featureIndex,\n ['uv-region']: uvRegion\n } = decompressedGeometry.attributes;\n\n attributes = {\n position: POSITION,\n normal: NORMAL,\n color: COLOR_0,\n uv0: TEXCOORD_0,\n uvRegion,\n id: featureIndex\n };\n\n updateAttributesMetadata(attributes, decompressedGeometry);\n\n const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);\n\n if (featureIds) {\n flattenFeatureIdsByFeatureIndices(attributes, featureIds);\n }\n } else {\n const {\n vertexAttributes,\n ordering: attributesOrder,\n featureAttributes,\n featureAttributeOrder\n } = tilesetOptions.store.defaultGeometrySchema;\n // First 8 bytes reserved for header (vertexCount and featureCount)\n const headers = parseHeaders(arrayBuffer, tilesetOptions);\n byteOffset = headers.byteOffset;\n vertexCount = headers.vertexCount;\n featureCount = headers.featureCount;\n // Getting vertex attributes such as positions, normals, colors, etc...\n const {attributes: normalizedVertexAttributes, byteOffset: offset} = normalizeAttributes(\n arrayBuffer,\n byteOffset,\n vertexAttributes,\n vertexCount,\n attributesOrder\n );\n\n // Getting feature attributes such as featureIds and faceRange\n const {attributes: normalizedFeatureAttributes} = normalizeAttributes(\n arrayBuffer,\n offset,\n featureAttributes,\n featureCount,\n featureAttributeOrder\n );\n\n flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);\n attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);\n }\n\n if (\n !options?.i3s?.coordinateSystem ||\n options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS\n ) {\n const enuMatrix = parsePositions(attributes.position, tileOptions);\n content.modelMatrix = enuMatrix.invert();\n content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;\n } else {\n content.modelMatrix = getModelMatrix(attributes.position);\n content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;\n }\n\n attributes.color = await customizeColors(\n attributes.color,\n attributes.id,\n tileOptions,\n tilesetOptions,\n options\n );\n\n content.attributes = {\n positions: attributes.position,\n normals: attributes.normal,\n colors: normalizeAttribute(attributes.color), // Normalize from UInt8\n texCoords: attributes.uv0,\n uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region) // Normalize from UInt16\n };\n content.indices = indices || null;\n\n if (attributes.id && attributes.id.value) {\n content.featureIds = attributes.id.value;\n }\n\n // Remove undefined attributes\n for (const attributeIndex in content.attributes) {\n if (!content.attributes[attributeIndex]) {\n delete content.attributes[attributeIndex];\n }\n }\n\n content.vertexCount = vertexCount;\n content.byteLength = contentByteLength;\n\n return content;\n}\n\n/**\n * Update attributes with metadata from decompressed geometry.\n * @param decompressedGeometry\n * @param attributes\n */\nfunction updateAttributesMetadata(\n attributes: I3SMeshAttributes,\n decompressedGeometry: DracoMesh\n): void {\n for (const key in decompressedGeometry.loaderData.attributes) {\n const dracoAttribute = decompressedGeometry.loaderData.attributes[key];\n\n switch (dracoAttribute.name) {\n case 'POSITION':\n attributes.position.metadata = dracoAttribute.metadata;\n break;\n case 'feature-index':\n attributes.id.metadata = dracoAttribute.metadata;\n break;\n default:\n break;\n }\n }\n}\n\n/**\n * Do concatenation of attribute objects.\n * Done as separate fucntion to avoid ts errors.\n * @param normalizedVertexAttributes\n * @param normalizedFeatureAttributes\n * @returns - result of attributes concatenation.\n */\nfunction concatAttributes(\n normalizedVertexAttributes: I3SMeshAttributes,\n normalizedFeatureAttributes: I3SMeshAttributes\n): I3SMeshAttributes {\n return {...normalizedVertexAttributes, ...normalizedFeatureAttributes};\n}\n\n/**\n * Normalize attribute to range [0..1] . Eg. convert colors buffer from [255,255,255,255] to [1,1,1,1]\n * @param attribute - geometry attribute\n * @returns - geometry attribute in right format\n */\nfunction normalizeAttribute(attribute: I3SMeshAttribute): I3SMeshAttribute {\n if (!attribute) {\n return attribute;\n }\n attribute.normalized = true;\n return attribute;\n}\n\nfunction parseHeaders(arrayBuffer: ArrayBuffer, options: I3STilesetOptions) {\n let byteOffset = 0;\n // First 8 bytes reserved for header (vertexCount and featurecount)\n let vertexCount = 0;\n let featureCount = 0;\n for (const {property, type} of options.store.defaultGeometrySchema.header) {\n const TypedArrayTypeHeader = getConstructorForDataFormat(type);\n switch (property) {\n case HeaderAttributeProperty.vertexCount:\n vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];\n byteOffset += sizeOf(type);\n break;\n case HeaderAttributeProperty.featureCount:\n featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];\n byteOffset += sizeOf(type);\n break;\n default:\n break;\n }\n }\n\n return {\n vertexCount,\n featureCount,\n byteOffset\n };\n}\n\n/* eslint-enable max-statements */\n\nfunction normalizeAttributes(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n vertexAttributes: VertexAttribute | FeatureAttribute,\n attributeCount: number,\n attributesOrder: string[]\n) {\n const attributes: I3SMeshAttributes = {};\n\n // the order of attributes depend on the order being added to the vertexAttributes object\n for (const attribute of attributesOrder) {\n if (vertexAttributes[attribute]) {\n const {valueType, valuesPerElement}: {valueType: string; valuesPerElement: number} =\n vertexAttributes[attribute];\n // protect from arrayBuffer read overunns by NOT assuming node has regions always even though its declared in defaultGeometrySchema.\n // In i3s 1.6: client is required to decide that based on ./shared resource of the node (materialDefinitions.[Mat_id].params.vertexRegions == true)\n // In i3s 1.7 the property has been rolled into the 3d scene layer json/node pages.\n // Code below does not account when the bytelength is actually bigger than\n // the calculated value (b\\c the tile potentially could have mesh segmentation information).\n // In those cases tiles without regions could fail or have garbage values.\n if (\n byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <=\n arrayBuffer.byteLength\n ) {\n const buffer = arrayBuffer.slice(byteOffset);\n let value: TypedArray;\n\n if (valueType === 'UInt64') {\n value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));\n } else {\n const TypedArrayType = getConstructorForDataFormat(valueType);\n value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);\n }\n\n attributes[attribute] = {\n value,\n type: GL_TYPE_MAP[valueType],\n size: valuesPerElement\n };\n\n switch (attribute) {\n case 'color':\n attributes.color.normalized = true;\n break;\n case 'position':\n case 'region':\n case 'normal':\n default:\n }\n\n byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);\n } else if (attribute !== 'uv0') {\n break;\n }\n }\n }\n\n return {attributes, byteOffset};\n}\n\n/**\n * Parse buffer to return array of uint64 values\n *\n * @param buffer\n * @param elementsCount\n * @returns 64-bit array of values until precision is lost after Number.MAX_SAFE_INTEGER\n */\nfunction parseUint64Values(\n buffer: ArrayBuffer,\n elementsCount: number,\n attributeSize: number\n): Uint32Array {\n const values: number[] = [];\n const dataView = new DataView(buffer);\n let offset = 0;\n\n for (let index = 0; index < elementsCount; index++) {\n // split 64-bit number into two 32-bit parts\n const left = dataView.getUint32(offset, true);\n const right = dataView.getUint32(offset + 4, true);\n // combine the two 32-bit values\n const value = left + 2 ** 32 * right;\n\n values.push(value);\n offset += attributeSize;\n }\n\n return new Uint32Array(values);\n}\n\nfunction parsePositions(attribute: I3SMeshAttribute, options: I3STileOptions): Matrix4 {\n const mbs = options.mbs;\n const value = attribute.value;\n const metadata = attribute.metadata;\n const enuMatrix = new Matrix4();\n const cartographicOrigin = new Vector3(mbs[0], mbs[1], mbs[2]);\n const cartesianOrigin = new Vector3();\n Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);\n Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);\n attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);\n\n return enuMatrix;\n}\n\n/**\n * Converts position coordinates to absolute cartesian coordinates\n * @param vertices - \"position\" attribute data\n * @param metadata - When the geometry is DRACO compressed, contain position attribute's metadata\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/compressedAttributes.cmn.md\n * @param cartographicOrigin - Cartographic origin coordinates\n * @returns - converted \"position\" data\n */\nfunction offsetsToCartesians(\n vertices: number[] | TypedArray,\n metadata: any = {},\n cartographicOrigin: Vector3\n): Float64Array {\n const positions = new Float64Array(vertices.length);\n const scaleX = (metadata['i3s-scale_x'] && metadata['i3s-scale_x'].double) || 1;\n const scaleY = (metadata['i3s-scale_y'] && metadata['i3s-scale_y'].double) || 1;\n for (let i = 0; i < positions.length; i += 3) {\n positions[i] = vertices[i] * scaleX + cartographicOrigin.x;\n positions[i + 1] = vertices[i + 1] * scaleY + cartographicOrigin.y;\n positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;\n }\n\n for (let i = 0; i < positions.length; i += 3) {\n // @ts-ignore\n Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector);\n positions[i] = scratchVector.x;\n positions[i + 1] = scratchVector.y;\n positions[i + 2] = scratchVector.z;\n }\n\n return positions;\n}\n\n/**\n * Get model matrix for loaded vertices\n * @param positions positions attribute\n * @returns Matrix4 - model matrix for geometry transformation\n */\nfunction getModelMatrix(positions: I3SMeshAttribute): Matrix4 {\n const metadata = positions.metadata;\n const scaleX: number = metadata?.['i3s-scale_x']?.double || 1;\n const scaleY: number = metadata?.['i3s-scale_y']?.double || 1;\n const modelMatrix = new Matrix4();\n modelMatrix[0] = scaleX;\n modelMatrix[5] = scaleY;\n return modelMatrix;\n}\n\n/**\n * Makes a glTF-compatible PBR material from an I3S material definition\n * @param materialDefinition - i3s material definition\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n * @param texture - texture image\n * @returns {object}\n */\nfunction makePbrMaterial(materialDefinition?: I3SMaterialDefinition, texture?: TileContentTexture) {\n let pbrMaterial;\n if (materialDefinition) {\n pbrMaterial = {\n ...materialDefinition,\n pbrMetallicRoughness: materialDefinition.pbrMetallicRoughness\n ? {...materialDefinition.pbrMetallicRoughness}\n : {baseColorFactor: [255, 255, 255, 255]}\n };\n } else {\n pbrMaterial = {\n pbrMetallicRoughness: {}\n };\n if (texture) {\n pbrMaterial.pbrMetallicRoughness.baseColorTexture = {texCoord: 0};\n } else {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = [255, 255, 255, 255];\n }\n }\n\n // Set default 0.25 per spec https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n pbrMaterial.alphaCutoff = pbrMaterial.alphaCutoff || 0.25;\n\n if (pbrMaterial.alphaMode) {\n // I3S contain alphaMode in lowerCase\n pbrMaterial.alphaMode = pbrMaterial.alphaMode.toUpperCase();\n }\n\n // Convert colors from [255,255,255,255] to [1,1,1,1]\n if (pbrMaterial.emissiveFactor) {\n pbrMaterial.emissiveFactor = convertColorFormat(pbrMaterial.emissiveFactor);\n }\n if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(\n pbrMaterial.pbrMetallicRoughness.baseColorFactor\n );\n }\n\n if (texture) {\n setMaterialTexture(pbrMaterial, texture);\n }\n\n return pbrMaterial;\n}\n\n/**\n * Convert color from [255,255,255,255] to [1,1,1,1]\n * @param colorFactor - color array\n * @returns - new color array\n */\nfunction convertColorFormat(colorFactor: number[]): number[] {\n const normalizedColor = [...colorFactor];\n for (let index = 0; index < colorFactor.length; index++) {\n normalizedColor[index] = colorFactor[index] / 255;\n }\n return normalizedColor;\n}\n\n/**\n * Set texture in PBR material\n * @param {object} material - i3s material definition\n * @param image - texture image\n * @returns\n */\nfunction setMaterialTexture(material, image: TileContentTexture): void {\n const texture = {source: {image}};\n // I3SLoader now support loading only one texture. This elseif sequence will assign this texture to one of\n // properties defined in materialDefinition\n if (material.pbrMetallicRoughness && material.pbrMetallicRoughness.baseColorTexture) {\n material.pbrMetallicRoughness.baseColorTexture = {\n ...material.pbrMetallicRoughness.baseColorTexture,\n texture\n };\n } else if (material.emissiveTexture) {\n material.emissiveTexture = {...material.emissiveTexture, texture};\n } else if (\n material.pbrMetallicRoughness &&\n material.pbrMetallicRoughness.metallicRoughnessTexture\n ) {\n material.pbrMetallicRoughness.metallicRoughnessTexture = {\n ...material.pbrMetallicRoughness.metallicRoughnessTexture,\n texture\n };\n } else if (material.normalTexture) {\n material.normalTexture = {...material.normalTexture, texture};\n } else if (material.occlusionTexture) {\n material.occlusionTexture = {...material.occlusionTexture, texture};\n }\n}\n\n/**\n * Flatten feature ids using face ranges\n * @param normalizedFeatureAttributes\n * @returns\n */\nfunction flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes: I3SMeshAttributes): void {\n const {id, faceRange} = normalizedFeatureAttributes;\n\n if (!id || !faceRange) {\n return;\n }\n\n const featureIds = id.value;\n const range = faceRange.value;\n const featureIdsLength = range[range.length - 1] + 1;\n const orderedFeatureIndices = new Uint32Array(featureIdsLength * 3);\n\n let featureIndex = 0;\n let startIndex = 0;\n\n for (let index = 1; index < range.length; index += 2) {\n const fillId = Number(featureIds[featureIndex]);\n const endValue = range[index];\n const prevValue = range[index - 1];\n const trianglesCount = endValue - prevValue + 1;\n const endIndex = startIndex + trianglesCount * 3;\n\n orderedFeatureIndices.fill(fillId, startIndex, endIndex);\n\n featureIndex++;\n startIndex = endIndex;\n }\n\n normalizedFeatureAttributes.id.value = orderedFeatureIndices;\n}\n\n/**\n * Flatten feature ids using featureIndices\n * @param attributes\n * @param featureIds\n * @returns\n */\nfunction flattenFeatureIdsByFeatureIndices(\n attributes: I3SMeshAttributes,\n featureIds: Int32Array\n): void {\n const featureIndices = attributes.id.value;\n const result = new Float32Array(featureIndices.length);\n\n for (let index = 0; index < featureIndices.length; index++) {\n result[index] = featureIds[featureIndices[index]];\n }\n\n attributes.id.value = result;\n}\n\n/**\n * Flatten feature ids using featureIndices\n * @param featureIndex\n * @returns\n */\nfunction getFeatureIdsFromFeatureIndexMetadata(\n featureIndex: I3SMeshAttribute\n): Int32Array | undefined {\n return featureIndex?.metadata?.['i3s-feature-ids']?.intArray;\n}\n"],"mappings":"AACA,SAAQA,IAAI,EAAEC,KAAK,QAAO,kBAAkB;AAC5C,SAAQC,OAAO,EAAEC,OAAO,QAAO,eAAe;AAC9C,SAAQC,SAAS,QAAO,qBAAqB;AAE7C,SAAQC,WAAW,QAAO,oBAAoB;AAC9C,SAAQC,WAAW,QAAkB,mBAAmB;AACxD,SAAQC,WAAW,EAAEC,uBAAuB,QAAO,sBAAsB;AAEzE,SAMEC,uBAAuB,QAKlB,aAAa;AACpB,SAAQC,eAAe,QAAO,oBAAoB;AAElD,SAAQC,WAAW,EAAEC,2BAA2B,EAAEC,MAAM,EAAEC,iBAAiB,QAAO,aAAa;AAE/F,SAAQC,eAAe,QAAO,0BAA0B;AAExD,MAAMC,aAAa,GAAG,IAAId,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5C,SAASe,yBAAyBA,CAACC,aAA2D,EAAE;EAC9F,QAAQA,aAAa;IACnB,KAAK,UAAU;IACf,KAAK,KAAK;MACR,OAAOV,uBAAuB;IAChC,KAAK,MAAM;MACT,OAAOD,WAAW;IACpB,KAAK,KAAK;IACV,KAAK,KAAK;IACV;MACE,OAAOF,WAAW;EACtB;AACF;AAEA,MAAMc,kBAAkB,GAAG,oBAAoB;AAE/C,OAAO,eAAeC,mBAAmBA,CACvCC,WAAwB,EACxBC,WAA2B,EAC3BC,cAAiC,EACjCC,OAAuB,EACvBC,OAAuB,EACE;EACzB,MAAMC,OAAuB,GAAG;IAC9BC,UAAU,EAAE,CAAC,CAAC;IACdC,OAAO,EAAE,IAAI;IACbC,UAAU,EAAE,EAAE;IACdC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,IAAI5B,OAAO,CAAC,CAAC;IAC1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9B;AAOA,SAAShH,qCAAqCA,CAC5CR,YAA8B,EACN;EAAA,IAAA0H,qBAAA,EAAAC,sBAAA;EACxB,OAAO3H,YAAY,aAAZA,YAAY,wBAAA0H,qBAAA,GAAZ1H,YAAY,CAAE2C,QAAQ,cAAA+E,qBAAA,wBAAAC,sBAAA,GAAtBD,qBAAA,CAAyB,iBAAiB,CAAC,cAAAC,sBAAA,uBAA3CA,sBAAA,CAA6CC,QAAQ;AAC9D"}
|
|
1
|
+
{"version":3,"file":"parse-i3s-tile-content.js","names":["load","parse","Vector3","Matrix4","Ellipsoid","ImageLoader","DracoLoader","BasisLoader","CompressedTextureLoader","HeaderAttributeProperty","getUrlWithToken","GL_TYPE_MAP","getConstructorForDataFormat","sizeOf","COORDINATE_SYSTEM","customizeColors","scratchVector","getLoaderForTextureFormat","textureFormat","I3S_ATTRIBUTE_TYPE","parseI3STileContent","arrayBuffer","tileOptions","tilesetOptions","options","context","content","attributes","indices","featureIds","vertexCount","modelMatrix","coordinateSystem","byteLength","texture","textureUrl","_options$i3s","url","i3s","token","loader","response","fetch","decodeTextures","textureLoaderOptions","image","type","e","compressed","mipmaps","width","height","data","material","makePbrMaterial","materialDefinition","parseI3SNodeGeometry","_options$i3s2","contentByteLength","byteOffset","featureCount","isDracoGeometry","_decompressedGeometry","decompressedGeometry","draco","attributeNameEntry","header","value","POSITION","NORMAL","COLOR_0","TEXCOORD_0","featureIndex","uvRegion","position","normal","color","uv0","id","updateAttributesMetadata","getFeatureIdsFromFeatureIndexMetadata","flattenFeatureIdsByFeatureIndices","vertexAttributes","ordering","attributesOrder","featureAttributes","featureAttributeOrder","store","defaultGeometrySchema","headers","parseHeaders","normalizedVertexAttributes","offset","normalizeAttributes","normalizedFeatureAttributes","flattenFeatureIdsByFaceRanges","concatAttributes","METER_OFFSETS","enuMatrix","parsePositions","invert","getModelMatrix","LNGLAT_OFFSETS","positions","normals","colors","normalizeAttribute","texCoords","uvRegions","region","attributeIndex","key","loaderData","dracoAttribute","name","metadata","attribute","normalized","property","TypedArrayTypeHeader","attributeCount","valueType","valuesPerElement","buffer","slice","parseUint64Values","TypedArrayType","size","elementsCount","attributeSize","values","dataView","DataView","index","left","getUint32","right","push","Uint32Array","mbs","cartographicOrigin","cartesianOrigin","WGS84","cartographicToCartesian","eastNorthUpToFixedFrame","offsetsToCartesians","vertices","arguments","length","undefined","Float64Array","scaleX","double","scaleY","i","x","y","z","subarray","_metadata$i3sScale_x","_metadata$i3sScale_y","pbrMaterial","pbrMetallicRoughness","baseColorFactor","baseColorTexture","texCoord","alphaCutoff","alphaMode","toUpperCase","emissiveFactor","convertColorFormat","setMaterialTexture","colorFactor","normalizedColor","source","emissiveTexture","metallicRoughnessTexture","normalTexture","occlusionTexture","faceRange","range","featureIdsLength","orderedFeatureIndices","startIndex","fillId","Number","endValue","prevValue","trianglesCount","endIndex","fill","featureIndices","result","Float32Array","_featureIndex$metadat","_featureIndex$metadat2","intArray"],"sources":["../../../../src/lib/parsers/parse-i3s-tile-content.ts"],"sourcesContent":["import type {TypedArray} from '@loaders.gl/schema';\nimport {load, parse} from '@loaders.gl/core';\nimport {Vector3, Matrix4} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport type {LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport {ImageLoader} from '@loaders.gl/images';\nimport {DracoLoader, DracoMesh} from '@loaders.gl/draco';\nimport {BasisLoader, CompressedTextureLoader} from '@loaders.gl/textures';\n\nimport {\n FeatureAttribute,\n VertexAttribute,\n I3SMeshAttributes,\n I3SMeshAttribute,\n TileContentTexture,\n HeaderAttributeProperty,\n I3SMaterialDefinition,\n I3STileContent,\n I3STileOptions,\n I3STilesetOptions\n} from '../../types';\nimport {getUrlWithToken} from '../utils/url-utils';\n\nimport {GL_TYPE_MAP, getConstructorForDataFormat, sizeOf, COORDINATE_SYSTEM} from './constants';\nimport {I3SLoaderOptions} from '../../i3s-loader';\nimport {customizeColors} from '../utils/customize-сolors';\n\nconst scratchVector = new Vector3([0, 0, 0]);\n\nfunction getLoaderForTextureFormat(textureFormat?: 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2') {\n switch (textureFormat) {\n case 'ktx-etc2':\n case 'dds':\n return CompressedTextureLoader;\n case 'ktx2':\n return BasisLoader;\n case 'jpg':\n case 'png':\n default:\n return ImageLoader;\n }\n}\n\nconst I3S_ATTRIBUTE_TYPE = 'i3s-attribute-type';\n\nexport async function parseI3STileContent(\n arrayBuffer: ArrayBuffer,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<I3STileContent> {\n const content: I3STileContent = {\n attributes: {},\n indices: null,\n featureIds: [],\n vertexCount: 0,\n modelMatrix: new Matrix4(),\n coordinateSystem: 0,\n byteLength: 0,\n texture: null\n };\n\n if (tileOptions.textureUrl) {\n // @ts-expect-error options is not properly typed\n const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);\n const loader = getLoaderForTextureFormat(tileOptions.textureFormat);\n const response = await fetch(url, options?.fetch as RequestInit);\n const arrayBuffer = await response.arrayBuffer();\n\n // @ts-expect-error options is not properly typed\n if (options?.i3s.decodeTextures) {\n if (loader === ImageLoader) {\n const options = {...tileOptions.textureLoaderOptions, image: {type: 'data'}};\n try {\n // @ts-ignore context must be defined\n // Image constructor is not supported in worker thread.\n // Do parsing image data on the main thread by using context to avoid worker issues.\n content.texture = await context.parse(arrayBuffer, options);\n } catch (e) {\n // context object is different between worker and node.js conversion script.\n // To prevent error we parse data in ordinary way if it is not parsed by using context.\n // @ts-expect-error\n content.texture = await parse(arrayBuffer, loader, options);\n }\n } else if (loader === CompressedTextureLoader || loader === BasisLoader) {\n let texture = await load(arrayBuffer, loader, tileOptions.textureLoaderOptions);\n if (loader === BasisLoader) {\n // @ts-expect-error\n texture = texture[0];\n }\n content.texture = {\n compressed: true,\n mipmaps: false,\n // @ts-expect-error\n width: texture[0].width,\n // @ts-expect-error\n height: texture[0].height,\n // @ts-expect-error\n data: texture\n };\n }\n } else {\n content.texture = arrayBuffer;\n }\n }\n\n content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);\n if (content.material) {\n content.texture = null;\n }\n\n return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);\n}\n\n/* eslint-disable max-statements */\nasync function parseI3SNodeGeometry(\n arrayBuffer: ArrayBuffer,\n content: I3STileContent,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<I3STileContent> {\n const contentByteLength = arrayBuffer.byteLength;\n let attributes: I3SMeshAttributes;\n let vertexCount: number;\n let byteOffset: number = 0;\n let featureCount: number = 0;\n let indices: TypedArray | undefined;\n\n if (tileOptions.isDracoGeometry) {\n const decompressedGeometry: DracoMesh = await parse(arrayBuffer, DracoLoader, {\n draco: {\n attributeNameEntry: I3S_ATTRIBUTE_TYPE\n }\n });\n // @ts-expect-error\n vertexCount = decompressedGeometry.header.vertexCount;\n indices = decompressedGeometry.indices?.value;\n const {\n POSITION,\n NORMAL,\n COLOR_0,\n TEXCOORD_0,\n ['feature-index']: featureIndex,\n ['uv-region']: uvRegion\n } = decompressedGeometry.attributes;\n\n attributes = {\n position: POSITION,\n normal: NORMAL,\n color: COLOR_0,\n uv0: TEXCOORD_0,\n uvRegion,\n id: featureIndex\n };\n\n updateAttributesMetadata(attributes, decompressedGeometry);\n\n const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);\n\n if (featureIds) {\n flattenFeatureIdsByFeatureIndices(attributes, featureIds);\n }\n } else {\n const {\n vertexAttributes,\n ordering: attributesOrder,\n featureAttributes,\n featureAttributeOrder\n } = tilesetOptions.store.defaultGeometrySchema;\n // First 8 bytes reserved for header (vertexCount and featureCount)\n const headers = parseHeaders(arrayBuffer, tilesetOptions);\n byteOffset = headers.byteOffset;\n vertexCount = headers.vertexCount;\n featureCount = headers.featureCount;\n // Getting vertex attributes such as positions, normals, colors, etc...\n const {attributes: normalizedVertexAttributes, byteOffset: offset} = normalizeAttributes(\n arrayBuffer,\n byteOffset,\n vertexAttributes,\n vertexCount,\n attributesOrder\n );\n\n // Getting feature attributes such as featureIds and faceRange\n const {attributes: normalizedFeatureAttributes} = normalizeAttributes(\n arrayBuffer,\n offset,\n featureAttributes,\n featureCount,\n featureAttributeOrder\n );\n\n flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);\n attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);\n }\n\n if (\n !options?.i3s?.coordinateSystem ||\n options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS\n ) {\n const enuMatrix = parsePositions(attributes.position, tileOptions);\n content.modelMatrix = enuMatrix.invert();\n content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;\n } else {\n content.modelMatrix = getModelMatrix(attributes.position);\n content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;\n }\n\n attributes.color = await customizeColors(\n attributes.color,\n attributes.id,\n tileOptions,\n tilesetOptions,\n options\n );\n\n content.attributes = {\n positions: attributes.position,\n normals: attributes.normal,\n colors: normalizeAttribute(attributes.color), // Normalize from UInt8\n texCoords: attributes.uv0,\n uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region) // Normalize from UInt16\n };\n content.indices = indices || null;\n\n if (attributes.id && attributes.id.value) {\n content.featureIds = attributes.id.value;\n }\n\n // Remove undefined attributes\n for (const attributeIndex in content.attributes) {\n if (!content.attributes[attributeIndex]) {\n delete content.attributes[attributeIndex];\n }\n }\n\n content.vertexCount = vertexCount;\n content.byteLength = contentByteLength;\n\n return content;\n}\n\n/**\n * Update attributes with metadata from decompressed geometry.\n * @param decompressedGeometry\n * @param attributes\n */\nfunction updateAttributesMetadata(\n attributes: I3SMeshAttributes,\n decompressedGeometry: DracoMesh\n): void {\n for (const key in decompressedGeometry.loaderData.attributes) {\n const dracoAttribute = decompressedGeometry.loaderData.attributes[key];\n\n switch (dracoAttribute.name) {\n case 'POSITION':\n attributes.position.metadata = dracoAttribute.metadata;\n break;\n case 'feature-index':\n attributes.id.metadata = dracoAttribute.metadata;\n break;\n default:\n break;\n }\n }\n}\n\n/**\n * Do concatenation of attribute objects.\n * Done as separate fucntion to avoid ts errors.\n * @param normalizedVertexAttributes\n * @param normalizedFeatureAttributes\n * @returns - result of attributes concatenation.\n */\nfunction concatAttributes(\n normalizedVertexAttributes: I3SMeshAttributes,\n normalizedFeatureAttributes: I3SMeshAttributes\n): I3SMeshAttributes {\n return {...normalizedVertexAttributes, ...normalizedFeatureAttributes};\n}\n\n/**\n * Normalize attribute to range [0..1] . Eg. convert colors buffer from [255,255,255,255] to [1,1,1,1]\n * @param attribute - geometry attribute\n * @returns - geometry attribute in right format\n */\nfunction normalizeAttribute(attribute: I3SMeshAttribute): I3SMeshAttribute {\n if (!attribute) {\n return attribute;\n }\n attribute.normalized = true;\n return attribute;\n}\n\nfunction parseHeaders(arrayBuffer: ArrayBuffer, options: I3STilesetOptions) {\n let byteOffset = 0;\n // First 8 bytes reserved for header (vertexCount and featurecount)\n let vertexCount = 0;\n let featureCount = 0;\n for (const {property, type} of options.store.defaultGeometrySchema.header) {\n const TypedArrayTypeHeader = getConstructorForDataFormat(type);\n switch (property) {\n case HeaderAttributeProperty.vertexCount:\n vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];\n byteOffset += sizeOf(type);\n break;\n case HeaderAttributeProperty.featureCount:\n featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];\n byteOffset += sizeOf(type);\n break;\n default:\n break;\n }\n }\n\n return {\n vertexCount,\n featureCount,\n byteOffset\n };\n}\n\n/* eslint-enable max-statements */\n\nfunction normalizeAttributes(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n vertexAttributes: VertexAttribute | FeatureAttribute,\n attributeCount: number,\n attributesOrder: string[]\n) {\n const attributes: I3SMeshAttributes = {};\n\n // the order of attributes depend on the order being added to the vertexAttributes object\n for (const attribute of attributesOrder) {\n if (vertexAttributes[attribute]) {\n const {valueType, valuesPerElement}: {valueType: string; valuesPerElement: number} =\n vertexAttributes[attribute];\n // protect from arrayBuffer read overunns by NOT assuming node has regions always even though its declared in defaultGeometrySchema.\n // In i3s 1.6: client is required to decide that based on ./shared resource of the node (materialDefinitions.[Mat_id].params.vertexRegions == true)\n // In i3s 1.7 the property has been rolled into the 3d scene layer json/node pages.\n // Code below does not account when the bytelength is actually bigger than\n // the calculated value (b\\c the tile potentially could have mesh segmentation information).\n // In those cases tiles without regions could fail or have garbage values.\n if (\n byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <=\n arrayBuffer.byteLength\n ) {\n const buffer = arrayBuffer.slice(byteOffset);\n let value: TypedArray;\n\n if (valueType === 'UInt64') {\n value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));\n } else {\n const TypedArrayType = getConstructorForDataFormat(valueType);\n value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);\n }\n\n attributes[attribute] = {\n value,\n type: GL_TYPE_MAP[valueType],\n size: valuesPerElement\n };\n\n switch (attribute) {\n case 'color':\n attributes.color.normalized = true;\n break;\n case 'position':\n case 'region':\n case 'normal':\n default:\n }\n\n byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);\n } else if (attribute !== 'uv0') {\n break;\n }\n }\n }\n\n return {attributes, byteOffset};\n}\n\n/**\n * Parse buffer to return array of uint64 values\n *\n * @param buffer\n * @param elementsCount\n * @returns 64-bit array of values until precision is lost after Number.MAX_SAFE_INTEGER\n */\nfunction parseUint64Values(\n buffer: ArrayBuffer,\n elementsCount: number,\n attributeSize: number\n): Uint32Array {\n const values: number[] = [];\n const dataView = new DataView(buffer);\n let offset = 0;\n\n for (let index = 0; index < elementsCount; index++) {\n // split 64-bit number into two 32-bit parts\n const left = dataView.getUint32(offset, true);\n const right = dataView.getUint32(offset + 4, true);\n // combine the two 32-bit values\n const value = left + 2 ** 32 * right;\n\n values.push(value);\n offset += attributeSize;\n }\n\n return new Uint32Array(values);\n}\n\nfunction parsePositions(attribute: I3SMeshAttribute, options: I3STileOptions): Matrix4 {\n const mbs = options.mbs;\n const value = attribute.value;\n const metadata = attribute.metadata;\n const enuMatrix = new Matrix4();\n const cartographicOrigin = new Vector3(mbs[0], mbs[1], mbs[2]);\n const cartesianOrigin = new Vector3();\n Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);\n Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);\n attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);\n\n return enuMatrix;\n}\n\n/**\n * Converts position coordinates to absolute cartesian coordinates\n * @param vertices - \"position\" attribute data\n * @param metadata - When the geometry is DRACO compressed, contain position attribute's metadata\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/compressedAttributes.cmn.md\n * @param cartographicOrigin - Cartographic origin coordinates\n * @returns - converted \"position\" data\n */\nfunction offsetsToCartesians(\n vertices: number[] | TypedArray,\n metadata: any = {},\n cartographicOrigin: Vector3\n): Float64Array {\n const positions = new Float64Array(vertices.length);\n const scaleX = (metadata['i3s-scale_x'] && metadata['i3s-scale_x'].double) || 1;\n const scaleY = (metadata['i3s-scale_y'] && metadata['i3s-scale_y'].double) || 1;\n for (let i = 0; i < positions.length; i += 3) {\n positions[i] = vertices[i] * scaleX + cartographicOrigin.x;\n positions[i + 1] = vertices[i + 1] * scaleY + cartographicOrigin.y;\n positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;\n }\n\n for (let i = 0; i < positions.length; i += 3) {\n // @ts-ignore\n Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector);\n positions[i] = scratchVector.x;\n positions[i + 1] = scratchVector.y;\n positions[i + 2] = scratchVector.z;\n }\n\n return positions;\n}\n\n/**\n * Get model matrix for loaded vertices\n * @param positions positions attribute\n * @returns Matrix4 - model matrix for geometry transformation\n */\nfunction getModelMatrix(positions: I3SMeshAttribute): Matrix4 {\n const metadata = positions.metadata;\n const scaleX: number = metadata?.['i3s-scale_x']?.double || 1;\n const scaleY: number = metadata?.['i3s-scale_y']?.double || 1;\n const modelMatrix = new Matrix4();\n modelMatrix[0] = scaleX;\n modelMatrix[5] = scaleY;\n return modelMatrix;\n}\n\n/**\n * Makes a glTF-compatible PBR material from an I3S material definition\n * @param materialDefinition - i3s material definition\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n * @param texture - texture image\n * @returns {object}\n */\nfunction makePbrMaterial(materialDefinition?: I3SMaterialDefinition, texture?: TileContentTexture) {\n let pbrMaterial;\n if (materialDefinition) {\n pbrMaterial = {\n ...materialDefinition,\n pbrMetallicRoughness: materialDefinition.pbrMetallicRoughness\n ? {...materialDefinition.pbrMetallicRoughness}\n : {baseColorFactor: [255, 255, 255, 255]}\n };\n } else {\n pbrMaterial = {\n pbrMetallicRoughness: {}\n };\n if (texture) {\n pbrMaterial.pbrMetallicRoughness.baseColorTexture = {texCoord: 0};\n } else {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = [255, 255, 255, 255];\n }\n }\n\n // Set default 0.25 per spec https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n pbrMaterial.alphaCutoff = pbrMaterial.alphaCutoff || 0.25;\n\n if (pbrMaterial.alphaMode) {\n // I3S contain alphaMode in lowerCase\n pbrMaterial.alphaMode = pbrMaterial.alphaMode.toUpperCase();\n }\n\n // Convert colors from [255,255,255,255] to [1,1,1,1]\n if (pbrMaterial.emissiveFactor) {\n pbrMaterial.emissiveFactor = convertColorFormat(pbrMaterial.emissiveFactor);\n }\n if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(\n pbrMaterial.pbrMetallicRoughness.baseColorFactor\n );\n }\n\n if (texture) {\n setMaterialTexture(pbrMaterial, texture);\n }\n\n return pbrMaterial;\n}\n\n/**\n * Convert color from [255,255,255,255] to [1,1,1,1]\n * @param colorFactor - color array\n * @returns - new color array\n */\nfunction convertColorFormat(colorFactor: number[]): number[] {\n const normalizedColor = [...colorFactor];\n for (let index = 0; index < colorFactor.length; index++) {\n normalizedColor[index] = colorFactor[index] / 255;\n }\n return normalizedColor;\n}\n\n/**\n * Set texture in PBR material\n * @param {object} material - i3s material definition\n * @param image - texture image\n * @returns\n */\nfunction setMaterialTexture(material, image: TileContentTexture): void {\n const texture = {source: {image}};\n // I3SLoader now support loading only one texture. This elseif sequence will assign this texture to one of\n // properties defined in materialDefinition\n if (material.pbrMetallicRoughness && material.pbrMetallicRoughness.baseColorTexture) {\n material.pbrMetallicRoughness.baseColorTexture = {\n ...material.pbrMetallicRoughness.baseColorTexture,\n texture\n };\n } else if (material.emissiveTexture) {\n material.emissiveTexture = {...material.emissiveTexture, texture};\n } else if (\n material.pbrMetallicRoughness &&\n material.pbrMetallicRoughness.metallicRoughnessTexture\n ) {\n material.pbrMetallicRoughness.metallicRoughnessTexture = {\n ...material.pbrMetallicRoughness.metallicRoughnessTexture,\n texture\n };\n } else if (material.normalTexture) {\n material.normalTexture = {...material.normalTexture, texture};\n } else if (material.occlusionTexture) {\n material.occlusionTexture = {...material.occlusionTexture, texture};\n }\n}\n\n/**\n * Flatten feature ids using face ranges\n * @param normalizedFeatureAttributes\n * @returns\n */\nfunction flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes: I3SMeshAttributes): void {\n const {id, faceRange} = normalizedFeatureAttributes;\n\n if (!id || !faceRange) {\n return;\n }\n\n const featureIds = id.value;\n const range = faceRange.value;\n const featureIdsLength = range[range.length - 1] + 1;\n const orderedFeatureIndices = new Uint32Array(featureIdsLength * 3);\n\n let featureIndex = 0;\n let startIndex = 0;\n\n for (let index = 1; index < range.length; index += 2) {\n const fillId = Number(featureIds[featureIndex]);\n const endValue = range[index];\n const prevValue = range[index - 1];\n const trianglesCount = endValue - prevValue + 1;\n const endIndex = startIndex + trianglesCount * 3;\n\n orderedFeatureIndices.fill(fillId, startIndex, endIndex);\n\n featureIndex++;\n startIndex = endIndex;\n }\n\n normalizedFeatureAttributes.id.value = orderedFeatureIndices;\n}\n\n/**\n * Flatten feature ids using featureIndices\n * @param attributes\n * @param featureIds\n * @returns\n */\nfunction flattenFeatureIdsByFeatureIndices(\n attributes: I3SMeshAttributes,\n featureIds: Int32Array\n): void {\n const featureIndices = attributes.id.value;\n const result = new Float32Array(featureIndices.length);\n\n for (let index = 0; index < featureIndices.length; index++) {\n result[index] = featureIds[featureIndices[index]];\n }\n\n attributes.id.value = result;\n}\n\n/**\n * Flatten feature ids using featureIndices\n * @param featureIndex\n * @returns\n */\nfunction getFeatureIdsFromFeatureIndexMetadata(\n featureIndex: I3SMeshAttribute\n): Int32Array | undefined {\n return featureIndex?.metadata?.['i3s-feature-ids']?.intArray;\n}\n"],"mappings":"AACA,SAAQA,IAAI,EAAEC,KAAK,QAAO,kBAAkB;AAC5C,SAAQC,OAAO,EAAEC,OAAO,QAAO,eAAe;AAC9C,SAAQC,SAAS,QAAO,qBAAqB;AAE7C,SAAQC,WAAW,QAAO,oBAAoB;AAC9C,SAAQC,WAAW,QAAkB,mBAAmB;AACxD,SAAQC,WAAW,EAAEC,uBAAuB,QAAO,sBAAsB;AAEzE,SAMEC,uBAAuB,QAKlB,aAAa;AACpB,SAAQC,eAAe,QAAO,oBAAoB;AAElD,SAAQC,WAAW,EAAEC,2BAA2B,EAAEC,MAAM,EAAEC,iBAAiB,QAAO,aAAa;AAE/F,SAAQC,eAAe,QAAO,2BAA2B;AAEzD,MAAMC,aAAa,GAAG,IAAId,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5C,SAASe,yBAAyBA,CAACC,aAA2D,EAAE;EAC9F,QAAQA,aAAa;IACnB,KAAK,UAAU;IACf,KAAK,KAAK;MACR,OAAOV,uBAAuB;IAChC,KAAK,MAAM;MACT,OAAOD,WAAW;IACpB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,MAAMkK,cAAc,GAAGpK,UAAU,CAACmD,EAAE,CAACX,KAAK;EAC1C,MAAM6H,MAAM,GAAG,IAAIC,YAAY,CAACF,cAAc,CAAC3C,MAAM,CAAC;EAEtD,KAAK,IAAIf,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAG0D,cAAc,CAAC3C,MAAM,EAAEf,KAAK,EAAE,EAAE;IAC1D2D,MAAM,CAAC3D,KAAK,CAAC,GAAGxG,UAAU,CAACkK,cAAc,CAAC1D,KAAK,CAAC,CAAC;EACnD;EAEA1G,UAAU,CAACmD,EAAE,CAACX,KAAK,GAAG6H,MAAM;AAC9B;AAOA,SAAShH,qCAAqCA,CAC5CR,YAA8B,EACN;EAAA,IAAA0H,qBAAA,EAAAC,sBAAA;EACxB,OAAO3H,YAAY,aAAZA,YAAY,wBAAA0H,qBAAA,GAAZ1H,YAAY,CAAE2C,QAAQ,cAAA+E,qBAAA,wBAAAC,sBAAA,GAAtBD,qBAAA,CAAyB,iBAAiB,CAAC,cAAAC,sBAAA,uBAA3CA,sBAAA,CAA6CC,QAAQ;AAC9D"}
|
|
@@ -5,7 +5,7 @@ const getByteAt = (offset, buffer) => {
|
|
|
5
5
|
return buffer.getUint8(buffer.byteOffset + offset);
|
|
6
6
|
};
|
|
7
7
|
export async function parseSLPK(data) {
|
|
8
|
-
var _options$path;
|
|
8
|
+
var _options$slpk$path, _options$slpk, _options$slpk2;
|
|
9
9
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10
10
|
const archive = new DataView(data);
|
|
11
11
|
const cdFileHeaderSignature = [80, 75, 1, 2];
|
|
@@ -32,6 +32,6 @@ export async function parseSLPK(data) {
|
|
|
32
32
|
if (!hashFile) {
|
|
33
33
|
throw new Error('No hash file in slpk');
|
|
34
34
|
}
|
|
35
|
-
return await new SLPKArchive(data, hashFile).getFile((_options$path = options.path) !== null && _options$path !== void 0 ? _options$path : '');
|
|
35
|
+
return await new SLPKArchive(data, hashFile).getFile((_options$slpk$path = (_options$slpk = options.slpk) === null || _options$slpk === void 0 ? void 0 : _options$slpk.path) !== null && _options$slpk$path !== void 0 ? _options$slpk$path : '', (_options$slpk2 = options.slpk) === null || _options$slpk2 === void 0 ? void 0 : _options$slpk2.pathMode);
|
|
36
36
|
}
|
|
37
37
|
//# sourceMappingURL=parse-slpk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-slpk.js","names":["parseZipCDFileHeader","parseZipLocalFileHeader","SLPKArchive","getByteAt","offset","buffer","getUint8","byteOffset","parseSLPK","data","_options$path","options","arguments","length","undefined","archive","DataView","cdFileHeaderSignature","searchWindow","byteLength","hashCDOffset","i","every","val","index","cdFileHeader","textDecoder","TextDecoder","decode","fileName","Error","localFileHeader","localHeaderOffset","fileDataOffset","hashFile","slice","compressedSize","getFile","path"],"sources":["../../../../../src/lib/parsers/parse-slpk/parse-slpk.ts"],"sourcesContent":["import type {SLPKLoaderOptions} from '../../../i3s-slpk-loader';\nimport {parseZipCDFileHeader} from '../parse-zip/cd-file-header';\nimport {parseZipLocalFileHeader} from '../parse-zip/local-file-header';\nimport {SLPKArchive} from './slpk-archieve';\n\n/**\n * Returns one byte from the provided buffer at the provided position\n * @param offset - position where to read\n * @param buffer - buffer to read\n * @returns one byte from the provided buffer at the provided position\n */\nconst getByteAt = (offset: number, buffer: DataView): number => {\n return buffer.getUint8(buffer.byteOffset + offset);\n};\n\nexport async function parseSLPK(data: ArrayBuffer, options: SLPKLoaderOptions = {}) {\n const archive = new DataView(data);\n const cdFileHeaderSignature = [80, 75, 1, 2];\n\n const searchWindow = [\n getByteAt(archive.byteLength - 1, archive),\n getByteAt(archive.byteLength - 2, archive),\n getByteAt(archive.byteLength - 3, archive),\n undefined\n ];\n\n let hashCDOffset = 0;\n\n // looking for the last record in the central directory\n for (let i = archive.byteLength - 4; i > -1; i--) {\n searchWindow[3] = searchWindow[2];\n searchWindow[2] = searchWindow[1];\n searchWindow[1] = searchWindow[0];\n searchWindow[0] = getByteAt(i, archive);\n if (searchWindow.every((val, index) => val === cdFileHeaderSignature[index])) {\n hashCDOffset = i;\n break;\n }\n }\n\n const cdFileHeader = parseZipCDFileHeader(hashCDOffset, archive);\n\n const textDecoder = new TextDecoder();\n if (textDecoder.decode(cdFileHeader.fileName) !== '@specialIndexFileHASH128@') {\n throw new Error('No hash file in slpk');\n }\n\n const localFileHeader = parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, archive);\n\n const fileDataOffset = localFileHeader.fileDataOffset;\n const hashFile = archive.buffer.slice(\n fileDataOffset,\n fileDataOffset + localFileHeader.compressedSize\n );\n\n if (!hashFile) {\n throw new Error('No hash file in slpk');\n }\n\n return await new SLPKArchive(data, hashFile).getFile(options.path ?? '');\n}\n"],"mappings":"AACA,SAAQA,oBAAoB,QAAO,6BAA6B;AAChE,SAAQC,uBAAuB,QAAO,gCAAgC;AACtE,SAAQC,WAAW,QAAO,iBAAiB;AAQ3C,MAAMC,SAAS,GAAGA,CAACC,MAAc,EAAEC,MAAgB,KAAa;EAC9D,OAAOA,MAAM,CAACC,QAAQ,CAACD,MAAM,CAACE,UAAU,GAAGH,MAAM,CAAC;AACpD,CAAC;AAED,OAAO,eAAeI,SAASA,CAACC,IAAiB,EAAmC;EAAA,IAAAC,aAAA;EAAA,IAAjCC,OAA0B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAChF,MAAMG,OAAO,GAAG,IAAIC,QAAQ,
|
|
1
|
+
{"version":3,"file":"parse-slpk.js","names":["parseZipCDFileHeader","parseZipLocalFileHeader","SLPKArchive","getByteAt","offset","buffer","getUint8","byteOffset","parseSLPK","data","_options$slpk$path","_options$slpk","_options$slpk2","options","arguments","length","undefined","archive","DataView","cdFileHeaderSignature","searchWindow","byteLength","hashCDOffset","i","every","val","index","cdFileHeader","textDecoder","TextDecoder","decode","fileName","Error","localFileHeader","localHeaderOffset","fileDataOffset","hashFile","slice","compressedSize","getFile","slpk","path","pathMode"],"sources":["../../../../../src/lib/parsers/parse-slpk/parse-slpk.ts"],"sourcesContent":["import type {SLPKLoaderOptions} from '../../../i3s-slpk-loader';\nimport {parseZipCDFileHeader} from '../parse-zip/cd-file-header';\nimport {parseZipLocalFileHeader} from '../parse-zip/local-file-header';\nimport {SLPKArchive} from './slpk-archieve';\n\n/**\n * Returns one byte from the provided buffer at the provided position\n * @param offset - position where to read\n * @param buffer - buffer to read\n * @returns one byte from the provided buffer at the provided position\n */\nconst getByteAt = (offset: number, buffer: DataView): number => {\n return buffer.getUint8(buffer.byteOffset + offset);\n};\n\nexport async function parseSLPK(data: ArrayBuffer, options: SLPKLoaderOptions = {}) {\n const archive = new DataView(data);\n const cdFileHeaderSignature = [80, 75, 1, 2];\n\n const searchWindow = [\n getByteAt(archive.byteLength - 1, archive),\n getByteAt(archive.byteLength - 2, archive),\n getByteAt(archive.byteLength - 3, archive),\n undefined\n ];\n\n let hashCDOffset = 0;\n\n // looking for the last record in the central directory\n for (let i = archive.byteLength - 4; i > -1; i--) {\n searchWindow[3] = searchWindow[2];\n searchWindow[2] = searchWindow[1];\n searchWindow[1] = searchWindow[0];\n searchWindow[0] = getByteAt(i, archive);\n if (searchWindow.every((val, index) => val === cdFileHeaderSignature[index])) {\n hashCDOffset = i;\n break;\n }\n }\n\n const cdFileHeader = parseZipCDFileHeader(hashCDOffset, archive);\n\n const textDecoder = new TextDecoder();\n if (textDecoder.decode(cdFileHeader.fileName) !== '@specialIndexFileHASH128@') {\n throw new Error('No hash file in slpk');\n }\n\n const localFileHeader = parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, archive);\n\n const fileDataOffset = localFileHeader.fileDataOffset;\n const hashFile = archive.buffer.slice(\n fileDataOffset,\n fileDataOffset + localFileHeader.compressedSize\n );\n\n if (!hashFile) {\n throw new Error('No hash file in slpk');\n }\n\n return await new SLPKArchive(data, hashFile).getFile(\n options.slpk?.path ?? '',\n options.slpk?.pathMode\n );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