@loaders.gl/tiles 3.4.0-alpha.4 → 3.4.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -1
- package/dist/dist.min.js +171 -151
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/tileset/helpers/3d-tiles-options.js.map +1 -1
- package/dist/es5/tileset/tile-3d.js +41 -71
- package/dist/es5/tileset/tile-3d.js.map +1 -1
- package/dist/es5/tileset/tileset-3d.js +68 -102
- package/dist/es5/tileset/tileset-3d.js.map +1 -1
- package/dist/es5/tileset/tileset-cache.js +4 -7
- package/dist/es5/tileset/tileset-cache.js.map +1 -1
- package/dist/es5/tileset/tileset-traverser.js +12 -22
- package/dist/es5/tileset/tileset-traverser.js.map +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/tileset/helpers/3d-tiles-options.js.map +1 -1
- package/dist/esm/tileset/tile-3d.js +39 -71
- package/dist/esm/tileset/tile-3d.js.map +1 -1
- package/dist/esm/tileset/tileset-3d.js +64 -94
- package/dist/esm/tileset/tileset-3d.js.map +1 -1
- package/dist/esm/tileset/tileset-cache.js +4 -7
- package/dist/esm/tileset/tileset-cache.js.map +1 -1
- package/dist/esm/tileset/tileset-traverser.js +9 -19
- package/dist/esm/tileset/tileset-traverser.js.map +1 -1
- package/dist/tileset/helpers/3d-tiles-options.d.ts +3 -2
- package/dist/tileset/helpers/3d-tiles-options.d.ts.map +1 -1
- package/dist/tileset/tile-3d.d.ts +36 -21
- package/dist/tileset/tile-3d.d.ts.map +1 -1
- package/dist/tileset/tile-3d.js +58 -43
- package/dist/tileset/tileset-3d.d.ts +90 -43
- package/dist/tileset/tileset-3d.d.ts.map +1 -1
- package/dist/tileset/tileset-3d.js +108 -127
- package/dist/tileset/tileset-cache.d.ts +5 -4
- package/dist/tileset/tileset-cache.d.ts.map +1 -1
- package/dist/tileset/tileset-cache.js +4 -10
- package/dist/tileset/tileset-traverser.d.ts +32 -21
- package/dist/tileset/tileset-traverser.d.ts.map +1 -1
- package/dist/tileset/tileset-traverser.js +23 -35
- package/package.json +4 -4
- package/src/constants.ts +18 -0
- package/src/tileset/helpers/3d-tiles-options.ts +3 -1
- package/src/tileset/tile-3d.ts +70 -109
- package/src/tileset/tileset-3d.ts +178 -216
- package/src/tileset/tileset-cache.ts +20 -15
- package/src/tileset/tileset-traverser.ts +52 -68
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-3d.js","names":["Vector3","Matrix4","CullingVolume","load","TILE_REFINEMENT","TILE_CONTENT_STATE","TILESET_TYPE","createBoundingVolume","getCartographicBounds","getTiles3DScreenSpaceError","getProjectedRadius","get3dTilesOptions","TilesetTraverser","scratchVector","defined","x","undefined","Tile3D","constructor","tileset","header","parentHeader","extendedId","arguments","length","_defineProperty","id","url","parent","refine","_getRefine","type","contentUrl","lodMetricType","lodMetricValue","boundingVolume","content","contentState","UNLOADED","gpuMemoryUsageInBytes","children","hasEmptyContent","hasTilesetContent","depth","viewportIds","userData","extensions","_priority","_touchedFrame","_visitedFrame","_selectedFrame","_requestedFrame","_screenSpaceError","_cacheNode","_frameNumber","traverser","_shouldRefine","_distanceToCamera","_centerZDepth","_visible","_inRequestVolume","_stackLength","_selectionDepth","_initialTransform","transform","_initializeLodMetric","_initializeTransforms","_initializeBoundingVolumes","_initializeContent","_initializeRenderingState","_lodJudge","_expireDate","_expiredContent","implicitTiling","Object","seal","destroy","isDestroyed","selected","isVisible","isVisibleAndInRequestVolume","hasRenderContent","hasChildren","contentReady","READY","contentAvailable","Boolean","contentFailed","hasUnloadedContent","contentUnloaded","contentExpired","EXPIRED","FAILED","distanceToCamera","screenSpaceError","boundingBox","_boundingBox","getScreenSpaceError","frameState","useParentLodMetric","I3S","TILES3D","Error","unselect","_getPriority","_traverser","skipLevelOfDetail","options","maySkipTile","ADD","useParentScreenSpaceError","rootScreenSpaceError","root","Math","max","loadContent","expired","LOADING","requestToken","_requestScheduler","scheduleRequest","bind","getTileUrl","loader","loadOptions","isTileset","_getLoaderSpecificOptions","contentLoader","_isTileset","_initializeTileHeaders","_onContentLoaded","error","done","unloadContent","updateVisibility","frameNumber","parentVisibilityPlaneMask","_visibilityPlaneMask","MASK_INDETERMINATE","updateTransforms","parentTransform","computedTransform","modelMatrix","_updateTransform","distanceToTile","visibility","MASK_OUTSIDE","insideViewerRequestVolume","cullingVolume","computeVisibilityWithPlaneMask","contentVisibility","sqrt","distanceSquaredTo","camera","position","cameraSpaceZDepth","_ref","subVectors","center","direction","dot","viewerRequestVolume","_viewerRequestVolume","updateExpiration","now","Date","lessThan","extras","console","warn","tileHeader","clone","multiplyRight","parentInitialTransform","_contentBoundingVolume","_updateBoundingVolume","_tileset","_tile","level","REPLACE","indexOf","disableSkipLevelOfDetail","didTransformChange","equals","loaderId","i3s","_tileOptions","attributeUrls","textureUrl","textureFormat","textureLoaderOptions","materialDefinition","isDracoGeometry","mbs","_tilesetOptions","store","attributeStorageInfo","fields","isTileHeader"],"sources":["../../../src/tileset/tile-3d.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector3, Matrix4} from '@math.gl/core';\nimport {CullingVolume} from '@math.gl/culling';\n\nimport {load} from '@loaders.gl/core';\n\n// Note: circular dependency\nimport type {Tileset3D} from './tileset-3d';\nimport {TILE_REFINEMENT, TILE_CONTENT_STATE, TILESET_TYPE} from '../constants';\n\nimport {FrameState} from './helpers/frame-state';\nimport {\n createBoundingVolume,\n getCartographicBounds,\n CartographicBounds\n} from './helpers/bounding-volume';\nimport {getTiles3DScreenSpaceError} from './helpers/tiles-3d-lod';\nimport {getProjectedRadius} from './helpers/i3s-lod';\nimport {get3dTilesOptions} from './helpers/3d-tiles-options';\nimport {TilesetTraverser} from './tileset-traverser';\n\nconst scratchVector = new Vector3();\n\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\n\n/**\n * @param tileset - Tileset3D instance\n * @param header - tile header - JSON loaded from a dataset\n * @param parentHeader - parent Tile3D instance\n * @param extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n */\nexport type Tile3DProps = {\n tileset: Tileset3D;\n header: Object;\n parentHeader: Tile3D;\n extendedId: string;\n};\n\n/**\n * A Tile3DHeader represents a tile as Tileset3D. When a tile is first created, its content is not loaded;\n * the content is loaded on-demand when needed based on the view.\n * Do not construct this directly, instead access tiles through {@link Tileset3D#tileVisible}.\n */\nexport class Tile3D {\n tileset: Tileset3D;\n header: any;\n id: string;\n url: string;\n parent: Tile3D;\n refine: number;\n type: string;\n contentUrl: string;\n lodMetricType: string;\n lodMetricValue: number;\n boundingVolume: any;\n content: any;\n contentState: any;\n gpuMemoryUsageInBytes: number;\n children: Tile3D[];\n depth: number;\n viewportIds: any[];\n transform: Matrix4;\n extensions: any;\n implicitTiling?: any;\n\n // Container to store application specific data\n userData: {[key: string]: any};\n computedTransform: any;\n hasEmptyContent: boolean;\n hasTilesetContent: boolean;\n\n traverser: object;\n\n // @ts-ignore\n private _cacheNode: any;\n private _frameNumber: any;\n // TODO i3s specific, needs to remove\n // @ts-ignore\n private _lodJudge: any;\n // TODO Cesium 3d tiles specific\n private _expireDate: any;\n private _expiredContent: any;\n // @ts-ignore\n private _shouldRefine: boolean;\n\n private _boundingBox?: CartographicBounds;\n\n // Members this are updated every frame for tree traversal and rendering optimizations:\n public _distanceToCamera: number;\n // @ts-ignore\n private _centerZDepth: number;\n private _screenSpaceError: number;\n private _visibilityPlaneMask: any;\n private _visible?: boolean;\n private _inRequestVolume: boolean;\n\n // @ts-ignore\n private _stackLength: number;\n // @ts-ignore\n private _selectionDepth: number;\n\n // @ts-ignore\n private _touchedFrame: number;\n // @ts-ignore\n private _visitedFrame: number;\n private _selectedFrame: number;\n // @ts-ignore\n private _requestedFrame: number;\n\n // @ts-ignore\n private _priority: number;\n\n private _contentBoundingVolume: any;\n private _viewerRequestVolume: any;\n\n _initialTransform: Matrix4;\n\n /**\n * @constructs\n * Create a Tile3D instance\n * @param tileset - Tileset3D instance\n * @param header - tile header - JSON loaded from a dataset\n * @param parentHeader - parent Tile3D instance\n * @param extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n */\n // eslint-disable-next-line max-statements\n constructor(\n tileset: Tileset3D,\n header: {[key: string]: any},\n parentHeader?: Tile3D,\n extendedId = ''\n ) {\n // PUBLIC MEMBERS\n // original tile data\n this.header = header;\n\n // The tileset containing this tile.\n this.tileset = tileset;\n this.id = extendedId || header.id;\n this.url = header.url;\n\n // This tile's parent or `undefined` if this tile is the root.\n // @ts-ignore\n this.parent = parentHeader;\n this.refine = this._getRefine(header.refine);\n this.type = header.type;\n this.contentUrl = header.contentUrl;\n\n // The error, in meters, introduced if this tile is rendered and its children are not.\n this.lodMetricType = 'geometricError';\n this.lodMetricValue = 0;\n\n // Specifies the type of refine that is used when traversing this tile for rendering.\n this.boundingVolume = null;\n\n // The tile's content. This represents the actual tile's payload,\n // not the content's metadata in the tileset JSON file.\n this.content = null;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n this.gpuMemoryUsageInBytes = 0;\n\n // The tile's children - an array of Tile3D objects.\n this.children = [];\n\n this.hasEmptyContent = false;\n this.hasTilesetContent = false;\n\n this.depth = 0;\n this.viewportIds = [];\n\n // Container to store application specific data\n this.userData = {};\n this.extensions = null;\n\n // PRIVATE MEMBERS\n this._priority = 0;\n this._touchedFrame = 0;\n this._visitedFrame = 0;\n this._selectedFrame = 0;\n this._requestedFrame = 0;\n this._screenSpaceError = 0;\n\n this._cacheNode = null;\n this._frameNumber = null;\n this._cacheNode = null;\n\n this.traverser = new TilesetTraverser({});\n this._shouldRefine = false;\n this._distanceToCamera = 0;\n this._centerZDepth = 0;\n this._visible = undefined;\n this._inRequestVolume = false;\n this._stackLength = 0;\n this._selectionDepth = 0;\n this._initialTransform = new Matrix4();\n this.transform = new Matrix4();\n\n this._initializeLodMetric(header);\n this._initializeTransforms(header);\n this._initializeBoundingVolumes(header);\n this._initializeContent(header);\n this._initializeRenderingState(header);\n\n // TODO i3s specific, needs to remove\n this._lodJudge = null;\n\n // TODO Cesium 3d tiles specific\n this._expireDate = null;\n this._expiredContent = null;\n this.implicitTiling = null;\n\n Object.seal(this);\n }\n\n destroy() {\n this.header = null;\n }\n\n isDestroyed() {\n return this.header === null;\n }\n\n get selected() {\n return this._selectedFrame === this.tileset._frameNumber;\n }\n\n get isVisible() {\n return this._visible;\n }\n\n get isVisibleAndInRequestVolume() {\n return this._visible && this._inRequestVolume;\n }\n\n /** Returns true if tile is not an empty tile and not an external tileset */\n get hasRenderContent() {\n return !this.hasEmptyContent && !this.hasTilesetContent;\n }\n\n /** Returns true if tile has children */\n get hasChildren() {\n return this.children.length > 0 || (this.header.children && this.header.children.length > 0);\n }\n\n /**\n * Determines if the tile's content is ready. This is automatically `true` for\n * tiles with empty content.\n */\n get contentReady() {\n return this.contentState === TILE_CONTENT_STATE.READY || this.hasEmptyContent;\n }\n\n /**\n * Determines if the tile has available content to render. `true` if the tile's\n * content is ready or if it has expired content this renders while new content loads; otherwise,\n */\n get contentAvailable() {\n return Boolean(\n (this.contentReady && this.hasRenderContent) || (this._expiredContent && !this.contentFailed)\n );\n }\n\n /** Returns true if tile has renderable content but it's unloaded */\n get hasUnloadedContent() {\n return this.hasRenderContent && this.contentUnloaded;\n }\n\n /**\n * Determines if the tile's content has not be requested. `true` if tile's\n * content has not be requested; otherwise, `false`.\n */\n get contentUnloaded() {\n return this.contentState === TILE_CONTENT_STATE.UNLOADED;\n }\n\n /**\n * Determines if the tile's content is expired. `true` if tile's\n * content is expired; otherwise, `false`.\n */\n get contentExpired() {\n return this.contentState === TILE_CONTENT_STATE.EXPIRED;\n }\n\n // Determines if the tile's content failed to load. `true` if the tile's\n // content failed to load; otherwise, `false`.\n get contentFailed() {\n return this.contentState === TILE_CONTENT_STATE.FAILED;\n }\n\n /**\n * Distance from the tile's bounding volume center to the camera\n */\n get distanceToCamera(): number {\n return this._distanceToCamera;\n }\n\n /**\n * Screen space error for LOD selection\n */\n get screenSpaceError(): number {\n return this._screenSpaceError;\n }\n\n /**\n * Get bounding box in cartographic coordinates\n * @returns [min, max] each in [longitude, latitude, altitude]\n */\n get boundingBox(): CartographicBounds {\n if (!this._boundingBox) {\n this._boundingBox = getCartographicBounds(this.header.boundingVolume, this.boundingVolume);\n }\n return this._boundingBox;\n }\n\n /** Get the tile's screen space error. */\n getScreenSpaceError(frameState, useParentLodMetric) {\n switch (this.tileset.type) {\n case TILESET_TYPE.I3S:\n return getProjectedRadius(this, frameState);\n case TILESET_TYPE.TILES3D:\n return getTiles3DScreenSpaceError(this, frameState, useParentLodMetric);\n default:\n // eslint-disable-next-line\n throw new Error('Unsupported tileset type');\n }\n }\n\n /**\n * Make tile unselected than means it won't be shown\n * but it can be still loaded in memory\n */\n unselect(): void {\n this._selectedFrame = 0;\n }\n\n /*\n * If skipLevelOfDetail is off try to load child tiles as soon as possible so that their parent can refine sooner.\n * Tiles are prioritized by screen space error.\n */\n // eslint-disable-next-line complexity\n _getPriority() {\n const traverser = this.tileset._traverser;\n const {skipLevelOfDetail} = traverser.options;\n\n /*\n * Tiles that are outside of the camera's frustum could be skipped if we are in 'ADD' mode\n * or if we are using 'Skip Traversal' in 'REPLACE' mode.\n * Otherewise, all 'touched' child tiles have to be loaded and displayed,\n * this may include tiles that are outide of the camera frustum (so that we can hide the parent tile).\n */\n const maySkipTile = this.refine === TILE_REFINEMENT.ADD || skipLevelOfDetail;\n\n // Check if any reason to abort\n if (maySkipTile && !this.isVisible && this._visible !== undefined) {\n return -1;\n }\n // Condition used in `cancelOutOfViewRequests` function in CesiumJS/Cesium3DTileset.js\n if (this.tileset._frameNumber - this._touchedFrame >= 1) {\n return -1;\n }\n if (this.contentState === TILE_CONTENT_STATE.UNLOADED) {\n return -1;\n }\n\n // Based on the priority function `getPriorityReverseScreenSpaceError` in CesiumJS. Scheduling priority is based on the parent's screen space error when possible.\n const parent = this.parent;\n const useParentScreenSpaceError =\n parent && (!maySkipTile || this._screenSpaceError === 0.0 || parent.hasTilesetContent);\n const screenSpaceError = useParentScreenSpaceError\n ? parent._screenSpaceError\n : this._screenSpaceError;\n\n const rootScreenSpaceError = traverser.root ? traverser.root._screenSpaceError : 0.0;\n\n // Map higher SSE to lower values (e.g. root tile is highest priority)\n return Math.max(rootScreenSpaceError - screenSpaceError, 0);\n }\n\n /**\n * Requests the tile's content.\n * The request may not be made if the Request Scheduler can't prioritize it.\n */\n // eslint-disable-next-line max-statements, complexity\n async loadContent(): Promise<boolean> {\n if (this.hasEmptyContent) {\n return false;\n }\n\n if (this.content) {\n return true;\n }\n\n const expired = this.contentExpired;\n\n if (expired) {\n this._expireDate = null;\n }\n\n this.contentState = TILE_CONTENT_STATE.LOADING;\n\n const requestToken = await this.tileset._requestScheduler.scheduleRequest(\n this.id,\n this._getPriority.bind(this)\n );\n\n if (!requestToken) {\n // cancelled\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n return false;\n }\n\n try {\n const contentUrl = this.tileset.getTileUrl(this.contentUrl);\n // The content can be a binary tile ot a JSON tileset\n const loader = this.tileset.loader;\n const options = {\n ...this.tileset.loadOptions,\n [loader.id]: {\n ...this.tileset.loadOptions[loader.id],\n isTileset: this.type === 'json',\n ...this._getLoaderSpecificOptions(loader.id)\n }\n };\n\n this.content = await load(contentUrl, loader, options);\n\n if (this.tileset.options.contentLoader) {\n await this.tileset.options.contentLoader(this);\n }\n\n if (this._isTileset()) {\n // Add tile headers for the nested tilset's subtree\n // Async update of the tree should be fine since there would never be edits to the same node\n // TODO - we need to capture the child tileset's URL\n this.tileset._initializeTileHeaders(this.content, this);\n }\n\n this.contentState = TILE_CONTENT_STATE.READY;\n this._onContentLoaded();\n return true;\n } catch (error) {\n // Tile is unloaded before the content finishes loading\n this.contentState = TILE_CONTENT_STATE.FAILED;\n throw error;\n } finally {\n requestToken.done();\n }\n }\n\n // Unloads the tile's content.\n unloadContent() {\n if (this.content && this.content.destroy) {\n this.content.destroy();\n }\n this.content = null;\n if (this.header.content && this.header.content.destroy) {\n this.header.content.destroy();\n }\n this.header.content = null;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n return true;\n }\n\n /**\n * Update the tile's visibility\n * @param {Object} frameState - frame state for tile culling\n * @param {string[]} viewportIds - a list of viewport ids that show this tile\n * @return {void}\n */\n updateVisibility(frameState, viewportIds) {\n if (this._frameNumber === frameState.frameNumber) {\n // Return early if visibility has already been checked during the traversal.\n // The visibility may have already been checked if the cullWithChildrenBounds optimization is used.\n return;\n }\n\n const parent = this.parent;\n const parentVisibilityPlaneMask = parent\n ? parent._visibilityPlaneMask\n : CullingVolume.MASK_INDETERMINATE;\n\n if (this.tileset._traverser.options.updateTransforms) {\n const parentTransform = parent ? parent.computedTransform : this.tileset.modelMatrix;\n this._updateTransform(parentTransform);\n }\n\n this._distanceToCamera = this.distanceToTile(frameState);\n this._screenSpaceError = this.getScreenSpaceError(frameState, false);\n this._visibilityPlaneMask = this.visibility(frameState, parentVisibilityPlaneMask); // Use parent's plane mask to speed up visibility test\n this._visible = this._visibilityPlaneMask !== CullingVolume.MASK_OUTSIDE;\n this._inRequestVolume = this.insideViewerRequestVolume(frameState);\n\n this._frameNumber = frameState.frameNumber;\n this.viewportIds = viewportIds;\n }\n\n // Determines whether the tile's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @param {Number} parentVisibilityPlaneMask The parent's plane mask to speed up the visibility check.\n // @returns {Number} A plane mask as described above in {@link CullingVolume#computeVisibilityWithPlaneMask}.\n visibility(frameState, parentVisibilityPlaneMask) {\n const {cullingVolume} = frameState;\n const {boundingVolume} = this;\n\n // TODO Cesium specific - restore clippingPlanes\n // const {clippingPlanes, clippingPlanesOriginMatrix} = tileset;\n // if (clippingPlanes && clippingPlanes.enabled) {\n // const intersection = clippingPlanes.computeIntersectionWithBoundingVolume(\n // boundingVolume,\n // clippingPlanesOriginMatrix\n // );\n // this._isClipped = intersection !== Intersect.INSIDE;\n // if (intersection === Intersect.OUTSIDE) {\n // return CullingVolume.MASK_OUTSIDE;\n // }\n // }\n\n // return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);\n return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);\n }\n\n // Assuming the tile's bounding volume intersects the culling volume, determines\n // whether the tile's content's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @returns {Intersect} The result of the intersection: the tile's content is completely outside, completely inside, or intersecting the culling volume.\n contentVisibility() {\n return true;\n\n // TODO restore\n /*\n // Assumes the tile's bounding volume intersects the culling volume already, so\n // just return Intersect.INSIDE if there is no content bounding volume.\n if (!defined(this.contentBoundingVolume)) {\n return Intersect.INSIDE;\n }\n\n if (this._visibilityPlaneMask === CullingVolume.MASK_INSIDE) {\n // The tile's bounding volume is completely inside the culling volume so\n // the content bounding volume must also be inside.\n return Intersect.INSIDE;\n }\n\n // PERFORMANCE_IDEA: is it possible to burn less CPU on this test since we know the\n // tile's (not the content's) bounding volume intersects the culling volume?\n const cullingVolume = frameState.cullingVolume;\n const boundingVolume = tile.contentBoundingVolume;\n\n const tileset = this.tileset;\n const clippingPlanes = tileset.clippingPlanes;\n if (defined(clippingPlanes) && clippingPlanes.enabled) {\n const intersection = clippingPlanes.computeIntersectionWithBoundingVolume(\n boundingVolume,\n tileset.clippingPlanesOriginMatrix\n );\n this._isClipped = intersection !== Intersect.INSIDE;\n if (intersection === Intersect.OUTSIDE) {\n return Intersect.OUTSIDE;\n }\n }\n\n return cullingVolume.computeVisibility(boundingVolume);\n */\n }\n\n /**\n * Computes the (potentially approximate) distance from the closest point of the tile's bounding volume to the camera.\n * @param frameState The frame state.\n * @returns {Number} The distance, in meters, or zero if the camera is inside the bounding volume.\n */\n distanceToTile(frameState: FrameState): number {\n const boundingVolume = this.boundingVolume;\n return Math.sqrt(Math.max(boundingVolume.distanceSquaredTo(frameState.camera.position), 0));\n }\n\n /**\n * Computes the tile's camera-space z-depth.\n * @param frameState The frame state.\n * @returns The distance, in meters.\n */\n cameraSpaceZDepth({camera}): number {\n const boundingVolume = this.boundingVolume; // Gets the underlying OrientedBoundingBox or BoundingSphere\n scratchVector.subVectors(boundingVolume.center, camera.position);\n return camera.direction.dot(scratchVector);\n }\n\n /**\n * Checks if the camera is inside the viewer request volume.\n * @param {FrameState} frameState The frame state.\n * @returns {Boolean} Whether the camera is inside the volume.\n */\n insideViewerRequestVolume(frameState: FrameState) {\n const viewerRequestVolume = this._viewerRequestVolume;\n return (\n !viewerRequestVolume || viewerRequestVolume.distanceSquaredTo(frameState.camera.position) <= 0\n );\n }\n\n // TODO Cesium specific\n\n // Update whether the tile has expired.\n updateExpiration() {\n if (defined(this._expireDate) && this.contentReady && !this.hasEmptyContent) {\n const now = Date.now();\n // @ts-ignore Date.lessThan - replace with ms compare?\n if (Date.lessThan(this._expireDate, now)) {\n this.contentState = TILE_CONTENT_STATE.EXPIRED;\n this._expiredContent = this.content;\n }\n }\n }\n\n get extras() {\n return this.header.extras;\n }\n\n // INTERNAL METHODS\n\n _initializeLodMetric(header) {\n if ('lodMetricType' in header) {\n this.lodMetricType = header.lodMetricType;\n } else {\n this.lodMetricType = (this.parent && this.parent.lodMetricType) || this.tileset.lodMetricType;\n // eslint-disable-next-line\n console.warn(`3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType`);\n }\n\n // This is used to compute screen space error, i.e., the error measured in pixels.\n if ('lodMetricValue' in header) {\n this.lodMetricValue = header.lodMetricValue;\n } else {\n this.lodMetricValue =\n (this.parent && this.parent.lodMetricValue) || this.tileset.lodMetricValue;\n // eslint-disable-next-line\n console.warn(\n '3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue'\n );\n }\n }\n\n _initializeTransforms(tileHeader) {\n // The local transform of this tile.\n this.transform = tileHeader.transform ? new Matrix4(tileHeader.transform) : new Matrix4();\n\n const parent = this.parent;\n const tileset = this.tileset;\n\n const parentTransform =\n parent && parent.computedTransform\n ? parent.computedTransform.clone()\n : tileset.modelMatrix.clone();\n this.computedTransform = new Matrix4(parentTransform).multiplyRight(this.transform);\n\n const parentInitialTransform =\n parent && parent._initialTransform ? parent._initialTransform.clone() : new Matrix4();\n this._initialTransform = new Matrix4(parentInitialTransform).multiplyRight(this.transform);\n }\n\n _initializeBoundingVolumes(tileHeader) {\n this._contentBoundingVolume = null;\n this._viewerRequestVolume = null;\n\n this._updateBoundingVolume(tileHeader);\n }\n\n _initializeContent(tileHeader) {\n // Empty tile by default\n this.content = {_tileset: this.tileset, _tile: this};\n this.hasEmptyContent = true;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n\n // When `true`, the tile's content points to an external tileset.\n // This is `false` until the tile's content is loaded.\n this.hasTilesetContent = false;\n\n if (tileHeader.contentUrl) {\n this.content = null;\n this.hasEmptyContent = false;\n }\n }\n\n // TODO - remove anything not related to basic visibility detection\n _initializeRenderingState(header) {\n this.depth = header.level || (this.parent ? this.parent.depth + 1 : 0);\n this._shouldRefine = false;\n\n // Members this are updated every frame for tree traversal and rendering optimizations:\n this._distanceToCamera = 0;\n this._centerZDepth = 0;\n this._screenSpaceError = 0;\n this._visibilityPlaneMask = CullingVolume.MASK_INDETERMINATE;\n this._visible = undefined;\n this._inRequestVolume = false;\n\n this._stackLength = 0;\n this._selectionDepth = 0;\n\n this._frameNumber = 0;\n this._touchedFrame = 0;\n this._visitedFrame = 0;\n this._selectedFrame = 0;\n this._requestedFrame = 0;\n\n this._priority = 0.0;\n }\n\n _getRefine(refine) {\n // Inherit from parent tile if omitted.\n return refine || (this.parent && this.parent.refine) || TILE_REFINEMENT.REPLACE;\n }\n\n _isTileset() {\n return this.contentUrl.indexOf('.json') !== -1;\n }\n\n _onContentLoaded() {\n // Vector and Geometry tile rendering do not support the skip LOD optimization.\n switch (this.content && this.content.type) {\n case 'vctr':\n case 'geom':\n // @ts-ignore\n this.tileset._traverser.disableSkipLevelOfDetail = true;\n break;\n default:\n }\n\n // The content may be tileset json\n if (this._isTileset()) {\n this.hasTilesetContent = true;\n }\n }\n\n _updateBoundingVolume(header) {\n // Update the bounding volumes\n this.boundingVolume = createBoundingVolume(\n header.boundingVolume,\n this.computedTransform,\n this.boundingVolume\n );\n\n const content = header.content;\n if (!content) {\n return;\n }\n\n // TODO Cesium specific\n // Non-leaf tiles may have a content bounding-volume, which is a tight-fit bounding volume\n // around only the features in the tile. This box is useful for culling for rendering,\n // but not for culling for traversing the tree since it does not guarantee spatial coherence, i.e.,\n // since it only bounds features in the tile, not the entire tile, children may be\n // outside of this box.\n if (content.boundingVolume) {\n this._contentBoundingVolume = createBoundingVolume(\n content.boundingVolume,\n this.computedTransform,\n this._contentBoundingVolume\n );\n }\n if (header.viewerRequestVolume) {\n this._viewerRequestVolume = createBoundingVolume(\n header.viewerRequestVolume,\n this.computedTransform,\n this._viewerRequestVolume\n );\n }\n }\n\n // Update the tile's transform. The transform is applied to the tile's bounding volumes.\n _updateTransform(parentTransform = new Matrix4()) {\n const computedTransform = parentTransform.clone().multiplyRight(this.transform);\n const didTransformChange = !computedTransform.equals(this.computedTransform);\n\n if (!didTransformChange) {\n return;\n }\n\n this.computedTransform = computedTransform;\n\n this._updateBoundingVolume(this.header);\n }\n\n // Get options which are applicable only for the particular loader\n _getLoaderSpecificOptions(loaderId) {\n switch (loaderId) {\n case 'i3s':\n return {\n ...this.tileset.options.i3s,\n _tileOptions: {\n attributeUrls: this.header.attributeUrls,\n textureUrl: this.header.textureUrl,\n textureFormat: this.header.textureFormat,\n textureLoaderOptions: this.header.textureLoaderOptions,\n materialDefinition: this.header.materialDefinition,\n isDracoGeometry: this.header.isDracoGeometry,\n mbs: this.header.mbs\n },\n _tilesetOptions: {\n store: this.tileset.tileset.store,\n attributeStorageInfo: this.tileset.tileset.attributeStorageInfo,\n fields: this.tileset.tileset.fields\n },\n isTileHeader: false\n };\n case '3d-tiles':\n case 'cesium-ion':\n default:\n return get3dTilesOptions(this.tileset.tileset);\n }\n }\n}\n"],"mappings":";AAKA,SAAQA,OAAO,EAAEC,OAAO,QAAO,eAAe;AAC9C,SAAQC,aAAa,QAAO,kBAAkB;AAE9C,SAAQC,IAAI,QAAO,kBAAkB;AAIrC,SAAQC,eAAe,EAAEC,kBAAkB,EAAEC,YAAY,QAAO,cAAc;AAG9E,SACEC,oBAAoB,EACpBC,qBAAqB,QAEhB,2BAA2B;AAClC,SAAQC,0BAA0B,QAAO,wBAAwB;AACjE,SAAQC,kBAAkB,QAAO,mBAAmB;AACpD,SAAQC,iBAAiB,QAAO,4BAA4B;AAC5D,SAAQC,gBAAgB,QAAO,qBAAqB;AAEpD,MAAMC,aAAa,GAAG,IAAIb,OAAO,CAAC,CAAC;AAEnC,SAASc,OAAOA,CAACC,CAAC,EAAE;EAClB,OAAOA,CAAC,KAAKC,SAAS,IAAID,CAAC,KAAK,IAAI;AACtC;AAqBA,OAAO,MAAME,MAAM,CAAC;EAoFlBC,WAAWA,CACTC,OAAkB,EAClBC,MAA4B,EAC5BC,YAAqB,EAErB;IAAA,IADAC,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAP,SAAA,GAAAO,SAAA,MAAG,EAAE;IAAAE,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAA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T","TILE_CONTENT_STATE","TILESET_TYPE","createBoundingVolume","getCartographicBounds","getTiles3DScreenSpaceError","getProjectedRadius","get3dTilesOptions","TilesetTraverser","scratchVector","defined","x","undefined","Tile3D","constructor","tileset","header","parentHeader","extendedId","arguments","length","_defineProperty","UNLOADED","id","url","parent","refine","_getRefine","type","contentUrl","_initializeLodMetric","_initializeTransforms","_initializeBoundingVolumes","_initializeContent","_initializeRenderingState","Object","seal","destroy","isDestroyed","selected","_selectedFrame","_frameNumber","isVisible","_visible","isVisibleAndInRequestVolume","_inRequestVolume","hasRenderContent","hasEmptyContent","hasTilesetContent","hasChildren","children","contentReady","contentState","READY","contentAvailable","Boolean","_expiredContent","contentFailed","hasUnloadedContent","contentUnloaded","contentExpired","EXPIRED","FAILED","distanceToCamera","_distanceToCamera","screenSpaceError","_screenSpaceError","boundingBox","_boundingBox","boundingVolume","getScreenSpaceError","frameState","useParentLodMetric","I3S","TILES3D","Error","unselect","_getGpuMemoryUsageInBytes","content","gpuMemoryUsageInBytes","byteLength","_getPriority","traverser","_traverser","skipLevelOfDetail","options","maySkipTile","ADD","_touchedFrame","useParentScreenSpaceError","rootScreenSpaceError","root","Math","max","loadContent","expired","_expireDate","LOADING","requestToken","_requestScheduler","scheduleRequest","bind","getTileUrl","loader","loadOptions","isTileset","_getLoaderSpecificOptions","contentLoader","_isTileset","_initializeTileHeaders","_onContentLoaded","error","done","unloadContent","updateVisibility","viewportIds","frameNumber","parentVisibilityPlaneMask","_visibilityPlaneMask","MASK_INDETERMINATE","updateTransforms","parentTransform","computedTransform","modelMatrix","_updateTransform","distanceToTile","visibility","MASK_OUTSIDE","insideViewerRequestVolume","cullingVolume","computeVisibilityWithPlaneMask","contentVisibility","sqrt","distanceSquaredTo","camera","position","cameraSpaceZDepth","_ref","subVectors","center","direction","dot","viewerRequestVolume","_viewerRequestVolume","updateExpiration","now","Date","lessThan","extras","lodMetricType","console","warn","lodMetricValue","tileHeader","transform","clone","multiplyRight","parentInitialTransform","_initialTransform","_contentBoundingVolume","_updateBoundingVolume","_tileset","_tile","depth","level","_shouldRefine","_centerZDepth","_stackLength","_selectionDepth","_visitedFrame","_requestedFrame","_priority","REPLACE","indexOf","disableSkipLevelOfDetail","didTransformChange","equals","loaderId","i3s","_tileOptions","attributeUrls","textureUrl","textureFormat","textureLoaderOptions","materialDefinition","isDracoGeometry","mbs","_tilesetOptions","store","attributeStorageInfo","fields","isTileHeader"],"sources":["../../../src/tileset/tile-3d.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector3, Matrix4} from '@math.gl/core';\nimport {CullingVolume} from '@math.gl/culling';\n\nimport {load} from '@loaders.gl/core';\n\n// Note: circular dependency\nimport type {Tileset3D} from './tileset-3d';\nimport type {DoublyLinkedListNode} from '../utils/doubly-linked-list-node';\nimport {TILE_REFINEMENT, TILE_CONTENT_STATE, TILESET_TYPE} from '../constants';\n\nimport {FrameState} from './helpers/frame-state';\nimport {\n createBoundingVolume,\n getCartographicBounds,\n CartographicBounds\n} from './helpers/bounding-volume';\nimport {getTiles3DScreenSpaceError} from './helpers/tiles-3d-lod';\nimport {getProjectedRadius} from './helpers/i3s-lod';\nimport {get3dTilesOptions} from './helpers/3d-tiles-options';\nimport {TilesetTraverser} from './tileset-traverser';\n\nconst scratchVector = new Vector3();\n\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\n\n/**\n * @param tileset - Tileset3D instance\n * @param header - tile header - JSON loaded from a dataset\n * @param parentHeader - parent Tile3D instance\n * @param extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n */\nexport type Tile3DProps = {\n tileset: Tileset3D;\n header: Object;\n parentHeader: Tile3D;\n extendedId: string;\n};\n\n/**\n * A Tile3DHeader represents a tile as Tileset3D. When a tile is first created, its content is not loaded;\n * the content is loaded on-demand when needed based on the view.\n * Do not construct this directly, instead access tiles through {@link Tileset3D#tileVisible}.\n */\nexport class Tile3D {\n tileset: Tileset3D;\n header: any;\n id: string;\n url: string;\n parent: Tile3D;\n /* Specifies the type of refine that is used when traversing this tile for rendering. */\n refine: number;\n type: string;\n contentUrl: string;\n /** Different refinement algorithms used by I3S and 3D tiles */\n lodMetricType: 'geometricError' | 'maxScreenThreshold' = 'geometricError';\n /** The error, in meters, introduced if this tile is rendered and its children are not. */\n lodMetricValue: number = 0;\n\n /** @todo math.gl is not exporting BoundingVolume base type? */\n boundingVolume: any = null;\n\n /**\n * The tile's content. This represents the actual tile's payload,\n * not the content's metadata in the tileset JSON file.\n */\n content: any = null;\n contentState: number = TILE_CONTENT_STATE.UNLOADED;\n gpuMemoryUsageInBytes: number = 0;\n\n /** The tile's children - an array of Tile3D objects. */\n children: Tile3D[] = [];\n depth: number = 0;\n viewportIds: any[] = [];\n transform = new Matrix4();\n extensions: any = null;\n /** TODO Cesium 3d tiles specific */\n implicitTiling?: any = null;\n\n /** Container to store application specific data */\n userData: Record<string, any> = {};\n\n computedTransform: any;\n hasEmptyContent: boolean = false;\n hasTilesetContent: boolean = false;\n\n traverser = new TilesetTraverser({});\n\n /** Used by TilesetCache */\n _cacheNode: DoublyLinkedListNode | null = null;\n\n private _frameNumber: any = null;\n\n // TODO Cesium 3d tiles specific\n private _expireDate: any = null;\n private _expiredContent: any = null;\n\n private _boundingBox?: CartographicBounds;\n\n /** updated every frame for tree traversal and rendering optimizations: */\n public _distanceToCamera: number = 0;\n _screenSpaceError: number = 0;\n private _visibilityPlaneMask: any;\n private _visible: boolean | undefined = undefined;\n\n private _contentBoundingVolume: any;\n private _viewerRequestVolume: any;\n\n _initialTransform: Matrix4 = new Matrix4();\n\n // Used by traverser, cannot be marked private\n _priority: number = 0;\n _selectedFrame: number = 0;\n _requestedFrame: number = 0;\n _selectionDepth: number = 0;\n _touchedFrame: number = 0;\n _centerZDepth: number = 0;\n _shouldRefine: boolean = false;\n _stackLength: number = 0;\n _visitedFrame: number = 0;\n _inRequestVolume: boolean = false;\n\n // TODO i3s specific, needs to remove\n // private _lodJudge: any = null;\n\n /**\n * @constructs\n * Create a Tile3D instance\n * @param tileset - Tileset3D instance\n * @param header - tile header - JSON loaded from a dataset\n * @param parentHeader - parent Tile3D instance\n * @param extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n */\n // eslint-disable-next-line max-statements\n constructor(\n tileset: Tileset3D,\n header: {[key: string]: any},\n parentHeader?: Tile3D,\n extendedId = ''\n ) {\n // PUBLIC MEMBERS\n // original tile data\n this.header = header;\n\n // The tileset containing this tile.\n this.tileset = tileset;\n this.id = extendedId || header.id;\n this.url = header.url;\n\n // This tile's parent or `undefined` if this tile is the root.\n // @ts-ignore\n this.parent = parentHeader;\n this.refine = this._getRefine(header.refine);\n this.type = header.type;\n this.contentUrl = header.contentUrl;\n\n this._initializeLodMetric(header);\n this._initializeTransforms(header);\n this._initializeBoundingVolumes(header);\n this._initializeContent(header);\n this._initializeRenderingState(header);\n\n Object.seal(this);\n }\n\n destroy() {\n this.header = null;\n }\n\n isDestroyed() {\n return this.header === null;\n }\n\n get selected() {\n return this._selectedFrame === this.tileset._frameNumber;\n }\n\n get isVisible() {\n return this._visible;\n }\n\n get isVisibleAndInRequestVolume() {\n return this._visible && this._inRequestVolume;\n }\n\n /** Returns true if tile is not an empty tile and not an external tileset */\n get hasRenderContent() {\n return !this.hasEmptyContent && !this.hasTilesetContent;\n }\n\n /** Returns true if tile has children */\n get hasChildren() {\n return this.children.length > 0 || (this.header.children && this.header.children.length > 0);\n }\n\n /**\n * Determines if the tile's content is ready. This is automatically `true` for\n * tiles with empty content.\n */\n get contentReady() {\n return this.contentState === TILE_CONTENT_STATE.READY || this.hasEmptyContent;\n }\n\n /**\n * Determines if the tile has available content to render. `true` if the tile's\n * content is ready or if it has expired content this renders while new content loads; otherwise,\n */\n get contentAvailable() {\n return Boolean(\n (this.contentReady && this.hasRenderContent) || (this._expiredContent && !this.contentFailed)\n );\n }\n\n /** Returns true if tile has renderable content but it's unloaded */\n get hasUnloadedContent() {\n return this.hasRenderContent && this.contentUnloaded;\n }\n\n /**\n * Determines if the tile's content has not be requested. `true` if tile's\n * content has not be requested; otherwise, `false`.\n */\n get contentUnloaded() {\n return this.contentState === TILE_CONTENT_STATE.UNLOADED;\n }\n\n /**\n * Determines if the tile's content is expired. `true` if tile's\n * content is expired; otherwise, `false`.\n */\n get contentExpired() {\n return this.contentState === TILE_CONTENT_STATE.EXPIRED;\n }\n\n // Determines if the tile's content failed to load. `true` if the tile's\n // content failed to load; otherwise, `false`.\n get contentFailed() {\n return this.contentState === TILE_CONTENT_STATE.FAILED;\n }\n\n /**\n * Distance from the tile's bounding volume center to the camera\n */\n get distanceToCamera(): number {\n return this._distanceToCamera;\n }\n\n /**\n * Screen space error for LOD selection\n */\n get screenSpaceError(): number {\n return this._screenSpaceError;\n }\n\n /**\n * Get bounding box in cartographic coordinates\n * @returns [min, max] each in [longitude, latitude, altitude]\n */\n get boundingBox(): CartographicBounds {\n if (!this._boundingBox) {\n this._boundingBox = getCartographicBounds(this.header.boundingVolume, this.boundingVolume);\n }\n return this._boundingBox;\n }\n\n /** Get the tile's screen space error. */\n getScreenSpaceError(frameState, useParentLodMetric) {\n switch (this.tileset.type) {\n case TILESET_TYPE.I3S:\n return getProjectedRadius(this, frameState);\n case TILESET_TYPE.TILES3D:\n return getTiles3DScreenSpaceError(this, frameState, useParentLodMetric);\n default:\n // eslint-disable-next-line\n throw new Error('Unsupported tileset type');\n }\n }\n\n /**\n * Make tile unselected than means it won't be shown\n * but it can be still loaded in memory\n */\n unselect(): void {\n this._selectedFrame = 0;\n }\n\n /**\n * Memory usage of tile on GPU\n */\n _getGpuMemoryUsageInBytes(): number {\n return this.content.gpuMemoryUsageInBytes || this.content.byteLength || 0;\n }\n\n /*\n * If skipLevelOfDetail is off try to load child tiles as soon as possible so that their parent can refine sooner.\n * Tiles are prioritized by screen space error.\n */\n // eslint-disable-next-line complexity\n _getPriority() {\n const traverser = this.tileset._traverser;\n const {skipLevelOfDetail} = traverser.options;\n\n /*\n * Tiles that are outside of the camera's frustum could be skipped if we are in 'ADD' mode\n * or if we are using 'Skip Traversal' in 'REPLACE' mode.\n * Otherewise, all 'touched' child tiles have to be loaded and displayed,\n * this may include tiles that are outide of the camera frustum (so that we can hide the parent tile).\n */\n const maySkipTile = this.refine === TILE_REFINEMENT.ADD || skipLevelOfDetail;\n\n // Check if any reason to abort\n if (maySkipTile && !this.isVisible && this._visible !== undefined) {\n return -1;\n }\n // Condition used in `cancelOutOfViewRequests` function in CesiumJS/Cesium3DTileset.js\n if (this.tileset._frameNumber - this._touchedFrame >= 1) {\n return -1;\n }\n if (this.contentState === TILE_CONTENT_STATE.UNLOADED) {\n return -1;\n }\n\n // Based on the priority function `getPriorityReverseScreenSpaceError` in CesiumJS. Scheduling priority is based on the parent's screen space error when possible.\n const parent = this.parent;\n const useParentScreenSpaceError =\n parent && (!maySkipTile || this._screenSpaceError === 0.0 || parent.hasTilesetContent);\n const screenSpaceError = useParentScreenSpaceError\n ? parent._screenSpaceError\n : this._screenSpaceError;\n\n const rootScreenSpaceError = traverser.root ? traverser.root._screenSpaceError : 0.0;\n\n // Map higher SSE to lower values (e.g. root tile is highest priority)\n return Math.max(rootScreenSpaceError - screenSpaceError, 0);\n }\n\n /**\n * Requests the tile's content.\n * The request may not be made if the Request Scheduler can't prioritize it.\n */\n // eslint-disable-next-line max-statements, complexity\n async loadContent(): Promise<boolean> {\n if (this.hasEmptyContent) {\n return false;\n }\n\n if (this.content) {\n return true;\n }\n\n const expired = this.contentExpired;\n\n if (expired) {\n this._expireDate = null;\n }\n\n this.contentState = TILE_CONTENT_STATE.LOADING;\n\n const requestToken = await this.tileset._requestScheduler.scheduleRequest(\n this.id,\n this._getPriority.bind(this)\n );\n\n if (!requestToken) {\n // cancelled\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n return false;\n }\n\n try {\n const contentUrl = this.tileset.getTileUrl(this.contentUrl);\n // The content can be a binary tile ot a JSON tileset\n const loader = this.tileset.loader;\n const options = {\n ...this.tileset.loadOptions,\n [loader.id]: {\n // @ts-expect-error\n ...this.tileset.loadOptions[loader.id],\n isTileset: this.type === 'json',\n ...this._getLoaderSpecificOptions(loader.id)\n }\n };\n\n this.content = await load(contentUrl, loader, options);\n\n if (this.tileset.options.contentLoader) {\n await this.tileset.options.contentLoader(this);\n }\n\n if (this._isTileset()) {\n // Add tile headers for the nested tilset's subtree\n // Async update of the tree should be fine since there would never be edits to the same node\n // TODO - we need to capture the child tileset's URL\n this.tileset._initializeTileHeaders(this.content, this);\n }\n\n this.contentState = TILE_CONTENT_STATE.READY;\n this._onContentLoaded();\n return true;\n } catch (error) {\n // Tile is unloaded before the content finishes loading\n this.contentState = TILE_CONTENT_STATE.FAILED;\n throw error;\n } finally {\n requestToken.done();\n }\n }\n\n // Unloads the tile's content.\n unloadContent() {\n if (this.content && this.content.destroy) {\n this.content.destroy();\n }\n this.content = null;\n if (this.header.content && this.header.content.destroy) {\n this.header.content.destroy();\n }\n this.header.content = null;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n return true;\n }\n\n /**\n * Update the tile's visibility\n * @param {Object} frameState - frame state for tile culling\n * @param {string[]} viewportIds - a list of viewport ids that show this tile\n * @return {void}\n */\n updateVisibility(frameState, viewportIds) {\n if (this._frameNumber === frameState.frameNumber) {\n // Return early if visibility has already been checked during the traversal.\n // The visibility may have already been checked if the cullWithChildrenBounds optimization is used.\n return;\n }\n\n const parent = this.parent;\n const parentVisibilityPlaneMask = parent\n ? parent._visibilityPlaneMask\n : CullingVolume.MASK_INDETERMINATE;\n\n if (this.tileset._traverser.options.updateTransforms) {\n const parentTransform = parent ? parent.computedTransform : this.tileset.modelMatrix;\n this._updateTransform(parentTransform);\n }\n\n this._distanceToCamera = this.distanceToTile(frameState);\n this._screenSpaceError = this.getScreenSpaceError(frameState, false);\n this._visibilityPlaneMask = this.visibility(frameState, parentVisibilityPlaneMask); // Use parent's plane mask to speed up visibility test\n this._visible = this._visibilityPlaneMask !== CullingVolume.MASK_OUTSIDE;\n this._inRequestVolume = this.insideViewerRequestVolume(frameState);\n\n this._frameNumber = frameState.frameNumber;\n this.viewportIds = viewportIds;\n }\n\n // Determines whether the tile's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @param {Number} parentVisibilityPlaneMask The parent's plane mask to speed up the visibility check.\n // @returns {Number} A plane mask as described above in {@link CullingVolume#computeVisibilityWithPlaneMask}.\n visibility(frameState, parentVisibilityPlaneMask) {\n const {cullingVolume} = frameState;\n const {boundingVolume} = this;\n\n // TODO Cesium specific - restore clippingPlanes\n // const {clippingPlanes, clippingPlanesOriginMatrix} = tileset;\n // if (clippingPlanes && clippingPlanes.enabled) {\n // const intersection = clippingPlanes.computeIntersectionWithBoundingVolume(\n // boundingVolume,\n // clippingPlanesOriginMatrix\n // );\n // this._isClipped = intersection !== Intersect.INSIDE;\n // if (intersection === Intersect.OUTSIDE) {\n // return CullingVolume.MASK_OUTSIDE;\n // }\n // }\n\n // return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);\n return cullingVolume.computeVisibilityWithPlaneMask(boundingVolume, parentVisibilityPlaneMask);\n }\n\n // Assuming the tile's bounding volume intersects the culling volume, determines\n // whether the tile's content's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @returns {Intersect} The result of the intersection: the tile's content is completely outside, completely inside, or intersecting the culling volume.\n contentVisibility() {\n return true;\n\n // TODO restore\n /*\n // Assumes the tile's bounding volume intersects the culling volume already, so\n // just return Intersect.INSIDE if there is no content bounding volume.\n if (!defined(this.contentBoundingVolume)) {\n return Intersect.INSIDE;\n }\n\n if (this._visibilityPlaneMask === CullingVolume.MASK_INSIDE) {\n // The tile's bounding volume is completely inside the culling volume so\n // the content bounding volume must also be inside.\n return Intersect.INSIDE;\n }\n\n // PERFORMANCE_IDEA: is it possible to burn less CPU on this test since we know the\n // tile's (not the content's) bounding volume intersects the culling volume?\n const cullingVolume = frameState.cullingVolume;\n const boundingVolume = tile.contentBoundingVolume;\n\n const tileset = this.tileset;\n const clippingPlanes = tileset.clippingPlanes;\n if (defined(clippingPlanes) && clippingPlanes.enabled) {\n const intersection = clippingPlanes.computeIntersectionWithBoundingVolume(\n boundingVolume,\n tileset.clippingPlanesOriginMatrix\n );\n this._isClipped = intersection !== Intersect.INSIDE;\n if (intersection === Intersect.OUTSIDE) {\n return Intersect.OUTSIDE;\n }\n }\n\n return cullingVolume.computeVisibility(boundingVolume);\n */\n }\n\n /**\n * Computes the (potentially approximate) distance from the closest point of the tile's bounding volume to the camera.\n * @param frameState The frame state.\n * @returns {Number} The distance, in meters, or zero if the camera is inside the bounding volume.\n */\n distanceToTile(frameState: FrameState): number {\n const boundingVolume = this.boundingVolume;\n return Math.sqrt(Math.max(boundingVolume.distanceSquaredTo(frameState.camera.position), 0));\n }\n\n /**\n * Computes the tile's camera-space z-depth.\n * @param frameState The frame state.\n * @returns The distance, in meters.\n */\n cameraSpaceZDepth({camera}): number {\n const boundingVolume = this.boundingVolume; // Gets the underlying OrientedBoundingBox or BoundingSphere\n scratchVector.subVectors(boundingVolume.center, camera.position);\n return camera.direction.dot(scratchVector);\n }\n\n /**\n * Checks if the camera is inside the viewer request volume.\n * @param {FrameState} frameState The frame state.\n * @returns {Boolean} Whether the camera is inside the volume.\n */\n insideViewerRequestVolume(frameState: FrameState) {\n const viewerRequestVolume = this._viewerRequestVolume;\n return (\n !viewerRequestVolume || viewerRequestVolume.distanceSquaredTo(frameState.camera.position) <= 0\n );\n }\n\n // TODO Cesium specific\n\n // Update whether the tile has expired.\n updateExpiration() {\n if (defined(this._expireDate) && this.contentReady && !this.hasEmptyContent) {\n const now = Date.now();\n // @ts-ignore Date.lessThan - replace with ms compare?\n if (Date.lessThan(this._expireDate, now)) {\n this.contentState = TILE_CONTENT_STATE.EXPIRED;\n this._expiredContent = this.content;\n }\n }\n }\n\n get extras() {\n return this.header.extras;\n }\n\n // INTERNAL METHODS\n\n _initializeLodMetric(header) {\n if ('lodMetricType' in header) {\n this.lodMetricType = header.lodMetricType;\n } else {\n this.lodMetricType = (this.parent && this.parent.lodMetricType) || this.tileset.lodMetricType;\n // eslint-disable-next-line\n console.warn(`3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType`);\n }\n\n // This is used to compute screen space error, i.e., the error measured in pixels.\n if ('lodMetricValue' in header) {\n this.lodMetricValue = header.lodMetricValue;\n } else {\n this.lodMetricValue =\n (this.parent && this.parent.lodMetricValue) || this.tileset.lodMetricValue;\n // eslint-disable-next-line\n console.warn(\n '3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue'\n );\n }\n }\n\n _initializeTransforms(tileHeader) {\n // The local transform of this tile.\n this.transform = tileHeader.transform ? new Matrix4(tileHeader.transform) : new Matrix4();\n\n const parent = this.parent;\n const tileset = this.tileset;\n\n const parentTransform =\n parent && parent.computedTransform\n ? parent.computedTransform.clone()\n : tileset.modelMatrix.clone();\n this.computedTransform = new Matrix4(parentTransform).multiplyRight(this.transform);\n\n const parentInitialTransform =\n parent && parent._initialTransform ? parent._initialTransform.clone() : new Matrix4();\n this._initialTransform = new Matrix4(parentInitialTransform).multiplyRight(this.transform);\n }\n\n _initializeBoundingVolumes(tileHeader) {\n this._contentBoundingVolume = null;\n this._viewerRequestVolume = null;\n\n this._updateBoundingVolume(tileHeader);\n }\n\n _initializeContent(tileHeader) {\n // Empty tile by default\n this.content = {_tileset: this.tileset, _tile: this};\n this.hasEmptyContent = true;\n this.contentState = TILE_CONTENT_STATE.UNLOADED;\n\n // When `true`, the tile's content points to an external tileset.\n // This is `false` until the tile's content is loaded.\n this.hasTilesetContent = false;\n\n if (tileHeader.contentUrl) {\n this.content = null;\n this.hasEmptyContent = false;\n }\n }\n\n // TODO - remove anything not related to basic visibility detection\n _initializeRenderingState(header) {\n this.depth = header.level || (this.parent ? this.parent.depth + 1 : 0);\n this._shouldRefine = false;\n\n // Members this are updated every frame for tree traversal and rendering optimizations:\n this._distanceToCamera = 0;\n this._centerZDepth = 0;\n this._screenSpaceError = 0;\n this._visibilityPlaneMask = CullingVolume.MASK_INDETERMINATE;\n this._visible = undefined;\n this._inRequestVolume = false;\n\n this._stackLength = 0;\n this._selectionDepth = 0;\n\n this._frameNumber = 0;\n this._touchedFrame = 0;\n this._visitedFrame = 0;\n this._selectedFrame = 0;\n this._requestedFrame = 0;\n\n this._priority = 0.0;\n }\n\n _getRefine(refine) {\n // Inherit from parent tile if omitted.\n return refine || (this.parent && this.parent.refine) || TILE_REFINEMENT.REPLACE;\n }\n\n _isTileset() {\n return this.contentUrl.indexOf('.json') !== -1;\n }\n\n _onContentLoaded() {\n // Vector and Geometry tile rendering do not support the skip LOD optimization.\n switch (this.content && this.content.type) {\n case 'vctr':\n case 'geom':\n // @ts-ignore\n this.tileset._traverser.disableSkipLevelOfDetail = true;\n break;\n default:\n }\n\n // The content may be tileset json\n if (this._isTileset()) {\n this.hasTilesetContent = true;\n } else {\n this.gpuMemoryUsageInBytes = this._getGpuMemoryUsageInBytes();\n }\n }\n\n _updateBoundingVolume(header) {\n // Update the bounding volumes\n this.boundingVolume = createBoundingVolume(\n header.boundingVolume,\n this.computedTransform,\n this.boundingVolume\n );\n\n const content = header.content;\n if (!content) {\n return;\n }\n\n // TODO Cesium specific\n // Non-leaf tiles may have a content bounding-volume, which is a tight-fit bounding volume\n // around only the features in the tile. This box is useful for culling for rendering,\n // but not for culling for traversing the tree since it does not guarantee spatial coherence, i.e.,\n // since it only bounds features in the tile, not the entire tile, children may be\n // outside of this box.\n if (content.boundingVolume) {\n this._contentBoundingVolume = createBoundingVolume(\n content.boundingVolume,\n this.computedTransform,\n this._contentBoundingVolume\n );\n }\n if (header.viewerRequestVolume) {\n this._viewerRequestVolume = createBoundingVolume(\n header.viewerRequestVolume,\n this.computedTransform,\n this._viewerRequestVolume\n );\n }\n }\n\n // Update the tile's transform. The transform is applied to the tile's bounding volumes.\n _updateTransform(parentTransform = new Matrix4()) {\n const computedTransform = parentTransform.clone().multiplyRight(this.transform);\n const didTransformChange = !computedTransform.equals(this.computedTransform);\n\n if (!didTransformChange) {\n return;\n }\n\n this.computedTransform = computedTransform;\n\n this._updateBoundingVolume(this.header);\n }\n\n // Get options which are applicable only for the particular loader\n _getLoaderSpecificOptions(loaderId) {\n switch (loaderId) {\n case 'i3s':\n return {\n ...this.tileset.options.i3s,\n _tileOptions: {\n attributeUrls: this.header.attributeUrls,\n textureUrl: this.header.textureUrl,\n textureFormat: this.header.textureFormat,\n textureLoaderOptions: this.header.textureLoaderOptions,\n materialDefinition: this.header.materialDefinition,\n isDracoGeometry: this.header.isDracoGeometry,\n mbs: this.header.mbs\n },\n _tilesetOptions: {\n store: this.tileset.tileset.store,\n attributeStorageInfo: this.tileset.tileset.attributeStorageInfo,\n fields: this.tileset.tileset.fields\n },\n isTileHeader: false\n };\n case '3d-tiles':\n case 'cesium-ion':\n default:\n return get3dTilesOptions(this.tileset.tileset);\n }\n }\n}\n"],"mappings":";AAKA,SAAQA,OAAO,EAAEC,OAAO,QAAO,eAAe;AAC9C,SAAQC,aAAa,QAAO,kBAAkB;AAE9C,SAAQC,IAAI,QAAO,kBAAkB;AAKrC,SAAQC,eAAe,EAAEC,kBAAkB,EAAEC,YAAY,QAAO,cAAc;AAG9E,SACEC,oBAAoB,EACpBC,qBAAqB,QAEhB,2BAA2B;AAClC,SAAQC,0BAA0B,QAAO,wBAAwB;AACjE,SAAQC,kBAAkB,QAAO,mBAAmB;AACpD,SAAQC,iBAAiB,QAAO,4BAA4B;AAC5D,SAAQC,gBAAgB,QAAO,qBAAqB;AAEpD,MAAMC,aAAa,GAAG,IAAIb,OAAO,CAAC,CAAC;AAEnC,SAASc,OAAOA,CAACC,CAAC,EAAE;EAClB,OAAOA,CAAC,KAAKC,SAAS,IAAID,CAAC,KAAK,IAAI;AACtC;AAqBA,OAAO,MAAME,MAAM,CAAC;EA2F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AAC,IAAI,CAAChJ,MAAM,CAAC;EACzC;EAGA0F,yBAAyBA,CAACuE,QAAQ,EAAE;IAClC,QAAQA,QAAQ;MACd,KAAK,KAAK;QACR,OAAO;UACL,GAAG,IAAI,CAAClK,OAAO,CAACsE,OAAO,CAAC6F,GAAG;UAC3BC,YAAY,EAAE;YACZC,aAAa,EAAE,IAAI,CAACpK,MAAM,CAACoK,aAAa;YACxCC,UAAU,EAAE,IAAI,CAACrK,MAAM,CAACqK,UAAU;YAClCC,aAAa,EAAE,IAAI,CAACtK,MAAM,CAACsK,aAAa;YACxCC,oBAAoB,EAAE,IAAI,CAACvK,MAAM,CAACuK,oBAAoB;YACtDC,kBAAkB,EAAE,IAAI,CAACxK,MAAM,CAACwK,kBAAkB;YAClDC,eAAe,EAAE,IAAI,CAACzK,MAAM,CAACyK,eAAe;YAC5CC,GAAG,EAAE,IAAI,CAAC1K,MAAM,CAAC0K;UACnB,CAAC;UACDC,eAAe,EAAE;YACfC,KAAK,EAAE,IAAI,CAAC7K,OAAO,CAACA,OAAO,CAAC6K,KAAK;YACjCC,oBAAoB,EAAE,IAAI,CAAC9K,OAAO,CAACA,OAAO,CAAC8K,oBAAoB;YAC/DC,MAAM,EAAE,IAAI,CAAC/K,OAAO,CAACA,OAAO,CAAC+K;UAC/B,CAAC;UACDC,YAAY,EAAE;QAChB,CAAC;MACH,KAAK,UAAU;MACf,KAAK,YAAY;MACjB;QACE,OAAOxL,iBAAiB,CAAC,IAAI,CAACQ,OAAO,CAACA,OAAO,CAAC;IAClD;EACF;AACF"}
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
2
2
|
import { Matrix4, Vector3 } from '@math.gl/core';
|
|
3
3
|
import { Ellipsoid } from '@math.gl/geospatial';
|
|
4
4
|
import { Stats } from '@probe.gl/stats';
|
|
5
|
-
import { RequestScheduler,
|
|
5
|
+
import { RequestScheduler, path } from '@loaders.gl/loader-utils';
|
|
6
6
|
import { TilesetCache } from './tileset-cache';
|
|
7
7
|
import { calculateTransformProps } from './helpers/transform-utils';
|
|
8
8
|
import { getFrameState, limitSelectedTiles } from './helpers/frame-state';
|
|
@@ -49,7 +49,7 @@ const TILES_LOAD_FAILED = 'Failed Tile Loads';
|
|
|
49
49
|
const POINTS_COUNT = 'Points/Vertices';
|
|
50
50
|
const TILES_GPU_MEMORY = 'Tile Memory Use';
|
|
51
51
|
export class Tileset3D {
|
|
52
|
-
constructor(
|
|
52
|
+
constructor(tileset, options) {
|
|
53
53
|
_defineProperty(this, "options", void 0);
|
|
54
54
|
_defineProperty(this, "loadOptions", void 0);
|
|
55
55
|
_defineProperty(this, "type", void 0);
|
|
@@ -62,14 +62,14 @@ export class Tileset3D {
|
|
|
62
62
|
_defineProperty(this, "lodMetricType", void 0);
|
|
63
63
|
_defineProperty(this, "lodMetricValue", void 0);
|
|
64
64
|
_defineProperty(this, "refine", void 0);
|
|
65
|
-
_defineProperty(this, "root",
|
|
66
|
-
_defineProperty(this, "roots",
|
|
67
|
-
_defineProperty(this, "asset",
|
|
68
|
-
_defineProperty(this, "description",
|
|
65
|
+
_defineProperty(this, "root", null);
|
|
66
|
+
_defineProperty(this, "roots", {});
|
|
67
|
+
_defineProperty(this, "asset", {});
|
|
68
|
+
_defineProperty(this, "description", '');
|
|
69
69
|
_defineProperty(this, "properties", void 0);
|
|
70
|
-
_defineProperty(this, "extras",
|
|
71
|
-
_defineProperty(this, "attributions",
|
|
72
|
-
_defineProperty(this, "credits",
|
|
70
|
+
_defineProperty(this, "extras", null);
|
|
71
|
+
_defineProperty(this, "attributions", {});
|
|
72
|
+
_defineProperty(this, "credits", {});
|
|
73
73
|
_defineProperty(this, "stats", void 0);
|
|
74
74
|
_defineProperty(this, "contentFormats", {
|
|
75
75
|
draco: false,
|
|
@@ -77,84 +77,55 @@ export class Tileset3D {
|
|
|
77
77
|
dds: false,
|
|
78
78
|
ktx2: false
|
|
79
79
|
});
|
|
80
|
-
_defineProperty(this, "
|
|
81
|
-
_defineProperty(this, "
|
|
82
|
-
_defineProperty(this, "
|
|
83
|
-
_defineProperty(this, "
|
|
84
|
-
_defineProperty(this, "
|
|
85
|
-
_defineProperty(this, "
|
|
86
|
-
_defineProperty(this, "
|
|
87
|
-
_defineProperty(this, "
|
|
88
|
-
_defineProperty(this, "
|
|
89
|
-
_defineProperty(this, "
|
|
90
|
-
_defineProperty(this, "
|
|
80
|
+
_defineProperty(this, "cartographicCenter", null);
|
|
81
|
+
_defineProperty(this, "cartesianCenter", null);
|
|
82
|
+
_defineProperty(this, "zoom", 1);
|
|
83
|
+
_defineProperty(this, "boundingVolume", null);
|
|
84
|
+
_defineProperty(this, "dynamicScreenSpaceErrorComputedDensity", 0.0);
|
|
85
|
+
_defineProperty(this, "maximumMemoryUsage", 32);
|
|
86
|
+
_defineProperty(this, "gpuMemoryUsageInBytes", 0);
|
|
87
|
+
_defineProperty(this, "_frameNumber", 0);
|
|
88
|
+
_defineProperty(this, "_queryParams", {});
|
|
89
|
+
_defineProperty(this, "_extensionsUsed", []);
|
|
90
|
+
_defineProperty(this, "_tiles", {});
|
|
91
|
+
_defineProperty(this, "_pendingCount", 0);
|
|
92
|
+
_defineProperty(this, "selectedTiles", []);
|
|
93
|
+
_defineProperty(this, "traverseCounter", 0);
|
|
94
|
+
_defineProperty(this, "geometricError", 0);
|
|
95
|
+
_defineProperty(this, "lastUpdatedVieports", null);
|
|
96
|
+
_defineProperty(this, "_requestedTiles", []);
|
|
97
|
+
_defineProperty(this, "_emptyTiles", []);
|
|
98
|
+
_defineProperty(this, "frameStateData", {});
|
|
91
99
|
_defineProperty(this, "_traverser", void 0);
|
|
92
|
-
_defineProperty(this, "_cache",
|
|
100
|
+
_defineProperty(this, "_cache", new TilesetCache());
|
|
93
101
|
_defineProperty(this, "_requestScheduler", void 0);
|
|
94
|
-
_defineProperty(this, "
|
|
95
|
-
_defineProperty(this, "
|
|
96
|
-
_defineProperty(this, "_queryParams", void 0);
|
|
97
|
-
_defineProperty(this, "_extensionsUsed", void 0);
|
|
98
|
-
_defineProperty(this, "_tiles", void 0);
|
|
99
|
-
_defineProperty(this, "_pendingCount", void 0);
|
|
100
|
-
_defineProperty(this, "lastUpdatedVieports", void 0);
|
|
101
|
-
_defineProperty(this, "_requestedTiles", void 0);
|
|
102
|
-
_defineProperty(this, "_emptyTiles", void 0);
|
|
103
|
-
_defineProperty(this, "frameStateData", void 0);
|
|
104
|
-
_defineProperty(this, "maximumMemoryUsage", void 0);
|
|
105
|
-
assert(json);
|
|
102
|
+
_defineProperty(this, "updatePromise", null);
|
|
103
|
+
_defineProperty(this, "tilesetInitializationPromise", void 0);
|
|
106
104
|
this.options = {
|
|
107
105
|
...DEFAULT_PROPS,
|
|
108
106
|
...options
|
|
109
107
|
};
|
|
110
|
-
this.tileset =
|
|
111
|
-
this.loader =
|
|
112
|
-
this.type =
|
|
113
|
-
this.url =
|
|
114
|
-
this.basePath =
|
|
108
|
+
this.tileset = tileset;
|
|
109
|
+
this.loader = tileset.loader;
|
|
110
|
+
this.type = tileset.type;
|
|
111
|
+
this.url = tileset.url;
|
|
112
|
+
this.basePath = tileset.basePath || path.dirname(this.url);
|
|
115
113
|
this.modelMatrix = this.options.modelMatrix;
|
|
116
114
|
this.ellipsoid = this.options.ellipsoid;
|
|
117
|
-
this.lodMetricType =
|
|
118
|
-
this.lodMetricValue =
|
|
119
|
-
this.refine =
|
|
115
|
+
this.lodMetricType = tileset.lodMetricType;
|
|
116
|
+
this.lodMetricValue = tileset.lodMetricValue;
|
|
117
|
+
this.refine = tileset.root.refine;
|
|
120
118
|
this.loadOptions = this.options.loadOptions || {};
|
|
121
|
-
this.root = null;
|
|
122
|
-
this.roots = {};
|
|
123
|
-
this.cartographicCenter = null;
|
|
124
|
-
this.cartesianCenter = null;
|
|
125
|
-
this.zoom = 1;
|
|
126
|
-
this.boundingVolume = null;
|
|
127
|
-
this.traverseCounter = 0;
|
|
128
|
-
this.geometricError = 0;
|
|
129
119
|
this._traverser = this._initializeTraverser();
|
|
130
|
-
this._cache = new TilesetCache();
|
|
131
120
|
this._requestScheduler = new RequestScheduler({
|
|
132
121
|
throttleRequests: this.options.throttleRequests,
|
|
133
122
|
maxRequests: this.options.maxRequests
|
|
134
123
|
});
|
|
135
|
-
this._frameNumber = 0;
|
|
136
|
-
this._pendingCount = 0;
|
|
137
|
-
this._tiles = {};
|
|
138
|
-
this.selectedTiles = [];
|
|
139
|
-
this._emptyTiles = [];
|
|
140
|
-
this._requestedTiles = [];
|
|
141
|
-
this.frameStateData = {};
|
|
142
|
-
this.lastUpdatedVieports = null;
|
|
143
|
-
this._queryParams = {};
|
|
144
|
-
this._queryParamsString = '';
|
|
145
|
-
this.maximumMemoryUsage = this.options.maximumMemoryUsage || 32;
|
|
146
|
-
this.gpuMemoryUsageInBytes = 0;
|
|
147
124
|
this.stats = new Stats({
|
|
148
125
|
id: this.url
|
|
149
126
|
});
|
|
150
127
|
this._initializeStats();
|
|
151
|
-
this.
|
|
152
|
-
this.dynamicScreenSpaceErrorComputedDensity = 0.0;
|
|
153
|
-
this.extras = null;
|
|
154
|
-
this.asset = {};
|
|
155
|
-
this.credits = {};
|
|
156
|
-
this.description = this.options.description || '';
|
|
157
|
-
this.tilesetInitializationPromise = this._initializeTileSet(json);
|
|
128
|
+
this.tilesetInitializationPromise = this._initializeTileSet(tileset);
|
|
158
129
|
}
|
|
159
130
|
destroy() {
|
|
160
131
|
this._destroy();
|
|
@@ -169,10 +140,8 @@ export class Tileset3D {
|
|
|
169
140
|
return this._frameNumber;
|
|
170
141
|
}
|
|
171
142
|
get queryParams() {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
return this._queryParamsString;
|
|
143
|
+
const search = new URLSearchParams(this._queryParams).toString();
|
|
144
|
+
return search ? "?".concat(search) : '';
|
|
176
145
|
}
|
|
177
146
|
setProps(props) {
|
|
178
147
|
this.options = {
|
|
@@ -191,10 +160,10 @@ export class Tileset3D {
|
|
|
191
160
|
if (isDataUrl) {
|
|
192
161
|
return tilePath;
|
|
193
162
|
}
|
|
194
|
-
return "".concat(tilePath).concat(this.queryParams);
|
|
163
|
+
return "".concat(tilePath).concat(tilePath.includes('?') ? '&' : '?').concat(this.queryParams);
|
|
195
164
|
}
|
|
196
165
|
hasExtension(extensionName) {
|
|
197
|
-
return Boolean(this._extensionsUsed
|
|
166
|
+
return Boolean(this._extensionsUsed.indexOf(extensionName) > -1);
|
|
198
167
|
}
|
|
199
168
|
update() {
|
|
200
169
|
let viewports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
@@ -395,7 +364,6 @@ export class Tileset3D {
|
|
|
395
364
|
}
|
|
396
365
|
calculateViewPropsTiles3D() {
|
|
397
366
|
const root = this.root;
|
|
398
|
-
assert(root);
|
|
399
367
|
const {
|
|
400
368
|
center
|
|
401
369
|
} = root.boundingVolume;
|
|
@@ -439,7 +407,15 @@ export class Tileset3D {
|
|
|
439
407
|
this.stats.get(TILES_TOTAL).incrementCount();
|
|
440
408
|
const children = tile.header.children || [];
|
|
441
409
|
for (const childHeader of children) {
|
|
410
|
+
var _childTile$contentUrl;
|
|
442
411
|
const childTile = new Tile3D(this, childHeader, tile);
|
|
412
|
+
if ((_childTile$contentUrl = childTile.contentUrl) !== null && _childTile$contentUrl !== void 0 && _childTile$contentUrl.includes('?session=')) {
|
|
413
|
+
const url = new URL(childTile.contentUrl);
|
|
414
|
+
const session = url.searchParams.get('session');
|
|
415
|
+
if (session) {
|
|
416
|
+
this._queryParams.session = session;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
443
419
|
tile.children.push(childTile);
|
|
444
420
|
childTile.depth = tile.depth + 1;
|
|
445
421
|
stack.push(childTile);
|
|
@@ -475,7 +451,7 @@ export class Tileset3D {
|
|
|
475
451
|
this._onStartTileLoading();
|
|
476
452
|
loaded = await tile.loadContent();
|
|
477
453
|
} catch (error) {
|
|
478
|
-
this._onTileLoadError(tile, error);
|
|
454
|
+
this._onTileLoadError(tile, error instanceof Error ? error : new Error('load failed'));
|
|
479
455
|
} finally {
|
|
480
456
|
this._onEndTileLoading();
|
|
481
457
|
this._onTileLoad(tile, loaded);
|
|
@@ -549,11 +525,11 @@ export class Tileset3D {
|
|
|
549
525
|
_updateCacheStats(tile) {
|
|
550
526
|
this.stats.get(TILES_LOADED).incrementCount();
|
|
551
527
|
this.stats.get(TILES_IN_MEMORY).incrementCount();
|
|
552
|
-
this.gpuMemoryUsageInBytes += tile.
|
|
528
|
+
this.gpuMemoryUsageInBytes += tile.gpuMemoryUsageInBytes || 0;
|
|
553
529
|
this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
|
|
554
530
|
}
|
|
555
531
|
_unloadTile(tile) {
|
|
556
|
-
this.gpuMemoryUsageInBytes -= tile.
|
|
532
|
+
this.gpuMemoryUsageInBytes -= tile.gpuMemoryUsageInBytes || 0;
|
|
557
533
|
this.stats.get(TILES_IN_MEMORY).decrementCount();
|
|
558
534
|
this.stats.get(TILES_UNLOADED).incrementCount();
|
|
559
535
|
this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
|
|
@@ -595,6 +571,14 @@ export class Tileset3D {
|
|
|
595
571
|
tile.destroy();
|
|
596
572
|
}
|
|
597
573
|
_initializeTiles3DTileset(tilesetJson) {
|
|
574
|
+
if (tilesetJson.queryString) {
|
|
575
|
+
const searchParams = new URLSearchParams(tilesetJson.queryString);
|
|
576
|
+
const queryParams = Object.fromEntries(searchParams.entries());
|
|
577
|
+
this._queryParams = {
|
|
578
|
+
...this._queryParams,
|
|
579
|
+
...queryParams
|
|
580
|
+
};
|
|
581
|
+
}
|
|
598
582
|
this.asset = tilesetJson.asset;
|
|
599
583
|
if (!this.asset) {
|
|
600
584
|
throw new Error('Tileset must have an asset property.');
|
|
@@ -611,7 +595,7 @@ export class Tileset3D {
|
|
|
611
595
|
this.description = this.options.description || '';
|
|
612
596
|
this.properties = tilesetJson.properties;
|
|
613
597
|
this.geometricError = tilesetJson.geometricError;
|
|
614
|
-
this._extensionsUsed = tilesetJson.extensionsUsed;
|
|
598
|
+
this._extensionsUsed = tilesetJson.extensionsUsed || [];
|
|
615
599
|
this.extras = tilesetJson.extras;
|
|
616
600
|
}
|
|
617
601
|
_initializeI3STileset() {
|
|
@@ -620,18 +604,4 @@ export class Tileset3D {
|
|
|
620
604
|
}
|
|
621
605
|
}
|
|
622
606
|
}
|
|
623
|
-
function getQueryParamString(queryParams) {
|
|
624
|
-
const queryParamStrings = [];
|
|
625
|
-
for (const key of Object.keys(queryParams)) {
|
|
626
|
-
queryParamStrings.push("".concat(key, "=").concat(queryParams[key]));
|
|
627
|
-
}
|
|
628
|
-
switch (queryParamStrings.length) {
|
|
629
|
-
case 0:
|
|
630
|
-
return '';
|
|
631
|
-
case 1:
|
|
632
|
-
return "?".concat(queryParamStrings[0]);
|
|
633
|
-
default:
|
|
634
|
-
return "?".concat(queryParamStrings.join('&'));
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
607
|
//# sourceMappingURL=tileset-3d.js.map
|