@loaders.gl/tiles 3.1.0-alpha.1 → 3.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +1 -0
- package/dist/constants.d.ts +31 -0
- package/dist/dist.min.js +1 -1
- package/dist/dist.min.js.map +1 -1
- package/dist/es5/bundle.js +7 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/constants.js +44 -0
- package/dist/es5/constants.js.map +1 -0
- package/dist/es5/index.js +104 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/tileset/helpers/3d-tiles-options.js +13 -0
- package/dist/es5/tileset/helpers/3d-tiles-options.js.map +1 -0
- package/dist/es5/tileset/helpers/bounding-volume.js +102 -0
- package/dist/es5/tileset/helpers/bounding-volume.js.map +1 -0
- package/dist/es5/tileset/helpers/frame-state.js +69 -0
- package/dist/es5/tileset/helpers/frame-state.js.map +1 -0
- package/dist/es5/tileset/helpers/i3s-lod.js +84 -0
- package/dist/es5/tileset/helpers/i3s-lod.js.map +1 -0
- package/dist/es5/tileset/helpers/tiles-3d-lod.js +123 -0
- package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +1 -0
- package/dist/es5/tileset/helpers/transform-utils.js +71 -0
- package/dist/es5/tileset/helpers/transform-utils.js.map +1 -0
- package/dist/es5/tileset/helpers/zoom.js +45 -0
- package/dist/es5/tileset/helpers/zoom.js.map +1 -0
- package/dist/es5/tileset/tile-3d.js +510 -0
- package/dist/es5/tileset/tile-3d.js.map +1 -0
- package/dist/es5/tileset/tileset-3d.js +656 -0
- package/dist/es5/tileset/tileset-3d.js.map +1 -0
- package/dist/es5/tileset/tileset-cache.js +88 -0
- package/dist/es5/tileset/tileset-cache.js.map +1 -0
- package/dist/es5/tileset/traversers/i3s-tile-manager.js +57 -0
- package/dist/es5/tileset/traversers/i3s-tile-manager.js.map +1 -0
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js +95 -0
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js.map +1 -0
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js +66 -0
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js.map +1 -0
- package/dist/es5/tileset/traversers/tileset-traverser.js +304 -0
- package/dist/es5/tileset/traversers/tileset-traverser.js.map +1 -0
- package/dist/es5/utils/doubly-linked-list-node.js +18 -0
- package/dist/es5/utils/doubly-linked-list-node.js.map +1 -0
- package/dist/es5/utils/doubly-linked-list.js +90 -0
- package/dist/es5/utils/doubly-linked-list.js.map +1 -0
- package/dist/es5/utils/managed-array.js +121 -0
- package/dist/es5/utils/managed-array.js.map +1 -0
- package/dist/esm/bundle.js +5 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/{constants.js → esm/constants.js} +0 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/{index.js → esm/index.js} +1 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/{tileset → esm/tileset}/helpers/3d-tiles-options.js +0 -0
- package/dist/esm/tileset/helpers/3d-tiles-options.js.map +1 -0
- package/dist/{tileset → esm/tileset}/helpers/bounding-volume.js +0 -0
- package/dist/esm/tileset/helpers/bounding-volume.js.map +1 -0
- package/dist/{tileset → esm/tileset}/helpers/frame-state.js +0 -0
- package/dist/esm/tileset/helpers/frame-state.js.map +1 -0
- package/dist/esm/tileset/helpers/i3s-lod.js +67 -0
- package/dist/esm/tileset/helpers/i3s-lod.js.map +1 -0
- package/dist/{tileset → esm/tileset}/helpers/tiles-3d-lod.js +0 -0
- package/dist/esm/tileset/helpers/tiles-3d-lod.js.map +1 -0
- package/dist/{tileset → esm/tileset}/helpers/transform-utils.js +4 -1
- package/dist/esm/tileset/helpers/transform-utils.js.map +1 -0
- package/dist/{tileset → esm/tileset}/helpers/zoom.js +0 -0
- package/dist/esm/tileset/helpers/zoom.js.map +1 -0
- package/dist/{tileset → esm/tileset}/tile-3d.js +3 -3
- package/dist/esm/tileset/tile-3d.js.map +1 -0
- package/dist/{tileset → esm/tileset}/tileset-3d.js +5 -5
- package/dist/esm/tileset/tileset-3d.js.map +1 -0
- package/dist/{tileset → esm/tileset}/tileset-cache.js +0 -0
- package/dist/esm/tileset/tileset-cache.js.map +1 -0
- package/dist/{tileset → esm/tileset}/traversers/i3s-tile-manager.js +0 -0
- package/dist/esm/tileset/traversers/i3s-tile-manager.js.map +1 -0
- package/dist/{tileset → esm/tileset}/traversers/i3s-tileset-traverser.js +4 -4
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js.map +1 -0
- package/dist/{tileset → esm/tileset}/traversers/tileset-3d-traverser.js +0 -0
- package/dist/esm/tileset/traversers/tileset-3d-traverser.js.map +1 -0
- package/dist/{tileset → esm/tileset}/traversers/tileset-traverser.js +0 -0
- package/dist/esm/tileset/traversers/tileset-traverser.js.map +1 -0
- package/dist/{utils → esm/utils}/doubly-linked-list-node.js +0 -0
- package/dist/esm/utils/doubly-linked-list-node.js.map +1 -0
- package/dist/{utils → esm/utils}/doubly-linked-list.js +0 -0
- package/dist/esm/utils/doubly-linked-list.js.map +1 -0
- package/dist/{utils → esm/utils}/managed-array.js +0 -0
- package/dist/esm/utils/managed-array.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/tileset/helpers/3d-tiles-options.d.ts +3 -0
- package/dist/tileset/helpers/bounding-volume.d.ts +8 -0
- package/dist/tileset/helpers/frame-state.d.ts +16 -0
- package/dist/tileset/helpers/i3s-lod.d.ts +19 -0
- package/dist/tileset/helpers/tiles-3d-lod.d.ts +7 -0
- package/dist/tileset/helpers/transform-utils.d.ts +1 -0
- package/dist/tileset/helpers/zoom.d.ts +6 -0
- package/dist/tileset/tile-3d.d.ts +173 -0
- package/dist/tileset/tileset-3d.d.ts +171 -0
- package/dist/tileset/tileset-cache.d.ts +17 -0
- package/dist/tileset/traversers/i3s-tile-manager.d.ts +7 -0
- package/dist/tileset/traversers/i3s-tileset-traverser.d.ts +17 -0
- package/dist/tileset/traversers/tileset-3d-traverser.d.ts +6 -0
- package/dist/tileset/traversers/tileset-traverser.d.ts +51 -0
- package/dist/utils/doubly-linked-list-node.d.ts +11 -0
- package/dist/utils/doubly-linked-list.d.ts +30 -0
- package/dist/utils/managed-array.d.ts +84 -0
- package/package.json +11 -8
- package/src/bundle.ts +2 -3
- package/src/index.ts +1 -0
- package/src/tileset/helpers/i3s-lod.ts +72 -96
- package/src/tileset/helpers/transform-utils.ts +3 -1
- package/src/tileset/tile-3d.ts +2 -2
- package/src/tileset/traversers/i3s-tileset-traverser.ts +2 -3
- package/dist/bundle.js +0 -7
- package/dist/bundle.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/tileset/helpers/3d-tiles-options.js.map +0 -1
- package/dist/tileset/helpers/bounding-volume.js.map +0 -1
- package/dist/tileset/helpers/frame-state.js.map +0 -1
- package/dist/tileset/helpers/i3s-lod.js +0 -108
- package/dist/tileset/helpers/i3s-lod.js.map +0 -1
- package/dist/tileset/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/tileset/helpers/transform-utils.js.map +0 -1
- package/dist/tileset/helpers/zoom.js.map +0 -1
- package/dist/tileset/tile-3d.js.map +0 -1
- package/dist/tileset/tileset-3d.js.map +0 -1
- package/dist/tileset/tileset-cache.js.map +0 -1
- package/dist/tileset/traversers/i3s-tile-manager.js.map +0 -1
- package/dist/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
- package/dist/tileset/traversers/tileset-3d-traverser.js.map +0 -1
- package/dist/tileset/traversers/tileset-traverser.js.map +0 -1
- package/dist/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/utils/doubly-linked-list.js.map +0 -1
- package/dist/utils/managed-array.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/tileset/traversers/tileset-3d-traverser.ts"],"names":["TILE3D_OPTIMIZATION_HINT","TILE_REFINEMENT","TilesetTraverser","Tileset3DTraverser","compareDistanceToCamera","a","b","_distanceToCamera","_centerZDepth","updateTileVisibility","tile","frameState","isVisibleAndInRequestVolume","hasChildren","children","length","hasTilesetContent","firstChild","_visible","meetsScreenSpaceErrorEarly","replace","refine","REPLACE","useOptimization","_optimChildrenWithinParent","USE_OPTIMIZATION","anyChildrenVisible","parent","ADD","shouldRefine"],"mappings":"AAGA,SAAQA,wBAAR,EAAkCC,eAAlC,QAAwD,iBAAxD;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AAEA,eAAe,MAAMC,kBAAN,SAAiCD,gBAAjC,CAAkD;AAC/DE,EAAAA,uBAAuB,CAACC,CAAD,EAAIC,CAAJ,EAAO;AAE5B,WAAOA,CAAC,CAACC,iBAAF,KAAwB,CAAxB,IAA6BF,CAAC,CAACE,iBAAF,KAAwB,CAArD,GACHD,CAAC,CAACE,aAAF,GAAkBH,CAAC,CAACG,aADjB,GAEHF,CAAC,CAACC,iBAAF,GAAsBF,CAAC,CAACE,iBAF5B;AAGD;;AAEDE,EAAAA,oBAAoB,CAACC,IAAD,EAAOC,UAAP,EAAmB;AACrC,UAAMF,oBAAN,CAA2BC,IAA3B,EAAiCC,UAAjC;;AAGA,QAAI,CAACD,IAAI,CAACE,2BAAV,EAAuC;AACrC;AACD;;AAED,UAAMC,WAAW,GAAGH,IAAI,CAACI,QAAL,CAAcC,MAAd,GAAuB,CAA3C;;AACA,QAAIL,IAAI,CAACM,iBAAL,IAA0BH,WAA9B,EAA2C;AAIzC,YAAMI,UAAU,GAAGP,IAAI,CAACI,QAAL,CAAc,CAAd,CAAnB;AACA,WAAKL,oBAAL,CAA0BQ,UAA1B,EAAsCN,UAAtC;AACAD,MAAAA,IAAI,CAACQ,QAAL,GAAgBD,UAAU,CAACC,QAA3B;AACA;AACD;;AAED,QAAI,KAAKC,0BAAL,CAAgCT,IAAhC,EAAsCC,UAAtC,CAAJ,EAAuD;AACrDD,MAAAA,IAAI,CAACQ,QAAL,GAAgB,KAAhB;AACA;AACD;;AAED,UAAME,OAAO,GAAGV,IAAI,CAACW,MAAL,KAAgBpB,eAAe,CAACqB,OAAhD;AACA,UAAMC,eAAe,GACnBb,IAAI,CAACc,0BAAL,KAAoCxB,wBAAwB,CAACyB,gBAD/D;;AAEA,QAAIL,OAAO,IAAIG,eAAX,IAA8BV,WAAlC,EAA+C;AAC7C,UAAI,CAAC,KAAKa,kBAAL,CAAwBhB,IAAxB,EAA8BC,UAA9B,CAAL,EAAgD;AAC9CD,QAAAA,IAAI,CAACQ,QAAL,GAAgB,KAAhB;AACA;AACD;AACF;AACF;;AAEDC,EAAAA,0BAA0B,CAACT,IAAD,EAAOC,UAAP,EAAmB;AAC3C,UAAM;AAACgB,MAAAA;AAAD,QAAWjB,IAAjB;;AACA,QAAI,CAACiB,MAAD,IAAWA,MAAM,CAACX,iBAAlB,IAAuCW,MAAM,CAACN,MAAP,KAAkBpB,eAAe,CAAC2B,GAA7E,EAAkF;AAChF,aAAO,KAAP;AACD;;AAGD,WAAO,CAAC,KAAKC,YAAL,CAAkBnB,IAAlB,EAAwBC,UAAxB,EAAoC,IAApC,CAAR;AACD;;AAnD8D","sourcesContent":["// 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 {TILE3D_OPTIMIZATION_HINT, TILE_REFINEMENT} from '../../constants';\nimport TilesetTraverser from './tileset-traverser';\n\nexport default class Tileset3DTraverser extends TilesetTraverser {\n compareDistanceToCamera(a, b) {\n // Sort by farthest child first since this is going on a stack\n return b._distanceToCamera === 0 && a._distanceToCamera === 0\n ? b._centerZDepth - a._centerZDepth\n : b._distanceToCamera - a._distanceToCamera;\n }\n\n updateTileVisibility(tile, frameState) {\n super.updateTileVisibility(tile, frameState);\n\n // Optimization - if none of the tile's children are visible then this tile isn't visible\n if (!tile.isVisibleAndInRequestVolume) {\n return;\n }\n\n const hasChildren = tile.children.length > 0;\n if (tile.hasTilesetContent && hasChildren) {\n // Use the root tile's visibility instead of this tile's visibility.\n // The root tile may be culled by the children bounds optimization in which\n // case this tile should also be culled.\n const firstChild = tile.children[0];\n this.updateTileVisibility(firstChild, frameState);\n tile._visible = firstChild._visible;\n return;\n }\n\n if (this.meetsScreenSpaceErrorEarly(tile, frameState)) {\n tile._visible = false;\n return;\n }\n\n const replace = tile.refine === TILE_REFINEMENT.REPLACE;\n const useOptimization =\n tile._optimChildrenWithinParent === TILE3D_OPTIMIZATION_HINT.USE_OPTIMIZATION;\n if (replace && useOptimization && hasChildren) {\n if (!this.anyChildrenVisible(tile, frameState)) {\n tile._visible = false;\n return;\n }\n }\n }\n\n meetsScreenSpaceErrorEarly(tile, frameState) {\n const {parent} = tile;\n if (!parent || parent.hasTilesetContent || parent.refine !== TILE_REFINEMENT.ADD) {\n return false;\n }\n\n // Use parent's geometric error with child's box to see if the tile already meet the SSE\n return !this.shouldRefine(tile, frameState, true);\n }\n}\n"],"file":"tileset-3d-traverser.js"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/tileset/traversers/tileset-traverser.ts"],"names":["ManagedArray","TILE_REFINEMENT","DEFAULT_PROPS","loadSiblings","skipLevelOfDetail","maximumScreenSpaceError","updateTransforms","onTraversalEnd","viewportTraversersMap","basePath","TilesetTraverser","constructor","options","_traversalStack","_emptyTraversalStack","_frameNumber","root","selectedTiles","requestedTiles","emptyTiles","traverse","frameState","reset","updateTile","frameNumber","executeTraversal","stack","_selectionDepth","push","length","tile","pop","shouldRefine","canTraverse","updateChildTiles","updateAndPushChildren","hasRenderContent","parent","parentRefines","Boolean","_shouldRefine","stoppedRefining","id","loadTile","selectTile","refine","ADD","REPLACE","touchTile","children","child","depth","sort","compareDistanceToCamera","bind","checkRefines","hasVisibleChild","refines","isVisibleAndInRequestVolume","find","delete","childRefines","_inRequestVolume","executeEmptyTraversal","contentAvailable","updateTileVisibility","shouldSelectTile","_selectedFrame","shouldLoadTile","_requestedFrame","_priority","_getPriority","tileset","_cache","touch","_touchedFrame","useParentMetric","ignoreVisibility","hasChildren","hasTilesetContent","contentExpired","hasUnloadedContent","screenSpaceError","_screenSpaceError","getScreenSpaceError","viewportIds","key","value","viewport","updateVisibility","b","a","_distanceToCamera","anyChildrenVisible","anyVisible","allDescendantsLoaded"],"mappings":";AAAA,OAAOA,YAAP,MAAyB,2BAAzB;AACA,SAAQC,eAAR,QAA8B,iBAA9B;AAqBA,OAAO,MAAMC,aAAoB,GAAG;AAClCC,EAAAA,YAAY,EAAE,KADoB;AAElCC,EAAAA,iBAAiB,EAAE,KAFe;AAGlCC,EAAAA,uBAAuB,EAAE,CAHS;AAIlCC,EAAAA,gBAAgB,EAAE,IAJgB;AAKlCC,EAAAA,cAAc,EAAE,MAAM,CAAE,CALU;AAMlCC,EAAAA,qBAAqB,EAAE,EANW;AAOlCC,EAAAA,QAAQ,EAAE;AAPwB,CAA7B;AAUP,eAAe,MAAMC,gBAAN,CAAuB;AAapCC,EAAAA,WAAW,CAACC,OAAD,EAAiC;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAC1C,SAAKA,OAAL,GAAe,EAAC,GAAGV,aAAJ;AAAmB,SAAGU;AAAtB,KAAf;AAGA,SAAKC,eAAL,GAAuB,IAAIb,YAAJ,EAAvB;AACA,SAAKc,oBAAL,GAA4B,IAAId,YAAJ,EAA5B;AAGA,SAAKe,YAAL,GAAoB,IAApB;AAGA,SAAKC,IAAL,GAAY,IAAZ;AAIA,SAAKC,aAAL,GAAqB,EAArB;AAEA,SAAKC,cAAL,GAAsB,EAAtB;AAEA,SAAKC,UAAL,GAAkB,EAAlB;AACD;;AAGDC,EAAAA,QAAQ,CAACJ,IAAD,EAAOK,UAAP,EAAmBT,OAAnB,EAA4B;AAClC,SAAKI,IAAL,GAAYA,IAAZ;AACA,SAAKJ,OAAL,GAAe,EAAC,GAAG,KAAKA,OAAT;AAAkB,SAAGA;AAArB,KAAf;AAGA,SAAKU,KAAL;AAGA,SAAKC,UAAL,CAAgBP,IAAhB,EAA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KAAK,CAACiC,IAAN,CAAWT,KAAX,CAAJ,EAAuB;AACrBxB,YAAAA,KAAK,CAACkC,MAAN,CAAaV,KAAb;AACD;;AACDxB,UAAAA,KAAK,CAACE,IAAN,CAAWsB,KAAX;AACD;AACF,OATD,MASO,IAAI,CAACpB,IAAI,CAACkC,gBAAV,EAA4B;AACjC+B,QAAAA,oBAAoB,GAAG,KAAvB;AACD;AACF;;AAED,WAAOA,oBAAP;AACD;;AA7UmC","sourcesContent":["import ManagedArray from '../../utils/managed-array';\nimport {TILE_REFINEMENT} from '../../constants';\n\nexport type TilesetTraverserProps = {\n loadSiblings?: boolean;\n skipLevelOfDetail?: boolean;\n maximumScreenSpaceError?: number;\n onTraversalEnd?: (frameState) => any;\n viewportTraversersMap?: {[key: string]: any};\n basePath?: string;\n};\n\nexport type Props = {\n loadSiblings: boolean;\n skipLevelOfDetail: boolean;\n updateTransforms: boolean;\n maximumScreenSpaceError: number;\n onTraversalEnd: (frameState) => any;\n viewportTraversersMap: {[key: string]: any};\n basePath: string;\n};\n\nexport const DEFAULT_PROPS: Props = {\n loadSiblings: false,\n skipLevelOfDetail: false,\n maximumScreenSpaceError: 2,\n updateTransforms: true,\n onTraversalEnd: () => {},\n viewportTraversersMap: {},\n basePath: ''\n};\n\nexport default class TilesetTraverser {\n options: Props;\n\n root: any;\n requestedTiles: object;\n selectedTiles: object;\n emptyTiles: object;\n\n protected _traversalStack: ManagedArray;\n protected _emptyTraversalStack: ManagedArray;\n protected _frameNumber: number | null;\n\n // TODO nested props\n constructor(options: TilesetTraverserProps) {\n this.options = {...DEFAULT_PROPS, ...options};\n // TRAVERSAL\n // temporary storage to hold the traversed tiles during a traversal\n this._traversalStack = new ManagedArray();\n this._emptyTraversalStack = new ManagedArray();\n\n // set in every traverse cycle\n this._frameNumber = null;\n\n // fulfill in traverse call\n this.root = null;\n\n // RESULT\n // tiles should be rendered\n this.selectedTiles = {};\n // tiles should be loaded from server\n this.requestedTiles = {};\n // tiles does not have render content\n this.emptyTiles = {};\n }\n\n // tiles should be visible\n traverse(root, frameState, options) {\n this.root = root; // for root screen space error\n this.options = {...this.options, ...options};\n\n // reset result\n this.reset();\n\n // update tile (visibility and expiration)\n this.updateTile(root, frameState);\n\n this._frameNumber = frameState.frameNumber;\n this.executeTraversal(root, frameState);\n }\n\n reset() {\n this.requestedTiles = {};\n this.selectedTiles = {};\n this.emptyTiles = {};\n this._traversalStack.reset();\n this._emptyTraversalStack.reset();\n }\n\n // execute traverse\n // Depth-first traversal that traverses all visible tiles and marks tiles for selection.\n // If skipLevelOfDetail is off then a tile does not refine until all children are loaded.\n // This is the traditional replacement refinement approach and is called the base traversal.\n // Tiles that have a greater screen space error than the base screen space error are part of the base traversal,\n // all other tiles are part of the skip traversal. The skip traversal allows for skipping levels of the tree\n // and rendering children and parent tiles simultaneously.\n /* eslint-disable-next-line complexity, max-statements */\n executeTraversal(root, frameState) {\n // stack to store traversed tiles, only visible tiles should be added to stack\n // visible: visible in the current view frustum\n const stack = this._traversalStack;\n root._selectionDepth = 1;\n\n stack.push(root);\n while (stack.length > 0) {\n // 1. pop tile\n const tile = stack.pop();\n\n // 2. check if tile needs to be refine, needs refine if a tile's LoD is not sufficient and tile has available children (available content)\n let shouldRefine = false;\n if (this.canTraverse(tile, frameState)) {\n this.updateChildTiles(tile, frameState);\n shouldRefine = this.updateAndPushChildren(\n tile,\n frameState,\n stack,\n tile.hasRenderContent ? tile._selectionDepth + 1 : tile._selectionDepth\n );\n }\n\n // 3. decide if should render (select) this tile\n // - tile does not have render content\n // - tile has render content and tile is `add` type (pointcloud)\n // - tile has render content and tile is `replace` type (photogrammetry) and can't refine any further\n const parent = tile.parent;\n const parentRefines = Boolean(!parent || parent._shouldRefine);\n const stoppedRefining = !shouldRefine;\n\n if (!tile.hasRenderContent) {\n this.emptyTiles[tile.id] = tile;\n this.loadTile(tile, frameState);\n if (stoppedRefining) {\n this.selectTile(tile, frameState);\n }\n // additive tiles\n } else if (tile.refine === TILE_REFINEMENT.ADD) {\n // Additive tiles are always loaded and selected\n this.loadTile(tile, frameState);\n this.selectTile(tile, frameState);\n\n // replace tiles\n } else if (tile.refine === TILE_REFINEMENT.REPLACE) {\n // Always load tiles in the base traversal\n // Select tiles that can't refine further\n this.loadTile(tile, frameState);\n if (stoppedRefining) {\n this.selectTile(tile, frameState);\n }\n }\n\n // 3. update cache, most recent touched tiles have higher priority to be fetched from server\n this.touchTile(tile, frameState);\n\n // 4. update tile refine prop and parent refinement status to trickle down to the descendants\n tile._shouldRefine = shouldRefine && parentRefines;\n }\n\n this.options.onTraversalEnd(frameState);\n }\n\n updateChildTiles(tile, frameState) {\n const children = tile.children;\n for (const child of children) {\n this.updateTile(child, frameState);\n }\n return true;\n }\n\n /* eslint-disable complexity, max-statements */\n updateAndPushChildren(tile, frameState, stack, depth) {\n const {loadSiblings, skipLevelOfDetail} = this.options;\n\n const children = tile.children;\n\n // sort children tiles\n children.sort(this.compareDistanceToCamera.bind(this));\n\n // For traditional replacement refinement only refine if all children are loaded.\n // Empty tiles are exempt since it looks better if children stream in as they are loaded to fill the empty space.\n const checkRefines =\n tile.refine === TILE_REFINEMENT.REPLACE && tile.hasRenderContent && !skipLevelOfDetail;\n\n let hasVisibleChild = false;\n let refines = true;\n\n for (const child of children) {\n child._selectionDepth = depth;\n if (child.isVisibleAndInRequestVolume) {\n if (stack.find(child)) {\n stack.delete(child);\n }\n stack.push(child);\n hasVisibleChild = true;\n } else if (checkRefines || loadSiblings) {\n // Keep non-visible children loaded since they are still needed before the parent can refine.\n // Or loadSiblings is true so always load tiles regardless of visibility.\n this.loadTile(child, frameState);\n this.touchTile(child, frameState);\n }\n\n if (checkRefines) {\n let childRefines;\n if (!child._inRequestVolume) {\n childRefines = false;\n } else if (!child.hasRenderContent) {\n childRefines = this.executeEmptyTraversal(child, frameState);\n } else {\n childRefines = child.contentAvailable;\n }\n refines = refines && childRefines;\n\n if (!refines) {\n return false;\n }\n }\n }\n\n if (!hasVisibleChild) {\n refines = false;\n }\n return refines;\n }\n /* eslint-enable complexity, max-statements */\n\n updateTile(tile, frameState) {\n this.updateTileVisibility(tile, frameState);\n }\n\n // tile to render in the browser\n selectTile(tile, frameState) {\n if (this.shouldSelectTile(tile)) {\n // The tile can be selected right away and does not require traverseAndSelect\n tile._selectedFrame = frameState.frameNumber;\n this.selectedTiles[tile.id] = tile;\n }\n }\n\n // tile to load from server\n loadTile(tile, frameState) {\n if (this.shouldLoadTile(tile)) {\n tile._requestedFrame = frameState.frameNumber;\n tile._priority = tile._getPriority();\n this.requestedTiles[tile.id] = tile;\n }\n }\n\n // cache tile\n touchTile(tile, frameState) {\n tile.tileset._cache.touch(tile);\n tile._touchedFrame = frameState.frameNumber;\n }\n\n // tile should be visible\n // tile should have children\n // tile LoD (level of detail) is not sufficient under current viewport\n canTraverse(tile, frameState, useParentMetric = false, ignoreVisibility = false) {\n if (!tile.hasChildren) {\n return false;\n }\n\n // cesium specific\n if (tile.hasTilesetContent) {\n // Traverse external this to visit its root tile\n // Don't traverse if the subtree is expired because it will be destroyed\n return !tile.contentExpired;\n }\n\n if (!ignoreVisibility && !tile.isVisibleAndInRequestVolume) {\n return false;\n }\n\n return this.shouldRefine(tile, frameState, useParentMetric);\n }\n\n shouldLoadTile(tile) {\n // if request tile is in current frame\n // and has unexpired render content\n return tile.hasUnloadedContent || tile.contentExpired;\n }\n\n shouldSelectTile(tile) {\n // if select tile is in current frame\n // and content available\n return tile.contentAvailable && !this.options.skipLevelOfDetail;\n }\n\n // Decide if tile LoD (level of detail) is not sufficient under current viewport\n shouldRefine(tile, frameState, useParentMetric) {\n let screenSpaceError = tile._screenSpaceError;\n if (useParentMetric) {\n screenSpaceError = tile.getScreenSpaceError(frameState, true);\n }\n\n return screenSpaceError > this.options.maximumScreenSpaceError;\n }\n\n updateTileVisibility(tile, frameState) {\n const viewportIds: string[] = [];\n if (this.options.viewportTraversersMap) {\n for (const key in this.options.viewportTraversersMap) {\n const value = this.options.viewportTraversersMap[key];\n if (value === frameState.viewport.id) {\n viewportIds.push(key);\n }\n }\n } else {\n viewportIds.push(frameState.viewport.id);\n }\n tile.updateVisibility(frameState, viewportIds);\n }\n\n // UTILITIES\n\n compareDistanceToCamera(b, a) {\n return b._distanceToCamera - a._distanceToCamera;\n }\n\n anyChildrenVisible(tile, frameState) {\n let anyVisible = false;\n for (const child of tile.children) {\n child.updateVisibility(frameState);\n anyVisible = anyVisible || child.isVisibleAndInRequestVolume;\n }\n return anyVisible;\n }\n\n // Depth-first traversal that checks if all nearest descendants with content are loaded.\n // Ignores visibility.\n executeEmptyTraversal(root, frameState) {\n let allDescendantsLoaded = true;\n const stack = this._emptyTraversalStack;\n\n stack.push(root);\n\n while (stack.length > 0 && allDescendantsLoaded) {\n const tile = stack.pop();\n\n this.updateTile(tile, frameState);\n\n if (!tile.isVisibleAndInRequestVolume) {\n // Load tiles that aren't visible since they are still needed for the parent to refine\n this.loadTile(tile, frameState);\n }\n\n this.touchTile(tile, frameState);\n\n // Only traverse if the tile is empty - traversal stop at descendants with content\n const traverse = !tile.hasRenderContent && this.canTraverse(tile, frameState, false, true);\n\n if (traverse) {\n const children = tile.children;\n for (const child of children) {\n // eslint-disable-next-line max-depth\n if (stack.find(child)) {\n stack.delete(child);\n }\n stack.push(child);\n }\n } else if (!tile.contentAvailable) {\n allDescendantsLoaded = false;\n }\n }\n\n return allDescendantsLoaded;\n }\n}\n\n// TODO\n// enable expiration\n// enable optimization hint\n"],"file":"tileset-traverser.js"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/doubly-linked-list-node.js"],"names":["DoublyLinkedListNode","constructor","item","previous","next"],"mappings":"AAQA,eAAe,MAAMA,oBAAN,CAA2B;AACxCC,EAAAA,WAAW,CAACC,IAAD,EAAOC,QAAP,EAAiBC,IAAjB,EAAuB;AAChC,SAAKF,IAAL,GAAYA,IAAZ;AACA,SAAKC,QAAL,GAAgBA,QAAhB;AACA,SAAKC,IAAL,GAAYA,IAAZ;AACD;;AALuC","sourcesContent":["// 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\n/**\n * Doubly linked list node\n *\n * @private\n */\nexport default class DoublyLinkedListNode {\n constructor(item, previous, next) {\n this.item = item;\n this.previous = previous;\n this.next = next;\n }\n}\n"],"file":"doubly-linked-list-node.js"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/doubly-linked-list.js"],"names":["DoublyLinkedListNode","DoublyLinkedList","constructor","head","tail","_length","length","add","item","node","next","remove","previous","splice","nextNode","_insert","oldNodeNext"],"mappings":"AAGA,OAAOA,oBAAP,MAAiC,kCAAjC;AAOA,eAAe,MAAMC,gBAAN,CAAuB;AACpCC,EAAAA,WAAW,GAAG;AACZ,SAAKC,IAAL,GAAY,IAAZ;AACA,SAAKC,IAAL,GAAY,IAAZ;AACA,SAAKC,OAAL,GAAe,CAAf;AACD;;AAES,MAANC,MAAM,GAAG;AACX,WAAO,KAAKD,OAAZ;AACD;;AAODE,EAAAA,GAAG,CAACC,IAAD,EAAO;AACR,UAAMC,IAAI,GAAG,IAAIT,oBAAJ,CAAyBQ,IAAzB,EAA+B,KAAKJ,IAApC,EAA0C,IAA1C,CAAb;;AAEA,QAAI,KAAKA,IAAT,EAAe;AACb,WAAKA,IAAL,CAAUM,IAAV,GAAiBD,IAAjB;AACA,WAAKL,IAAL,GAAYK,IAAZ;AACD,KAHD,MAGO;AACL,WAAKN,IAAL,GAAYM,IAAZ;AACA,WAAKL,IAAL,GAAYK,IAAZ;AACD;;AAED,MAAE,KAAKJ,OAAP;AAEA,WAAOI,IAAP;AACD;;AAMDE,EAAAA,MAAM,CAACF,IAAD,EAAO;AACX,QAAI,CAACA,IAAL,EAAW;AACT;AACD;;AAED,QAAIA,IAAI,CAACG,QAAL,IAAiBH,IAAI,CAACC,IAA1B,EAAgC;AAC9BD,MAAAA,IAAI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EA,MAAE,KAAKJ,OAAP;AACD;;AA9FmC","sourcesContent":["// 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 DoublyLinkedListNode from '../utils/doubly-linked-list-node';\n\n/**\n * Doubly linked list\n *\n * @private\n */\nexport default class DoublyLinkedList {\n constructor() {\n this.head = null;\n this.tail = null;\n this._length = 0;\n }\n\n get length() {\n return this._length;\n }\n\n /**\n * Adds the item to the end of the list\n * @param {*} [item]\n * @return {DoublyLinkedListNode}\n */\n add(item) {\n const node = new DoublyLinkedListNode(item, this.tail, null);\n\n if (this.tail) {\n this.tail.next = node;\n this.tail = node;\n } else {\n this.head = node;\n this.tail = node;\n }\n\n ++this._length;\n\n return node;\n }\n\n /**\n * Removes the given node from the list\n * @param {DoublyLinkedListNode} node\n */\n remove(node) {\n if (!node) {\n return;\n }\n\n if (node.previous && node.next) {\n node.previous.next = node.next;\n node.next.previous = node.previous;\n } else if (node.previous) {\n // Remove last node\n node.previous.next = null;\n this.tail = node.previous;\n } else if (node.next) {\n // Remove first node\n node.next.previous = null;\n this.head = node.next;\n } else {\n // Remove last node in the linked list\n this.head = null;\n this.tail = null;\n }\n\n node.next = null;\n node.previous = null;\n\n --this._length;\n }\n\n /**\n * Moves nextNode after node\n * @param {DoublyLinkedListNode} node\n * @param {DoublyLinkedListNode} nextNode\n */\n splice(node, nextNode) {\n if (node === nextNode) {\n return;\n }\n\n // Remove nextNode, then insert after node\n this.remove(nextNode);\n this._insert(node, nextNode);\n }\n\n _insert(node, nextNode) {\n const oldNodeNext = node.next;\n node.next = nextNode;\n\n // nextNode is the new tail\n if (this.tail === node) {\n this.tail = nextNode;\n } else {\n oldNodeNext.previous = nextNode;\n }\n\n nextNode.next = oldNodeNext;\n nextNode.previous = node;\n\n ++this._length;\n }\n}\n"],"file":"doubly-linked-list.js"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/managed-array.js"],"names":["assert","ManagedArray","constructor","length","_array","Array","_map","Map","_length","values","get","index","set","element","has","delete","splice","peek","push","pop","reserve","resize","trim","undefined","reset","find","target"],"mappings":"AAGA,SAAQA,MAAR,QAAqB,0BAArB;AAWA,eAAe,MAAMC,YAAN,CAAmB;AAChCC,EAAAA,WAAW,CAACC,MAAM,GAAG,CAAV,EAAa;AACtB,SAAKC,MAAL,GAAc,IAAIC,KAAJ,CAAUF,MAAV,CAAd;AACA,SAAKG,IAAL,GAAY,IAAIC,GAAJ,EAAZ;AACA,SAAKC,OAAL,GAAeL,MAAf;AACD;;AASS,MAANA,MAAM,GAAG;AACX,WAAO,KAAKK,OAAZ;AACD;;AAES,MAANL,MAAM,CAACA,MAAD,EAAS;AACjB,SAAKK,OAAL,GAAeL,MAAf;;AACA,QAAIA,MAAM,GAAG,KAAKC,MAAL,CAAYD,MAAzB,EAAiC;AAC/B,WAAKC,MAAL,CAAYD,MAAZ,GAAqBA,MAArB;AACD;AACF;;AASS,MAANM,MAAM,GAAG;AACX,WAAO,KAAKL,MAAZ;AACD;;AAODM,EAAAA,GAAG,CAACC,KAAD,EAAQ;AACTX,IAAAA,MAAM,CAACW,KAAK,GAAG,KAAKP,MAAL,CAAYD,MAArB,CAAN;AACA,WAAO,KAAKC,MAAL,CAAYO,KAAZ,CAAP;AACD;;AAQDC,EAAAA,GAAG,CAACD,KAAD,EAAQE,OAAR,EAAiB;AAClBb,IAAAA,MAAM,CAACW,KAAK,IAAI,CAAV,CAAN;;AAEA,QAAIA,KAAK,IAAI,KAAKR,MAAlB,EAA0B;AACxB,WAAKA,MAAL,GAAcQ,KAAK,GAAG,CAAtB;AACD;;AAED,QAAI,KAAKL,IAAL,CAAUQ,GAAV,CAAc,KAAKV,MAAL,CAAYO,KAAZ,CAAd,CAAJ,EAAuC;AACrC,WAAKL,IAAL,CAAUS,MAAV,CAAiB,KAAKX,MAAL,CAAYO,KAAZ,CAAjB;AACD;;AAED,SAAKP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EA,SAAKA,MAAL,GAAcA,MAAd;AACD;;AAODmB,EAAAA,IAAI,CAACnB,MAAD,EAAS;AACX,QAAIA,MAAM,KAAK,IAAX,IAAmBA,MAAM,KAAKoB,SAAlC,EAA6C;AAC3CpB,MAAAA,MAAM,GAAG,KAAKA,MAAd;AACD;;AACD,SAAKC,MAAL,CAAYD,MAAZ,GAAqBA,MAArB;AACD;;AAEDqB,EAAAA,KAAK,GAAG;AACN,SAAKpB,MAAL,GAAc,EAAd;AACA,SAAKE,IAAL,GAAY,IAAIC,GAAJ,EAAZ;AACA,SAAKC,OAAL,GAAe,CAAf;AACD;;AAEDiB,EAAAA,IAAI,CAACC,MAAD,EAAS;AACX,WAAO,KAAKpB,IAAL,CAAUQ,GAAV,CAAcY,MAAd,CAAP;AACD;;AAzJ+B","sourcesContent":["// 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 {assert} from '@loaders.gl/loader-utils';\n\n/**\n * A wrapper around arrays so that the internal length of the array can be manually managed.\n *\n * @alias ManagedArray\n * @constructor\n * @private\n *\n * @param {Number} [length=0] The initial length of the array.\n */\nexport default class ManagedArray {\n constructor(length = 0) {\n this._array = new Array(length);\n this._map = new Map();\n this._length = length;\n }\n\n /**\n * Gets or sets the length of the array.\n * If the set length is greater than the length of the internal array, the internal array is resized.\n *\n * @memberof ManagedArray.prototype\n * @type Number\n */\n get length() {\n return this._length;\n }\n\n set length(length) {\n this._length = length;\n if (length > this._array.length) {\n this._array.length = length;\n }\n }\n\n /**\n * Gets the internal array.\n *\n * @memberof ManagedArray.prototype\n * @type Array\n * @readonly\n */\n get values() {\n return this._array;\n }\n\n /**\n * Gets the element at an index.\n *\n * @param {Number} index The index to get.\n */\n get(index) {\n assert(index < this._array.length);\n return this._array[index];\n }\n\n /**\n * Sets the element at an index. Resizes the array if index is greater than the length of the array.\n *\n * @param {Number} index The index to set.\n * @param {*} element The element to set at index.\n */\n set(index, element) {\n assert(index >= 0);\n\n if (index >= this.length) {\n this.length = index + 1;\n }\n\n if (this._map.has(this._array[index])) {\n this._map.delete(this._array[index]);\n }\n\n this._array[index] = element;\n this._map.set(element, index);\n }\n\n delete(element) {\n const index = this._map.get(element);\n if (index >= 0) {\n this._array.splice(index, 1);\n this._map.delete(element);\n this.length--;\n }\n }\n\n /**\n * Returns the last element in the array without modifying the array.\n *\n * @returns {*} The last element in the array.\n */\n peek() {\n return this._array[this._length - 1];\n }\n\n /**\n * Push an element into the array.\n *\n * @param {*} element The element to push.\n */\n push(element) {\n if (!this._map.has(element)) {\n const index = this.length++;\n this._array[index] = element;\n this._map.set(element, index);\n }\n }\n\n /**\n * Pop an element from the array.\n *\n * @returns {*} The last element in the array.\n */\n pop() {\n const element = this._array[--this.length];\n this._map.delete(element);\n return element;\n }\n\n /**\n * Resize the internal array if length > _array.length.\n *\n * @param {Number} length The length.\n */\n reserve(length) {\n assert(length >= 0);\n\n if (length > this._array.length) {\n this._array.length = length;\n }\n }\n\n /**\n * Resize the array.\n *\n * @param {Number} length The length.\n */\n resize(length) {\n assert(length >= 0);\n\n this.length = length;\n }\n\n /**\n * Trim the internal array to the specified length. Defaults to the current length.\n *\n * @param {Number} [length] The length.\n */\n trim(length) {\n if (length === null || length === undefined) {\n length = this.length;\n }\n this._array.length = length;\n }\n\n reset() {\n this._array = [];\n this._map = new Map();\n this._length = 0;\n }\n\n find(target) {\n return this._map.has(target);\n }\n}\n"],"file":"managed-array.js"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { Tileset3DProps } from './tileset/tileset-3d';
|
|
2
|
+
export { default as Tileset3D } from './tileset/tileset-3d';
|
|
3
|
+
export { default as Tile3D } from './tileset/tile-3d';
|
|
4
|
+
export { default as TilesetTraverser } from './tileset/traversers/tileset-traverser';
|
|
5
|
+
export { default as TilesetCache } from './tileset/tileset-cache';
|
|
6
|
+
export { createBoundingVolume } from './tileset/helpers/bounding-volume';
|
|
7
|
+
export { calculateTransformProps } from './tileset/helpers/transform-utils';
|
|
8
|
+
export { getFrameState } from './tileset/helpers/frame-state';
|
|
9
|
+
export { getLodStatus } from './tileset/helpers/i3s-lod';
|
|
10
|
+
export { TILE_CONTENT_STATE, TILE_REFINEMENT, TILE_TYPE, TILESET_TYPE, LOD_METRIC_TYPE } from './constants';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a bounding volume from the tile's bounding volume header.
|
|
3
|
+
* @param {Object} boundingVolumeHeader The tile's bounding volume header.
|
|
4
|
+
* @param {Matrix4} transform The transform to apply to the bounding volume.
|
|
5
|
+
* @param [result] The object onto which to store the result.
|
|
6
|
+
* @returns The modified result parameter or a new TileBoundingVolume instance if none was provided.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createBoundingVolume(boundingVolumeHeader: any, transform: any, result: any): any;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CullingVolume } from '@math.gl/culling';
|
|
2
|
+
export declare type FrameState = {
|
|
3
|
+
camera: {
|
|
4
|
+
position: number[];
|
|
5
|
+
direction: number[];
|
|
6
|
+
up: number[];
|
|
7
|
+
};
|
|
8
|
+
viewport: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
height: number;
|
|
12
|
+
cullingVolume: CullingVolume;
|
|
13
|
+
frameNumber: number;
|
|
14
|
+
sseDenominator: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function getFrameState(viewport: any, frameNumber: number): FrameState;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Tile3D } from '../..';
|
|
2
|
+
import { FrameState } from './frame-state';
|
|
3
|
+
/**
|
|
4
|
+
* For the maxScreenThreshold error metric, maxError means that you should replace the node with it's children
|
|
5
|
+
as soon as the nodes bounding sphere has a screen radius larger than maxError pixels.
|
|
6
|
+
In this sense a value of 0 means you should always load it's children,
|
|
7
|
+
or if it's a leaf node, you should always display it.
|
|
8
|
+
* @param tile
|
|
9
|
+
* @param frameState
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function getLodStatus(tile: Tile3D, frameState: FrameState): 'DIG' | 'OUT' | 'DRAW';
|
|
13
|
+
/**
|
|
14
|
+
* Calculate size of MBS radius projected on the screen plane
|
|
15
|
+
* @param tile
|
|
16
|
+
* @param frameState
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export declare function getProjectedRadius(tile: Tile3D, frameState: FrameState): number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function calculateDynamicScreenSpaceError(root: any, { camera, mapProjection }: {
|
|
2
|
+
camera: any;
|
|
3
|
+
mapProjection: any;
|
|
4
|
+
}, options?: {}): number;
|
|
5
|
+
export declare function fog(distanceToCamera: any, density: any): number;
|
|
6
|
+
export declare function getDynamicScreenSpaceError(tileset: any, distanceToCamera: any): number;
|
|
7
|
+
export declare function getTiles3DScreenSpaceError(tile: any, frameState: any, useParentLodMetric: any): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function calculateTransformProps(tileHeader: any, tile: any): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate appropriate zoom value for a particular boundingVolume
|
|
3
|
+
* @param {BoundingSphere, OrientedBoundingBox} boundingVolume - the instance of bounding volume
|
|
4
|
+
* @returns {number} - zoom value
|
|
5
|
+
*/
|
|
6
|
+
export declare function getZoomFromBoundingVolume(boundingVolume: any): number;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Matrix4 } from '@math.gl/core';
|
|
2
|
+
import { FrameState } from './helpers/frame-state';
|
|
3
|
+
import type Tileset3D from './tileset-3d';
|
|
4
|
+
/**
|
|
5
|
+
* @param tileset - Tileset3D instance
|
|
6
|
+
* @param header - tile header - JSON loaded from a dataset
|
|
7
|
+
* @param parentHeader - parent TileHeader instance
|
|
8
|
+
* @param extendedId - optional ID to separate copies of a tile for different viewports.
|
|
9
|
+
* const extendedId = `${tile.id}-${frameState.viewport.id}`;
|
|
10
|
+
*/
|
|
11
|
+
export declare type TileHeaderProps = {
|
|
12
|
+
tileset: Tileset3D;
|
|
13
|
+
header: Object;
|
|
14
|
+
parentHeader: TileHeader;
|
|
15
|
+
extendedId: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A Tile3DHeader represents a tile as Tileset3D. When a tile is first created, its content is not loaded;
|
|
19
|
+
* the content is loaded on-demand when needed based on the view.
|
|
20
|
+
* Do not construct this directly, instead access tiles through {@link Tileset3D#tileVisible}.
|
|
21
|
+
*/
|
|
22
|
+
export default class TileHeader {
|
|
23
|
+
tileset: Tileset3D;
|
|
24
|
+
header: any;
|
|
25
|
+
id: string;
|
|
26
|
+
url: string;
|
|
27
|
+
parent: TileHeader;
|
|
28
|
+
refine: number;
|
|
29
|
+
type: string;
|
|
30
|
+
contentUrl: string;
|
|
31
|
+
lodMetricType: string;
|
|
32
|
+
lodMetricValue: number;
|
|
33
|
+
boundingVolume: any;
|
|
34
|
+
content: any;
|
|
35
|
+
contentState: any;
|
|
36
|
+
gpuMemoryUsageInBytes: number;
|
|
37
|
+
children: TileHeader[];
|
|
38
|
+
depth: number;
|
|
39
|
+
viewportIds: any[];
|
|
40
|
+
transform: Matrix4;
|
|
41
|
+
userData: {
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
};
|
|
44
|
+
computedTransform: any;
|
|
45
|
+
hasEmptyContent: boolean;
|
|
46
|
+
hasTilesetContent: boolean;
|
|
47
|
+
traverser: object;
|
|
48
|
+
private _cacheNode;
|
|
49
|
+
private _frameNumber;
|
|
50
|
+
private _lodJudge;
|
|
51
|
+
private _expireDate;
|
|
52
|
+
private _expiredContent;
|
|
53
|
+
private _shouldRefine;
|
|
54
|
+
private _distanceToCamera;
|
|
55
|
+
private _centerZDepth;
|
|
56
|
+
private _screenSpaceError;
|
|
57
|
+
private _visibilityPlaneMask;
|
|
58
|
+
private _visible?;
|
|
59
|
+
private _inRequestVolume;
|
|
60
|
+
private _stackLength;
|
|
61
|
+
private _selectionDepth;
|
|
62
|
+
private _touchedFrame;
|
|
63
|
+
private _visitedFrame;
|
|
64
|
+
private _selectedFrame;
|
|
65
|
+
private _requestedFrame;
|
|
66
|
+
private _priority;
|
|
67
|
+
private _contentBoundingVolume;
|
|
68
|
+
private _viewerRequestVolume;
|
|
69
|
+
_initialTransform: Matrix4;
|
|
70
|
+
/**
|
|
71
|
+
* @constructs
|
|
72
|
+
* Create a TileHeader instance
|
|
73
|
+
* @param tileset - Tileset3D instance
|
|
74
|
+
* @param header - tile header - JSON loaded from a dataset
|
|
75
|
+
* @param parentHeader - parent TileHeader instance
|
|
76
|
+
* @param extendedId - optional ID to separate copies of a tile for different viewports.
|
|
77
|
+
* const extendedId = `${tile.id}-${frameState.viewport.id}`;
|
|
78
|
+
*/
|
|
79
|
+
constructor(tileset: Tileset3D, header: {
|
|
80
|
+
[key: string]: any;
|
|
81
|
+
}, parentHeader?: TileHeader, extendedId?: string);
|
|
82
|
+
destroy(): void;
|
|
83
|
+
isDestroyed(): boolean;
|
|
84
|
+
get selected(): boolean;
|
|
85
|
+
get isVisible(): boolean | undefined;
|
|
86
|
+
get isVisibleAndInRequestVolume(): boolean | undefined;
|
|
87
|
+
/** Returns true if tile is not an empty tile and not an external tileset */
|
|
88
|
+
get hasRenderContent(): boolean;
|
|
89
|
+
/** Returns true if tile has children */
|
|
90
|
+
get hasChildren(): any;
|
|
91
|
+
/**
|
|
92
|
+
* Determines if the tile's content is ready. This is automatically `true` for
|
|
93
|
+
* tiles with empty content.
|
|
94
|
+
*/
|
|
95
|
+
get contentReady(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Determines if the tile has available content to render. `true` if the tile's
|
|
98
|
+
* content is ready or if it has expired content this renders while new content loads; otherwise,
|
|
99
|
+
*/
|
|
100
|
+
get contentAvailable(): boolean;
|
|
101
|
+
/** Returns true if tile has renderable content but it's unloaded */
|
|
102
|
+
get hasUnloadedContent(): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Determines if the tile's content has not be requested. `true` if tile's
|
|
105
|
+
* content has not be requested; otherwise, `false`.
|
|
106
|
+
*/
|
|
107
|
+
get contentUnloaded(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Determines if the tile's content is expired. `true` if tile's
|
|
110
|
+
* content is expired; otherwise, `false`.
|
|
111
|
+
*/
|
|
112
|
+
get contentExpired(): boolean;
|
|
113
|
+
get contentFailed(): boolean;
|
|
114
|
+
/** Get the tile's screen space error. */
|
|
115
|
+
getScreenSpaceError(frameState: any, useParentLodMetric: any): number;
|
|
116
|
+
_getPriority(): number;
|
|
117
|
+
/**
|
|
118
|
+
* Requests the tile's content.
|
|
119
|
+
* The request may not be made if the Request Scheduler can't prioritize it.
|
|
120
|
+
*/
|
|
121
|
+
loadContent(): Promise<boolean>;
|
|
122
|
+
unloadContent(): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Update the tile's visibility
|
|
125
|
+
* @param {Object} frameState - frame state for tile culling
|
|
126
|
+
* @param {string[]} viewportIds - a list of viewport ids that show this tile
|
|
127
|
+
* @return {void}
|
|
128
|
+
*/
|
|
129
|
+
updateVisibility(frameState: any, viewportIds: any): void;
|
|
130
|
+
visibility(frameState: any, parentVisibilityPlaneMask: any): any;
|
|
131
|
+
contentVisibility(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Computes the (potentially approximate) distance from the closest point of the tile's bounding volume to the camera.
|
|
134
|
+
* @param frameState The frame state.
|
|
135
|
+
* @returns {Number} The distance, in meters, or zero if the camera is inside the bounding volume.
|
|
136
|
+
*/
|
|
137
|
+
distanceToTile(frameState: FrameState): number;
|
|
138
|
+
/**
|
|
139
|
+
* Computes the tile's camera-space z-depth.
|
|
140
|
+
* @param frameState The frame state.
|
|
141
|
+
* @returns The distance, in meters.
|
|
142
|
+
*/
|
|
143
|
+
cameraSpaceZDepth({ camera }: {
|
|
144
|
+
camera: any;
|
|
145
|
+
}): number;
|
|
146
|
+
/**
|
|
147
|
+
* Checks if the camera is inside the viewer request volume.
|
|
148
|
+
* @param {FrameState} frameState The frame state.
|
|
149
|
+
* @returns {Boolean} Whether the camera is inside the volume.
|
|
150
|
+
*/
|
|
151
|
+
insideViewerRequestVolume(frameState: FrameState): boolean;
|
|
152
|
+
updateExpiration(): void;
|
|
153
|
+
get extras(): any;
|
|
154
|
+
_initializeLodMetric(header: any): void;
|
|
155
|
+
_initializeTransforms(tileHeader: any): void;
|
|
156
|
+
_initializeBoundingVolumes(tileHeader: any): void;
|
|
157
|
+
_initializeContent(tileHeader: any): void;
|
|
158
|
+
_initializeRenderingState(header: any): void;
|
|
159
|
+
_getRefine(refine: any): any;
|
|
160
|
+
_isTileset(): boolean;
|
|
161
|
+
_onContentLoaded(): void;
|
|
162
|
+
_updateBoundingVolume(header: any): void;
|
|
163
|
+
_updateTransform(parentTransform?: Matrix4): void;
|
|
164
|
+
_getLoaderSpecificOptions(loaderId: any): {
|
|
165
|
+
assetGltfUpAxis: any;
|
|
166
|
+
} | {
|
|
167
|
+
tile: any;
|
|
168
|
+
tileset: {
|
|
169
|
+
[key: string]: any;
|
|
170
|
+
};
|
|
171
|
+
isTileHeader: boolean;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Matrix4, Vector3 } from '@math.gl/core';
|
|
2
|
+
import { Stats } from '@probe.gl/stats';
|
|
3
|
+
import { RequestScheduler, LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
4
|
+
import { FrameState } from './helpers/frame-state';
|
|
5
|
+
import Tile3D from './tile-3d';
|
|
6
|
+
import TilesetTraverser from './traversers/tileset-traverser';
|
|
7
|
+
export declare type Tileset3DProps = {
|
|
8
|
+
throttleRequests?: boolean;
|
|
9
|
+
maxRequests?: number;
|
|
10
|
+
loadOptions?: LoaderOptions;
|
|
11
|
+
loadTiles?: boolean;
|
|
12
|
+
basePath?: string;
|
|
13
|
+
maximumMemoryUsage?: number;
|
|
14
|
+
description?: string;
|
|
15
|
+
attributions?: string[];
|
|
16
|
+
ellipsoid?: object;
|
|
17
|
+
modelMatrix?: Matrix4;
|
|
18
|
+
maximumScreenSpaceError?: number;
|
|
19
|
+
viewportTraversersMap?: any;
|
|
20
|
+
updateTransforms?: boolean;
|
|
21
|
+
viewDistanceScale?: number;
|
|
22
|
+
onTileLoad?: (tile: Tile3D) => any;
|
|
23
|
+
onTileUnload?: (tile: Tile3D) => any;
|
|
24
|
+
onTileError?: (tile: Tile3D, message: string, url: string) => any;
|
|
25
|
+
contentLoader?: (tile: Tile3D) => Promise<void>;
|
|
26
|
+
onTraversalComplete?: (selectedTiles: Tile3D[]) => Tile3D[];
|
|
27
|
+
};
|
|
28
|
+
declare type Props = {
|
|
29
|
+
description: string;
|
|
30
|
+
ellipsoid: object;
|
|
31
|
+
modelMatrix: Matrix4;
|
|
32
|
+
throttleRequests: boolean;
|
|
33
|
+
maximumMemoryUsage: number;
|
|
34
|
+
onTileLoad: (tile: Tile3D) => any;
|
|
35
|
+
onTileUnload: (tile: Tile3D) => any;
|
|
36
|
+
onTileError: (tile: Tile3D, message: string, url: string) => any;
|
|
37
|
+
onTraversalComplete: (selectedTiles: Tile3D[]) => Tile3D[];
|
|
38
|
+
maximumScreenSpaceError: number;
|
|
39
|
+
viewportTraversersMap: any;
|
|
40
|
+
attributions: string[];
|
|
41
|
+
maxRequests: number;
|
|
42
|
+
loadTiles: boolean;
|
|
43
|
+
loadOptions: LoaderOptions;
|
|
44
|
+
updateTransforms: boolean;
|
|
45
|
+
viewDistanceScale: number;
|
|
46
|
+
basePath: string;
|
|
47
|
+
contentLoader?: (tile: Tile3D) => Promise<void>;
|
|
48
|
+
i3s: {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export default class Tileset3D {
|
|
53
|
+
options: Props;
|
|
54
|
+
loadOptions: {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
};
|
|
57
|
+
type: string;
|
|
58
|
+
tileset: {
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
};
|
|
61
|
+
loader: LoaderWithParser;
|
|
62
|
+
url: string;
|
|
63
|
+
basePath: string;
|
|
64
|
+
modelMatrix: Matrix4;
|
|
65
|
+
ellipsoid: any;
|
|
66
|
+
lodMetricType: string;
|
|
67
|
+
lodMetricValue: number;
|
|
68
|
+
refine: string;
|
|
69
|
+
root: Tile3D | null;
|
|
70
|
+
roots: {
|
|
71
|
+
[key: string]: Tile3D;
|
|
72
|
+
};
|
|
73
|
+
asset: {
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
};
|
|
76
|
+
description: string;
|
|
77
|
+
properties: any;
|
|
78
|
+
extras: any;
|
|
79
|
+
attributions: any;
|
|
80
|
+
credits: any;
|
|
81
|
+
stats: Stats;
|
|
82
|
+
traverseCounter: number;
|
|
83
|
+
geometricError: number;
|
|
84
|
+
selectedTiles: Tile3D[];
|
|
85
|
+
cartographicCenter: Vector3 | null;
|
|
86
|
+
cartesianCenter: Vector3 | null;
|
|
87
|
+
zoom: number;
|
|
88
|
+
boundingVolume: any;
|
|
89
|
+
gpuMemoryUsageInBytes: any;
|
|
90
|
+
dynamicScreenSpaceErrorComputedDensity: any;
|
|
91
|
+
_traverser: TilesetTraverser;
|
|
92
|
+
private _cache;
|
|
93
|
+
_requestScheduler: RequestScheduler;
|
|
94
|
+
_frameNumber: number;
|
|
95
|
+
private _queryParamsString;
|
|
96
|
+
private _queryParams;
|
|
97
|
+
private _extensionsUsed;
|
|
98
|
+
private _tiles;
|
|
99
|
+
private _pendingCount;
|
|
100
|
+
private lastUpdatedVieports;
|
|
101
|
+
private _requestedTiles;
|
|
102
|
+
private _emptyTiles;
|
|
103
|
+
private frameStateData;
|
|
104
|
+
maximumMemoryUsage: number;
|
|
105
|
+
/**
|
|
106
|
+
* Create a new Tileset3D
|
|
107
|
+
* @param json
|
|
108
|
+
* @param props
|
|
109
|
+
*/
|
|
110
|
+
constructor(json: any, options?: Tileset3DProps);
|
|
111
|
+
/** Release resources */
|
|
112
|
+
destroy(): void;
|
|
113
|
+
/** Is the tileset loaded (update needs to have been called at least once) */
|
|
114
|
+
isLoaded(): boolean;
|
|
115
|
+
get tiles(): object[];
|
|
116
|
+
get frameNumber(): number;
|
|
117
|
+
get queryParams(): string;
|
|
118
|
+
setProps(props: Tileset3DProps): void;
|
|
119
|
+
/** @deprecated */
|
|
120
|
+
setOptions(options: Tileset3DProps): void;
|
|
121
|
+
/**
|
|
122
|
+
* Return a loadable tile url for a specific tile subpath
|
|
123
|
+
* @param tilePath a tile subpath
|
|
124
|
+
*/
|
|
125
|
+
getTileUrl(tilePath: string): string;
|
|
126
|
+
hasExtension(extensionName: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Update visible tiles relying on a list of viewports
|
|
129
|
+
* @param viewports - list of viewports
|
|
130
|
+
*/
|
|
131
|
+
update(viewports: any[]): void;
|
|
132
|
+
/**
|
|
133
|
+
* Check if traversal is needed for particular viewport
|
|
134
|
+
* @param {string} viewportId - id of a viewport
|
|
135
|
+
* @return {boolean}
|
|
136
|
+
*/
|
|
137
|
+
_needTraverse(viewportId: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* The callback to post-process tiles after traversal procedure
|
|
140
|
+
* @param frameState - frame state for tile culling
|
|
141
|
+
*/
|
|
142
|
+
_onTraversalEnd(frameState: FrameState): void;
|
|
143
|
+
/**
|
|
144
|
+
* Update tiles relying on data from all traversers
|
|
145
|
+
*/
|
|
146
|
+
_updateTiles(): void;
|
|
147
|
+
_tilesChanged(oldSelectedTiles: any, selectedTiles: any): boolean;
|
|
148
|
+
_loadTiles(): void;
|
|
149
|
+
_unloadTiles(): void;
|
|
150
|
+
_updateStats(): void;
|
|
151
|
+
_initializeTileSet(tilesetJson: any): void;
|
|
152
|
+
_calculateViewProps(): void;
|
|
153
|
+
_initializeStats(): void;
|
|
154
|
+
_initializeTileHeaders(tilesetJson: any, parentTileHeader: any): Tile3D;
|
|
155
|
+
_initializeTraverser(): any;
|
|
156
|
+
_destroyTileHeaders(parentTile: any): void;
|
|
157
|
+
_loadTile(tile: any): Promise<void>;
|
|
158
|
+
_onTileLoadError(tile: any, error: any): void;
|
|
159
|
+
_onTileLoad(tile: any, loaded: any): void;
|
|
160
|
+
_onStartTileLoading(): void;
|
|
161
|
+
_onEndTileLoading(): void;
|
|
162
|
+
_addTileToCache(tile: any): void;
|
|
163
|
+
_updateCacheStats(tile: any): void;
|
|
164
|
+
_unloadTile(tile: any): void;
|
|
165
|
+
_destroy(): void;
|
|
166
|
+
_destroySubtree(tile: any): void;
|
|
167
|
+
_destroyTile(tile: any): void;
|
|
168
|
+
_initializeCesiumTileset(tilesetJson: any): void;
|
|
169
|
+
_initializeI3STileset(): void;
|
|
170
|
+
}
|
|
171
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stores tiles with content loaded.
|
|
3
|
+
*
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export default class TilesetCache {
|
|
7
|
+
private _list;
|
|
8
|
+
private _sentinel;
|
|
9
|
+
private _trimTiles;
|
|
10
|
+
constructor();
|
|
11
|
+
reset(): void;
|
|
12
|
+
touch(tile: any): void;
|
|
13
|
+
add(tileset: any, tile: any, addCallback: any): void;
|
|
14
|
+
unloadTile(tileset: any, tile: any, unloadCallback?: any): void;
|
|
15
|
+
unloadTiles(tileset: any, unloadCallback: any): void;
|
|
16
|
+
trim(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import TilesetTraverser from './tileset-traverser';
|
|
2
|
+
export default class I3STilesetTraverser extends TilesetTraverser {
|
|
3
|
+
private _tileManager;
|
|
4
|
+
constructor(options: any);
|
|
5
|
+
shouldRefine(tile: any, frameState: any): boolean;
|
|
6
|
+
updateChildTiles(tile: any, frameState: any): boolean;
|
|
7
|
+
_loadTile(nodeId: any, tileset: any): Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
* The callback to init TileHeader instance after loading the tile JSON
|
|
10
|
+
* @param {Object} header - the tile JSON from a dataset
|
|
11
|
+
* @param {TileHeader} tile - the parent TileHeader instance
|
|
12
|
+
* @param {string} extendedId - optional ID to separate copies of a tile for different viewports.
|
|
13
|
+
* const extendedId = `${tile.id}-${frameState.viewport.id}`;
|
|
14
|
+
* @return {void}
|
|
15
|
+
*/
|
|
16
|
+
_onTileLoad(header: any, tile: any, extendedId: any): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import TilesetTraverser from './tileset-traverser';
|
|
2
|
+
export default class Tileset3DTraverser extends TilesetTraverser {
|
|
3
|
+
compareDistanceToCamera(a: any, b: any): number;
|
|
4
|
+
updateTileVisibility(tile: any, frameState: any): void;
|
|
5
|
+
meetsScreenSpaceErrorEarly(tile: any, frameState: any): boolean;
|
|
6
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import ManagedArray from '../../utils/managed-array';
|
|
2
|
+
export declare type TilesetTraverserProps = {
|
|
3
|
+
loadSiblings?: boolean;
|
|
4
|
+
skipLevelOfDetail?: boolean;
|
|
5
|
+
maximumScreenSpaceError?: number;
|
|
6
|
+
onTraversalEnd?: (frameState: any) => any;
|
|
7
|
+
viewportTraversersMap?: {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
basePath?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare type Props = {
|
|
13
|
+
loadSiblings: boolean;
|
|
14
|
+
skipLevelOfDetail: boolean;
|
|
15
|
+
updateTransforms: boolean;
|
|
16
|
+
maximumScreenSpaceError: number;
|
|
17
|
+
onTraversalEnd: (frameState: any) => any;
|
|
18
|
+
viewportTraversersMap: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
basePath: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const DEFAULT_PROPS: Props;
|
|
24
|
+
export default class TilesetTraverser {
|
|
25
|
+
options: Props;
|
|
26
|
+
root: any;
|
|
27
|
+
requestedTiles: object;
|
|
28
|
+
selectedTiles: object;
|
|
29
|
+
emptyTiles: object;
|
|
30
|
+
protected _traversalStack: ManagedArray;
|
|
31
|
+
protected _emptyTraversalStack: ManagedArray;
|
|
32
|
+
protected _frameNumber: number | null;
|
|
33
|
+
constructor(options: TilesetTraverserProps);
|
|
34
|
+
traverse(root: any, frameState: any, options: any): void;
|
|
35
|
+
reset(): void;
|
|
36
|
+
executeTraversal(root: any, frameState: any): void;
|
|
37
|
+
updateChildTiles(tile: any, frameState: any): boolean;
|
|
38
|
+
updateAndPushChildren(tile: any, frameState: any, stack: any, depth: any): boolean;
|
|
39
|
+
updateTile(tile: any, frameState: any): void;
|
|
40
|
+
selectTile(tile: any, frameState: any): void;
|
|
41
|
+
loadTile(tile: any, frameState: any): void;
|
|
42
|
+
touchTile(tile: any, frameState: any): void;
|
|
43
|
+
canTraverse(tile: any, frameState: any, useParentMetric?: boolean, ignoreVisibility?: boolean): boolean;
|
|
44
|
+
shouldLoadTile(tile: any): any;
|
|
45
|
+
shouldSelectTile(tile: any): any;
|
|
46
|
+
shouldRefine(tile: any, frameState: any, useParentMetric: any): boolean;
|
|
47
|
+
updateTileVisibility(tile: any, frameState: any): void;
|
|
48
|
+
compareDistanceToCamera(b: any, a: any): number;
|
|
49
|
+
anyChildrenVisible(tile: any, frameState: any): boolean;
|
|
50
|
+
executeEmptyTraversal(root: any, frameState: any): boolean;
|
|
51
|
+
}
|