@loaders.gl/tiles 4.0.0-alpha.4 → 4.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/constants.d.ts +32 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/dist.min.js +8204 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tileset/helpers/3d-tiles-options.d.ts +4 -0
- package/dist/tileset/helpers/3d-tiles-options.d.ts.map +1 -0
- package/dist/tileset/helpers/bounding-volume.d.ts +9 -0
- package/dist/tileset/helpers/bounding-volume.d.ts.map +1 -0
- package/dist/tileset/helpers/frame-state.d.ts +17 -0
- package/dist/tileset/helpers/frame-state.d.ts.map +1 -0
- package/dist/tileset/helpers/frame-state.js +1 -1
- package/dist/tileset/helpers/frame-state.js.map +1 -1
- package/dist/tileset/helpers/i3s-lod.d.ts +20 -0
- package/dist/tileset/helpers/i3s-lod.d.ts.map +1 -0
- package/dist/tileset/helpers/i3s-lod.js +45 -86
- package/dist/tileset/helpers/i3s-lod.js.map +1 -1
- package/dist/tileset/helpers/tiles-3d-lod.d.ts +8 -0
- package/dist/tileset/helpers/tiles-3d-lod.d.ts.map +1 -0
- package/dist/tileset/helpers/transform-utils.d.ts +2 -0
- package/dist/tileset/helpers/transform-utils.d.ts.map +1 -0
- package/dist/tileset/helpers/zoom.d.ts +7 -0
- package/dist/tileset/helpers/zoom.d.ts.map +1 -0
- package/dist/tileset/tile-3d.d.ts +175 -0
- package/dist/tileset/tile-3d.d.ts.map +1 -0
- package/dist/tileset/tile-3d.js +5 -2
- package/dist/tileset/tile-3d.js.map +1 -1
- package/dist/tileset/tileset-3d.d.ts +172 -0
- package/dist/tileset/tileset-3d.d.ts.map +1 -0
- package/dist/tileset/tileset-cache.d.ts +18 -0
- package/dist/tileset/tileset-cache.d.ts.map +1 -0
- package/dist/tileset/tileset-cache.js.map +1 -1
- package/dist/tileset/traversers/i3s-tile-manager.d.ts +8 -0
- package/dist/tileset/traversers/i3s-tile-manager.d.ts.map +1 -0
- package/dist/tileset/traversers/i3s-tileset-traverser.d.ts +18 -0
- package/dist/tileset/traversers/i3s-tileset-traverser.d.ts.map +1 -0
- package/dist/tileset/traversers/i3s-tileset-traverser.js +2 -2
- package/dist/tileset/traversers/i3s-tileset-traverser.js.map +1 -1
- package/dist/tileset/traversers/tileset-3d-traverser.d.ts +7 -0
- package/dist/tileset/traversers/tileset-3d-traverser.d.ts.map +1 -0
- package/dist/tileset/traversers/tileset-traverser.d.ts +52 -0
- package/dist/tileset/traversers/tileset-traverser.d.ts.map +1 -0
- package/dist/utils/doubly-linked-list-node.d.ts +12 -0
- package/dist/utils/doubly-linked-list-node.d.ts.map +1 -0
- package/dist/utils/doubly-linked-list-node.js +7 -0
- package/dist/utils/doubly-linked-list-node.js.map +1 -1
- package/dist/utils/doubly-linked-list.d.ts +31 -0
- package/dist/utils/doubly-linked-list.d.ts.map +1 -0
- package/dist/utils/doubly-linked-list.js +6 -3
- package/dist/utils/doubly-linked-list.js.map +1 -1
- package/dist/utils/managed-array.d.ts +85 -0
- package/dist/utils/managed-array.d.ts.map +1 -0
- package/dist/utils/managed-array.js +7 -1
- package/dist/utils/managed-array.js.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +1 -0
- package/src/tileset/helpers/frame-state.ts +1 -1
- package/src/tileset/helpers/i3s-lod.ts +72 -96
- package/src/tileset/tile-3d.ts +4 -2
- package/src/tileset/tileset-cache.ts +2 -0
- package/src/tileset/traversers/i3s-tileset-traverser.ts +2 -3
- package/src/utils/{doubly-linked-list-node.js → doubly-linked-list-node.ts} +4 -0
- package/src/utils/{doubly-linked-list.js → doubly-linked-list.ts} +3 -5
- package/src/utils/{managed-array.js → managed-array.ts} +4 -1
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
}
|
|
52
|
+
//# sourceMappingURL=tileset-traverser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tileset-traverser.d.ts","sourceRoot":"","sources":["../../../src/tileset/traversers/tileset-traverser.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,2BAA2B,CAAC;AAGrD,oBAAY,qBAAqB,GAAG;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,CAAC,UAAU,KAAA,KAAK,GAAG,CAAC;IACrC,qBAAqB,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oBAAY,KAAK,GAAG;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,CAAC,UAAU,KAAA,KAAK,GAAG,CAAC;IACpC,qBAAqB,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,aAAa,E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IAWnC,qBAAqB,CAAC,IAAI,KAAA,EAAE,UAAU,KAAA;CAqCvC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Doubly linked list node
|
|
3
|
+
*
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export default class DoublyLinkedListNode {
|
|
7
|
+
item: any;
|
|
8
|
+
previous: any;
|
|
9
|
+
next: any;
|
|
10
|
+
constructor(item: any, previous: any, next: any);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=doubly-linked-list-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doubly-linked-list-node.d.ts","sourceRoot":"","sources":["../../src/utils/doubly-linked-list-node.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC,IAAI,MAAC;IACL,QAAQ,MAAC;IACT,IAAI,MAAC;gBAEO,IAAI,KAAA,EAAE,QAAQ,KAAA,EAAE,IAAI,KAAA;CAKjC"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
export default class DoublyLinkedListNode {
|
|
2
3
|
constructor(item, previous, next) {
|
|
4
|
+
_defineProperty(this, "item", void 0);
|
|
5
|
+
|
|
6
|
+
_defineProperty(this, "previous", void 0);
|
|
7
|
+
|
|
8
|
+
_defineProperty(this, "next", void 0);
|
|
9
|
+
|
|
3
10
|
this.item = item;
|
|
4
11
|
this.previous = previous;
|
|
5
12
|
this.next = next;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/doubly-linked-list-node.
|
|
1
|
+
{"version":3,"sources":["../../src/utils/doubly-linked-list-node.ts"],"names":["DoublyLinkedListNode","constructor","item","previous","next"],"mappings":";AAQA,eAAe,MAAMA,oBAAN,CAA2B;AAKxCC,EAAAA,WAAW,CAACC,IAAD,EAAOC,QAAP,EAAiBC,IAAjB,EAAuB;AAAA;;AAAA;;AAAA;;AAChC,SAAKF,IAAL,GAAYA,IAAZ;AACA,SAAKC,QAAL,GAAgBA,QAAhB;AACA,SAAKC,IAAL,GAAYA,IAAZ;AACD;;AATuC","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 item;\n previous;\n next;\n\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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import DoublyLinkedListNode from '../utils/doubly-linked-list-node';
|
|
2
|
+
/**
|
|
3
|
+
* Doubly linked list
|
|
4
|
+
*
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export default class DoublyLinkedList {
|
|
8
|
+
head: DoublyLinkedListNode | null;
|
|
9
|
+
tail: DoublyLinkedListNode | null;
|
|
10
|
+
_length: number;
|
|
11
|
+
get length(): number;
|
|
12
|
+
/**
|
|
13
|
+
* Adds the item to the end of the list
|
|
14
|
+
* @param {*} [item]
|
|
15
|
+
* @return {DoublyLinkedListNode}
|
|
16
|
+
*/
|
|
17
|
+
add(item: any): DoublyLinkedListNode;
|
|
18
|
+
/**
|
|
19
|
+
* Removes the given node from the list
|
|
20
|
+
* @param {DoublyLinkedListNode} node
|
|
21
|
+
*/
|
|
22
|
+
remove(node: any): void;
|
|
23
|
+
/**
|
|
24
|
+
* Moves nextNode after node
|
|
25
|
+
* @param {DoublyLinkedListNode} node
|
|
26
|
+
* @param {DoublyLinkedListNode} nextNode
|
|
27
|
+
*/
|
|
28
|
+
splice(node: any, nextNode: any): void;
|
|
29
|
+
_insert(node: any, nextNode: any): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=doubly-linked-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doubly-linked-list.d.ts","sourceRoot":"","sources":["../../src/utils/doubly-linked-list.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IACzC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IACzC,OAAO,SAAK;IAEZ,IAAI,MAAM,WAET;IAED;;;;OAIG;IACH,GAAG,CAAC,IAAI,KAAA;IAgBR;;;OAGG;IACH,MAAM,CAAC,IAAI,KAAA;IA4BX;;;;OAIG;IACH,MAAM,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA;IAUrB,OAAO,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA;CAgBvB"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import DoublyLinkedListNode from '../utils/doubly-linked-list-node';
|
|
2
3
|
export default class DoublyLinkedList {
|
|
3
4
|
constructor() {
|
|
4
|
-
this
|
|
5
|
-
|
|
6
|
-
this
|
|
5
|
+
_defineProperty(this, "head", null);
|
|
6
|
+
|
|
7
|
+
_defineProperty(this, "tail", null);
|
|
8
|
+
|
|
9
|
+
_defineProperty(this, "_length", 0);
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
get length() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/doubly-linked-list.
|
|
1
|
+
{"version":3,"sources":["../../src/utils/doubly-linked-list.ts"],"names":["DoublyLinkedListNode","DoublyLinkedList","length","_length","add","item","node","tail","next","head","remove","previous","splice","nextNode","_insert","oldNodeNext"],"mappings":";AAGA,OAAOA,oBAAP,MAAiC,kCAAjC;AAOA,eAAe,MAAMC,gBAAN,CAAuB;AAAA;AAAA,kCACA,IADA;;AAAA,kCA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,QAAL,GAAgB,IAAhB;AAEA,MAAE,KAAKR,OAAP;AACD;;AAODS,EAAAA,MAAM,CAACN,IAAD,EAAOO,QAAP,EAAiB;AACrB,QAAIP,IAAI,KAAKO,QAAb,EAAuB;AACrB;AACD;;AAGD,SAAKH,MAAL,CAAYG,QAAZ;;AACA,SAAKC,OAAL,CAAaR,IAAb,EAAmBO,QAAnB;AACD;;AAEDC,EAAAA,OAAO,CAACR,IAAD,EAAOO,QAAP,EAAiB;AACtB,UAAME,WAAW,GAAGT,IAAI,CAACE,IAAzB;AACAF,IAAAA,IAAI,CAACE,IAAL,GAAYK,QAAZ;;AAGA,QAAI,KAAKN,IAAL,KAAcD,IAAlB,EAAwB;AACtB,WAAKC,IAAL,GAAYM,QAAZ;AACD,KAFD,MAEO;AACLE,MAAAA,WAAW,CAACJ,QAAZ,GAAuBE,QAAvB;AACD;;AAEDA,IAAAA,QAAQ,CAACL,IAAT,GAAgBO,WAAhB;AACAF,IAAAA,QAAQ,CAACF,QAAT,GAAoBL,IAApB;AAEA,MAAE,KAAKH,OAAP;AACD;;AA5FmC","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 head: DoublyLinkedListNode | null = null;\n tail: DoublyLinkedListNode | null = null;\n _length = 0;\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"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A wrapper around arrays so that the internal length of the array can be manually managed.
|
|
3
|
+
*
|
|
4
|
+
* @alias ManagedArray
|
|
5
|
+
* @constructor
|
|
6
|
+
* @private
|
|
7
|
+
*
|
|
8
|
+
* @param {Number} [length=0] The initial length of the array.
|
|
9
|
+
*/
|
|
10
|
+
export default class ManagedArray {
|
|
11
|
+
_map: Map<any, any>;
|
|
12
|
+
_array: any[];
|
|
13
|
+
_length: number;
|
|
14
|
+
constructor(length?: number);
|
|
15
|
+
/**
|
|
16
|
+
* Gets or sets the length of the array.
|
|
17
|
+
* If the set length is greater than the length of the internal array, the internal array is resized.
|
|
18
|
+
*
|
|
19
|
+
* @memberof ManagedArray.prototype
|
|
20
|
+
* @type Number
|
|
21
|
+
*/
|
|
22
|
+
get length(): number;
|
|
23
|
+
set length(length: number);
|
|
24
|
+
/**
|
|
25
|
+
* Gets the internal array.
|
|
26
|
+
*
|
|
27
|
+
* @memberof ManagedArray.prototype
|
|
28
|
+
* @type Array
|
|
29
|
+
* @readonly
|
|
30
|
+
*/
|
|
31
|
+
get values(): any[];
|
|
32
|
+
/**
|
|
33
|
+
* Gets the element at an index.
|
|
34
|
+
*
|
|
35
|
+
* @param {Number} index The index to get.
|
|
36
|
+
*/
|
|
37
|
+
get(index: any): any;
|
|
38
|
+
/**
|
|
39
|
+
* Sets the element at an index. Resizes the array if index is greater than the length of the array.
|
|
40
|
+
*
|
|
41
|
+
* @param {Number} index The index to set.
|
|
42
|
+
* @param {*} element The element to set at index.
|
|
43
|
+
*/
|
|
44
|
+
set(index: any, element: any): void;
|
|
45
|
+
delete(element: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the last element in the array without modifying the array.
|
|
48
|
+
*
|
|
49
|
+
* @returns {*} The last element in the array.
|
|
50
|
+
*/
|
|
51
|
+
peek(): any;
|
|
52
|
+
/**
|
|
53
|
+
* Push an element into the array.
|
|
54
|
+
*
|
|
55
|
+
* @param {*} element The element to push.
|
|
56
|
+
*/
|
|
57
|
+
push(element: any): void;
|
|
58
|
+
/**
|
|
59
|
+
* Pop an element from the array.
|
|
60
|
+
*
|
|
61
|
+
* @returns {*} The last element in the array.
|
|
62
|
+
*/
|
|
63
|
+
pop(): any;
|
|
64
|
+
/**
|
|
65
|
+
* Resize the internal array if length > _array.length.
|
|
66
|
+
*
|
|
67
|
+
* @param {Number} length The length.
|
|
68
|
+
*/
|
|
69
|
+
reserve(length: any): void;
|
|
70
|
+
/**
|
|
71
|
+
* Resize the array.
|
|
72
|
+
*
|
|
73
|
+
* @param {Number} length The length.
|
|
74
|
+
*/
|
|
75
|
+
resize(length: any): void;
|
|
76
|
+
/**
|
|
77
|
+
* Trim the internal array to the specified length. Defaults to the current length.
|
|
78
|
+
*
|
|
79
|
+
* @param {Number} [length] The length.
|
|
80
|
+
*/
|
|
81
|
+
trim(length: any): void;
|
|
82
|
+
reset(): void;
|
|
83
|
+
find(target: any): boolean;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=managed-array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-array.d.ts","sourceRoot":"","sources":["../../src/utils/managed-array.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,IAAI,gBAAa;IACjB,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;gBAEJ,MAAM,SAAI;IAKtB;;;;;;OAMG;IACH,IAAI,MAAM,WAET;IAED,IAAI,MAAM,CAAC,MAAM,QAAA,EAKhB;IAED;;;;;;OAMG;IACH,IAAI,MAAM,UAET;IAED;;;;OAIG;IACH,GAAG,CAAC,KAAK,KAAA;IAKT;;;;;OAKG;IACH,GAAG,CAAC,KAAK,KAAA,EAAE,OAAO,KAAA;IAelB,MAAM,CAAC,OAAO,KAAA;IASd;;;;OAIG;IACH,IAAI;IAIJ;;;;OAIG;IACH,IAAI,CAAC,OAAO,KAAA;IAQZ;;;;OAIG;IACH,GAAG;IAMH;;;;OAIG;IACH,OAAO,CAAC,MAAM,KAAA;IAQd;;;;OAIG;IACH,MAAM,CAAC,MAAM,KAAA;IAMb;;;;OAIG;IACH,IAAI,CAAC,MAAM,KAAA;IAOX,KAAK;IAML,IAAI,CAAC,MAAM,KAAA;CAGZ"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import { assert } from '@loaders.gl/loader-utils';
|
|
2
3
|
export default class ManagedArray {
|
|
3
4
|
constructor(length = 0) {
|
|
5
|
+
_defineProperty(this, "_map", new Map());
|
|
6
|
+
|
|
7
|
+
_defineProperty(this, "_array", void 0);
|
|
8
|
+
|
|
9
|
+
_defineProperty(this, "_length", void 0);
|
|
10
|
+
|
|
4
11
|
this._array = new Array(length);
|
|
5
|
-
this._map = new Map();
|
|
6
12
|
this._length = length;
|
|
7
13
|
}
|
|
8
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/managed-array.
|
|
1
|
+
{"version":3,"sources":["../../src/utils/managed-array.ts"],"names":["assert","ManagedArray","constructor","length","Map","_array","Array","_length","values","get","index","set","element","_map","has","delete","splice","peek","push","pop","reserve","resize","trim","undefined","reset","find","target"],"mappings":";AAGA,SAAQA,MAAR,QAAqB,0BAArB;AAWA,eAAe,MAAMC,YAAN,CAAmB;AAKhCC,EAAAA,WAAW,CAACC,MAAM,GAAG,CAAV,EAAa;AAAA,kCAJjB,IAAIC,GAAJ,EAIiB;;AAAA;;AAAA;;AACtB,SAAKC,MAAL,GAAc,IAAIC,KAAJ,CAAUH,MAAV,CAAd;AACA,SAAKI,OAAL,GAAeJ,MAAf;AACD;;AASS,MAANA,MAAM,GAAG;AACX,WAAO,KAAKI,OAAZ;AACD;;AAES,MAANJ,MAAM,CAACA,MAAD,EAAS;AACjB,SAAKI,OAAL,GAAeJ,MAAf;;AACA,QAAIA,MAAM,GAAG,KAAKE,MAAL,CAAYF,MAAzB,EAAiC;AAC/B,WAAKE,MAAL,CAAYF,MAAZ,GAAqBA,MAArB;AACD;AACF;;AASS,MAANK,MAAM,GAAG;AACX,WAAO,KAAKH,MAAZ;AACD;;AAODI,EAAAA,GAAG,CAACC,KAAD,EAAQ;AACTV,IAAAA,MAAM,CAACU,KAAK,GAAG,KAAKL,MAAL,CAAYF,MAArB,CAAN;AACA,WAAO,KAAKE,MAAL,CAAYK,KAAZ,CAAP;AACD;;AAQDC,EAAAA,GAAG,CAACD,KAAD,EAAQE,OAAR,EAAiB;AAClBZ,IAAAA,MAAM,CAACU,KAAK,IAAI,CAAV,CAAN;;AAEA,QAAIA,KAAK,IAAI,KAAKP,MAAlB,EAA0B;AACxB,WAAKA,MAAL,GAAcO,KAAK,GAAG,CAAtB;AACD;;AAED,QAAI,KAAKG,IAAL,CAAUC,GAAV,CAAc,KAAKT,MAAL,CAAYK,KAAZ,CAAd,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AArB;AACD;AACF;;AAODkB,EAAAA,MAAM,CAAClB,MAAD,EAAS;AACbH,IAAAA,MAAM,CAACG,MAAM,IAAI,CAAX,CAAN;AAEA,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,SAAKE,MAAL,CAAYF,MAAZ,GAAqBA,MAArB;AACD;;AAEDqB,EAAAA,KAAK,GAAG;AACN,SAAKnB,MAAL,GAAc,EAAd;AACA,SAAKQ,IAAL,GAAY,IAAIT,GAAJ,EAAZ;AACA,SAAKG,OAAL,GAAe,CAAf;AACD;;AAEDkB,EAAAA,IAAI,CAACC,MAAD,EAAS;AACX,WAAO,KAAKb,IAAL,CAAUC,GAAV,CAAcY,MAAd,CAAP;AACD;;AA5J+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 _map = new Map();\n _array: any[];\n _length: number;\n\n constructor(length = 0) {\n this._array = new Array(length);\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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tiles",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"description": "Common components for different tiles loaders.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"point cloud",
|
|
20
20
|
"pointcloud"
|
|
21
21
|
],
|
|
22
|
-
"types": "
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
23
23
|
"main": "dist/index.js",
|
|
24
24
|
"module": "dist/index.js",
|
|
25
25
|
"sideEffects": false,
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"pre-build": "npm run build-bundle",
|
|
33
|
-
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/
|
|
33
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
37
|
-
"@loaders.gl/math": "4.0.0-alpha.
|
|
36
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.5",
|
|
37
|
+
"@loaders.gl/math": "4.0.0-alpha.5",
|
|
38
38
|
"@math.gl/core": "^3.5.1",
|
|
39
39
|
"@math.gl/culling": "^3.5.1",
|
|
40
40
|
"@math.gl/geospatial": "^3.5.1",
|
|
41
41
|
"@math.gl/web-mercator": "^3.5.1",
|
|
42
|
-
"@probe.gl/stats": "^3.
|
|
42
|
+
"@probe.gl/stats": "^3.5.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@loaders.gl/core": "
|
|
45
|
+
"@loaders.gl/core": "4.0.0-alpha.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "7a71a54bdf1ddf985cc3af3db90b82e7fa97d025"
|
|
48
48
|
}
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export {createBoundingVolume} from './tileset/helpers/bounding-volume';
|
|
|
9
9
|
export {calculateTransformProps} from './tileset/helpers/transform-utils';
|
|
10
10
|
|
|
11
11
|
export {getFrameState} from './tileset/helpers/frame-state';
|
|
12
|
+
export {getLodStatus} from './tileset/helpers/i3s-lod';
|
|
12
13
|
|
|
13
14
|
export {
|
|
14
15
|
TILE_CONTENT_STATE,
|
|
@@ -33,7 +33,7 @@ export function getFrameState(viewport, frameNumber: number): FrameState {
|
|
|
33
33
|
const {cameraDirection, cameraUp, height} = viewport;
|
|
34
34
|
const {metersPerUnit} = viewport.distanceScales;
|
|
35
35
|
|
|
36
|
-
const viewportCenterCartographic =
|
|
36
|
+
const viewportCenterCartographic = viewport.unprojectPosition(viewport.center);
|
|
37
37
|
// TODO - Ellipsoid.eastNorthUpToFixedFrame() breaks on raw array, create a Vector.
|
|
38
38
|
// TODO - Ellipsoid.eastNorthUpToFixedFrame() takes a cartesian, is that intuitive?
|
|
39
39
|
const viewportCenterCartesian = Ellipsoid.WGS84.cartographicToCartesian(
|
|
@@ -1,52 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const viewportCenter = [longitude, latitude];
|
|
19
|
-
const mbsCenter = [mbsLon, mbsLat, mbsZ];
|
|
20
|
-
const mbsLatProjected = [longitude, mbsLat];
|
|
21
|
-
const mbsLonProjected = [mbsLon, latitude];
|
|
22
|
-
|
|
23
|
-
const diagonalInMeters = Math.sqrt(height * height + width * width) * metersPerPixel[0];
|
|
24
|
-
const distanceInMeters = getDistanceFromLatLon(viewportCenter, mbsCenter);
|
|
25
|
-
|
|
26
|
-
const visibleHeight = height * 0.5 + mbsR / WGS84_RADIUS_X;
|
|
27
|
-
const visibleWidth = width * 0.5 + mbsR / WGS84_RADIUS_X;
|
|
28
|
-
|
|
29
|
-
if (distanceInMeters > diagonalInMeters + mbsR / WGS84_RADIUS_X) {
|
|
30
|
-
return 'OUT';
|
|
31
|
-
}
|
|
32
|
-
if (getDistanceFromLatLon(viewportCenter, mbsLatProjected) > visibleHeight) {
|
|
33
|
-
return 'OUT';
|
|
34
|
-
}
|
|
35
|
-
if (getDistanceFromLatLon(viewportCenter, mbsLonProjected) > visibleWidth) {
|
|
36
|
-
return 'OUT';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (tile.lodMetricValue === 0) {
|
|
1
|
+
import {Matrix4, Vector3} from '@math.gl/core';
|
|
2
|
+
import {Ellipsoid} from '@math.gl/geospatial';
|
|
3
|
+
import Tile3D from '../tile-3d';
|
|
4
|
+
import {FrameState} from './frame-state';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* For the maxScreenThreshold error metric, maxError means that you should replace the node with it's children
|
|
8
|
+
as soon as the nodes bounding sphere has a screen radius larger than maxError pixels.
|
|
9
|
+
In this sense a value of 0 means you should always load it's children,
|
|
10
|
+
or if it's a leaf node, you should always display it.
|
|
11
|
+
* @param tile
|
|
12
|
+
* @param frameState
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export function getLodStatus(tile: Tile3D, frameState: FrameState): 'DIG' | 'OUT' | 'DRAW' {
|
|
16
|
+
if (tile.lodMetricValue === 0 || isNaN(tile.lodMetricValue)) {
|
|
40
17
|
return 'DIG';
|
|
41
18
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// as soon as the nodes bounding sphere has a screen radius larger than maxError pixels.
|
|
45
|
-
// In this sense a value of 0 means you should always load it's children,
|
|
46
|
-
// or if it's a leaf node, you should always display it.
|
|
47
|
-
let screenSize = getI3ScreenSize(tile, frameState); // in pixels
|
|
48
|
-
screenSize *= qualityFactor;
|
|
49
|
-
if (screenSize < 0.5) {
|
|
19
|
+
const screenSize = 2 * getProjectedRadius(tile, frameState);
|
|
20
|
+
if (screenSize < 2) {
|
|
50
21
|
return 'OUT';
|
|
51
22
|
}
|
|
52
23
|
if (!tile.header.children || screenSize <= tile.lodMetricValue) {
|
|
@@ -57,58 +28,63 @@ export function lodJudge(tile, frameState) {
|
|
|
57
28
|
return 'OUT';
|
|
58
29
|
}
|
|
59
30
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
function getDistanceFromLatLon(observer: number[], center: number[]) {
|
|
74
|
-
const [observerLon, observerLat, observerZ = 0.0] = observer;
|
|
75
|
-
const [centerLon, centerLat, centerZ = 0.0] = center;
|
|
76
|
-
|
|
77
|
-
const projectedCenter = projectVertexToSphere([centerLon, centerLat, centerZ]);
|
|
78
|
-
const projectedObserver = projectVertexToSphere([observerLon, observerLat, observerZ]);
|
|
79
|
-
const dx = projectedObserver[0] - projectedCenter[0];
|
|
80
|
-
const dy = projectedObserver[1] - projectedCenter[1];
|
|
81
|
-
const dz = projectedObserver[2] - projectedCenter[2];
|
|
82
|
-
return dx * dx + dy * dy + dz * dz;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function getI3ScreenSize(tile, frameState) {
|
|
86
|
-
const viewport = frameState.viewport;
|
|
31
|
+
/**
|
|
32
|
+
* Calculate size of MBS radius projected on the screen plane
|
|
33
|
+
* @param tile
|
|
34
|
+
* @param frameState
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
// eslint-disable-next-line max-statements
|
|
38
|
+
export function getProjectedRadius(tile: Tile3D, frameState: FrameState): number {
|
|
39
|
+
const originalViewport = frameState.viewport;
|
|
40
|
+
const ViewportClass = originalViewport.constructor;
|
|
41
|
+
const {longitude, latitude, height, width, bearing, zoom} = originalViewport;
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
const viewport = new ViewportClass({longitude, latitude, height, width, bearing, zoom, pitch: 0});
|
|
87
44
|
const mbsLat = tile.header.mbs[1];
|
|
88
45
|
const mbsLon = tile.header.mbs[0];
|
|
89
46
|
const mbsZ = tile.header.mbs[2];
|
|
90
47
|
const mbsR = tile.header.mbs[3];
|
|
91
|
-
|
|
92
|
-
const mbsCenter = [mbsLon, mbsLat, mbsZ];
|
|
48
|
+
const mbsCenterCartesian = [...tile.boundingVolume.center];
|
|
93
49
|
const cameraPositionCartographic = viewport.unprojectPosition(viewport.cameraPosition);
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
50
|
+
const cameraPositionCartesian = Ellipsoid.WGS84.cartographicToCartesian(
|
|
51
|
+
cameraPositionCartographic,
|
|
52
|
+
new Vector3()
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// ---------------------------
|
|
56
|
+
// Calculate mbs border vertex
|
|
57
|
+
// ---------------------------
|
|
58
|
+
const toEye = new Vector3(cameraPositionCartesian).subtract(mbsCenterCartesian).normalize();
|
|
59
|
+
// Add extra vector to form plane
|
|
60
|
+
const enuToCartesianMatrix = new Matrix4();
|
|
61
|
+
Ellipsoid.WGS84.eastNorthUpToFixedFrame(mbsCenterCartesian, enuToCartesianMatrix);
|
|
62
|
+
const cartesianToEnuMatrix = new Matrix4(enuToCartesianMatrix).invert();
|
|
63
|
+
const cameraPositionEnu = new Vector3(cameraPositionCartesian).transform(cartesianToEnuMatrix);
|
|
64
|
+
// Mean Proportionals in Right Triangles - Altitude rule
|
|
65
|
+
// https://mathbitsnotebook.com/Geometry/RightTriangles/RTmeanRight.html
|
|
66
|
+
const projection = Math.sqrt(
|
|
67
|
+
cameraPositionEnu[0] * cameraPositionEnu[0] + cameraPositionEnu[1] * cameraPositionEnu[1]
|
|
68
|
+
);
|
|
69
|
+
const extraZ = (projection * projection) / cameraPositionEnu[2];
|
|
70
|
+
const extraVertexEnu = new Vector3([cameraPositionEnu[0], cameraPositionEnu[1], extraZ]);
|
|
71
|
+
const extraVertexCartesian = extraVertexEnu.transform(enuToCartesianMatrix);
|
|
72
|
+
const extraVectorCartesian = new Vector3(extraVertexCartesian)
|
|
73
|
+
.subtract(mbsCenterCartesian)
|
|
74
|
+
.normalize();
|
|
75
|
+
// We need radius vector orthogonal to toEye vector
|
|
76
|
+
const radiusVector = toEye.cross(extraVectorCartesian).normalize().scale(mbsR);
|
|
77
|
+
const sphereMbsBorderVertexCartesian = new Vector3(mbsCenterCartesian).add(radiusVector);
|
|
78
|
+
const sphereMbsBorderVertexCartographic = Ellipsoid.WGS84.cartesianToCartographic(
|
|
79
|
+
sphereMbsBorderVertexCartesian
|
|
80
|
+
);
|
|
81
|
+
// ---------------------------
|
|
82
|
+
|
|
83
|
+
// Project center vertex and border vertex and calculate projected radius of MBS
|
|
84
|
+
const projectedOrigin = viewport.project([mbsLon, mbsLat, mbsZ]);
|
|
85
|
+
const projectedMbsBorderVertex = viewport.project(sphereMbsBorderVertexCartographic);
|
|
86
|
+
const projectedRadius = new Vector3(projectedOrigin)
|
|
87
|
+
.subtract(projectedMbsBorderVertex)
|
|
88
|
+
.magnitude();
|
|
89
|
+
return projectedRadius;
|
|
114
90
|
}
|
package/src/tileset/tile-3d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {TILE_REFINEMENT, TILE_CONTENT_STATE, TILESET_TYPE} from '../constants';
|
|
|
9
9
|
import {FrameState} from './helpers/frame-state';
|
|
10
10
|
import {createBoundingVolume} from './helpers/bounding-volume';
|
|
11
11
|
import {getTiles3DScreenSpaceError} from './helpers/tiles-3d-lod';
|
|
12
|
-
import {
|
|
12
|
+
import {getProjectedRadius} from './helpers/i3s-lod';
|
|
13
13
|
import {get3dTilesOptions} from './helpers/3d-tiles-options';
|
|
14
14
|
import TilesetTraverser from './traversers/tileset-traverser';
|
|
15
15
|
|
|
@@ -60,6 +60,7 @@ export default class TileHeader {
|
|
|
60
60
|
depth: number;
|
|
61
61
|
viewportIds: any[];
|
|
62
62
|
transform: Matrix4;
|
|
63
|
+
extensions: any;
|
|
63
64
|
|
|
64
65
|
// Container to store application specific data
|
|
65
66
|
userData: {[key: string]: any};
|
|
@@ -168,6 +169,7 @@ export default class TileHeader {
|
|
|
168
169
|
|
|
169
170
|
// Container to store application specific data
|
|
170
171
|
this.userData = {};
|
|
172
|
+
this.extensions = null;
|
|
171
173
|
|
|
172
174
|
// PRIVATE MEMBERS
|
|
173
175
|
this._priority = 0;
|
|
@@ -287,7 +289,7 @@ export default class TileHeader {
|
|
|
287
289
|
getScreenSpaceError(frameState, useParentLodMetric) {
|
|
288
290
|
switch (this.tileset.type) {
|
|
289
291
|
case TILESET_TYPE.I3S:
|
|
290
|
-
return
|
|
292
|
+
return getProjectedRadius(this, frameState);
|
|
291
293
|
case TILESET_TYPE.TILES3D:
|
|
292
294
|
return getTiles3DScreenSpaceError(this, frameState, useParentLodMetric);
|
|
293
295
|
default:
|
|
@@ -80,7 +80,9 @@ export default class TilesetCache {
|
|
|
80
80
|
node !== sentinel &&
|
|
81
81
|
(tileset.gpuMemoryUsageInBytes > maximumMemoryUsageInBytes || trimTiles)
|
|
82
82
|
) {
|
|
83
|
+
// @ts-expect-error
|
|
83
84
|
const tile = node.item;
|
|
85
|
+
// @ts-expect-error
|
|
84
86
|
node = node.next;
|
|
85
87
|
this.unloadTile(tileset, tile, unloadCallback);
|
|
86
88
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {load} from '@loaders.gl/core';
|
|
2
2
|
import TilesetTraverser from './tileset-traverser';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {getLodStatus} from '../helpers/i3s-lod';
|
|
5
5
|
import TileHeader from '../tile-3d';
|
|
6
6
|
import I3STileManager from './i3s-tile-manager';
|
|
7
7
|
|
|
@@ -14,8 +14,7 @@ export default class I3STilesetTraverser extends TilesetTraverser {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
shouldRefine(tile, frameState) {
|
|
17
|
-
|
|
18
|
-
tile._lodJudge = lodJudge(tile, frameState);
|
|
17
|
+
tile._lodJudge = getLodStatus(tile, frameState);
|
|
19
18
|
return tile._lodJudge === 'DIG';
|
|
20
19
|
}
|
|
21
20
|
|