@loaders.gl/tiles 3.1.3 → 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.js +2 -2
- package/dist/bundle.js.map +1 -0
- package/dist/constants.js +26 -29
- package/dist/constants.js.map +1 -0
- package/dist/dist.min.js +45 -264
- package/dist/index.js +10 -28
- package/dist/index.js.map +1 -0
- package/dist/tileset/helpers/3d-tiles-options.js +5 -8
- package/dist/tileset/helpers/3d-tiles-options.js.map +1 -0
- package/dist/tileset/helpers/bounding-volume.js +70 -159
- package/dist/tileset/helpers/bounding-volume.js.map +1 -0
- package/dist/tileset/helpers/frame-state.js +48 -67
- package/dist/tileset/helpers/frame-state.js.map +1 -0
- package/dist/tileset/helpers/i3s-lod.js +64 -80
- package/dist/tileset/helpers/i3s-lod.js.map +1 -0
- package/dist/tileset/helpers/tiles-3d-lod.js +100 -111
- package/dist/tileset/helpers/tiles-3d-lod.js.map +1 -0
- package/dist/tileset/helpers/transform-utils.js +56 -50
- package/dist/tileset/helpers/transform-utils.js.map +1 -0
- package/dist/tileset/helpers/zoom.js +30 -36
- package/dist/tileset/helpers/zoom.js.map +1 -0
- package/dist/tileset/tile-3d.js +533 -551
- package/dist/tileset/tile-3d.js.map +1 -0
- package/dist/tileset/tileset-3d.js +649 -576
- package/dist/tileset/tileset-3d.js.map +1 -0
- package/dist/tileset/tileset-cache.js +71 -71
- package/dist/tileset/tileset-cache.js.map +1 -0
- package/dist/tileset/traversers/i3s-tile-manager.js +40 -31
- package/dist/tileset/traversers/i3s-tile-manager.js.map +1 -0
- package/dist/tileset/traversers/i3s-tileset-traverser.js +76 -81
- package/dist/tileset/traversers/i3s-tileset-traverser.js.map +1 -0
- package/dist/tileset/traversers/tileset-3d-traverser.js +49 -51
- package/dist/tileset/traversers/tileset-3d-traverser.js.map +1 -0
- package/dist/tileset/traversers/tileset-traverser.js +276 -274
- package/dist/tileset/traversers/tileset-traverser.js.map +1 -0
- package/dist/utils/doubly-linked-list-node.js +15 -16
- package/dist/utils/doubly-linked-list-node.js.map +1 -0
- package/dist/utils/doubly-linked-list.js +75 -94
- package/dist/utils/doubly-linked-list.js.map +1 -0
- package/dist/utils/managed-array.js +109 -143
- package/dist/utils/managed-array.js.map +1 -0
- package/package.json +7 -7
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/constants.js +0 -44
- package/dist/es5/constants.js.map +0 -1
- package/dist/es5/index.js +0 -104
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/tileset/helpers/3d-tiles-options.js +0 -13
- package/dist/es5/tileset/helpers/3d-tiles-options.js.map +0 -1
- package/dist/es5/tileset/helpers/bounding-volume.js +0 -114
- package/dist/es5/tileset/helpers/bounding-volume.js.map +0 -1
- package/dist/es5/tileset/helpers/frame-state.js +0 -65
- package/dist/es5/tileset/helpers/frame-state.js.map +0 -1
- package/dist/es5/tileset/helpers/i3s-lod.js +0 -86
- package/dist/es5/tileset/helpers/i3s-lod.js.map +0 -1
- package/dist/es5/tileset/helpers/tiles-3d-lod.js +0 -119
- package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/es5/tileset/helpers/transform-utils.js +0 -65
- package/dist/es5/tileset/helpers/transform-utils.js.map +0 -1
- package/dist/es5/tileset/helpers/zoom.js +0 -43
- package/dist/es5/tileset/helpers/zoom.js.map +0 -1
- package/dist/es5/tileset/tile-3d.js +0 -605
- package/dist/es5/tileset/tile-3d.js.map +0 -1
- package/dist/es5/tileset/tileset-3d.js +0 -838
- package/dist/es5/tileset/tileset-3d.js.map +0 -1
- package/dist/es5/tileset/tileset-cache.js +0 -101
- package/dist/es5/tileset/tileset-cache.js.map +0 -1
- package/dist/es5/tileset/traversers/i3s-tile-manager.js +0 -69
- package/dist/es5/tileset/traversers/i3s-tile-manager.js.map +0 -1
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js +0 -185
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js +0 -94
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js.map +0 -1
- package/dist/es5/tileset/traversers/tileset-traverser.js +0 -377
- package/dist/es5/tileset/traversers/tileset-traverser.js.map +0 -1
- package/dist/es5/utils/doubly-linked-list-node.js +0 -25
- package/dist/es5/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/es5/utils/doubly-linked-list.js +0 -104
- package/dist/es5/utils/doubly-linked-list.js.map +0 -1
- package/dist/es5/utils/managed-array.js +0 -147
- package/dist/es5/utils/managed-array.js.map +0 -1
- package/dist/esm/bundle.js +0 -5
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/constants.js +0 -32
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/index.js +0 -10
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/tileset/helpers/3d-tiles-options.js +0 -6
- package/dist/esm/tileset/helpers/3d-tiles-options.js.map +0 -1
- package/dist/esm/tileset/helpers/bounding-volume.js +0 -88
- package/dist/esm/tileset/helpers/bounding-volume.js.map +0 -1
- package/dist/esm/tileset/helpers/frame-state.js +0 -51
- package/dist/esm/tileset/helpers/frame-state.js.map +0 -1
- package/dist/esm/tileset/helpers/i3s-lod.js +0 -67
- package/dist/esm/tileset/helpers/i3s-lod.js.map +0 -1
- package/dist/esm/tileset/helpers/tiles-3d-lod.js +0 -105
- package/dist/esm/tileset/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/esm/tileset/helpers/transform-utils.js +0 -58
- package/dist/esm/tileset/helpers/transform-utils.js.map +0 -1
- package/dist/esm/tileset/helpers/zoom.js +0 -36
- package/dist/esm/tileset/helpers/zoom.js.map +0 -1
- package/dist/esm/tileset/tile-3d.js +0 -537
- package/dist/esm/tileset/tile-3d.js.map +0 -1
- package/dist/esm/tileset/tileset-3d.js +0 -674
- package/dist/esm/tileset/tileset-3d.js.map +0 -1
- package/dist/esm/tileset/tileset-cache.js +0 -79
- package/dist/esm/tileset/tileset-cache.js.map +0 -1
- package/dist/esm/tileset/traversers/i3s-tile-manager.js +0 -45
- package/dist/esm/tileset/traversers/i3s-tile-manager.js.map +0 -1
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js +0 -80
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
- package/dist/esm/tileset/traversers/tileset-3d-traverser.js +0 -53
- package/dist/esm/tileset/traversers/tileset-3d-traverser.js.map +0 -1
- package/dist/esm/tileset/traversers/tileset-traverser.js +0 -296
- package/dist/esm/tileset/traversers/tileset-traverser.js.map +0 -1
- package/dist/esm/utils/doubly-linked-list-node.js +0 -16
- package/dist/esm/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/esm/utils/doubly-linked-list.js +0 -81
- package/dist/esm/utils/doubly-linked-list.js.map +0 -1
- package/dist/esm/utils/managed-array.js +0 -117
- package/dist/esm/utils/managed-array.js.map +0 -1
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var _loaderUtils = require("@loaders.gl/loader-utils");
|
|
17
|
-
|
|
18
|
-
var ManagedArray = function () {
|
|
19
|
-
function ManagedArray() {
|
|
20
|
-
var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
21
|
-
(0, _classCallCheck2.default)(this, ManagedArray);
|
|
22
|
-
(0, _defineProperty2.default)(this, "_map", new Map());
|
|
23
|
-
(0, _defineProperty2.default)(this, "_array", void 0);
|
|
24
|
-
(0, _defineProperty2.default)(this, "_length", void 0);
|
|
25
|
-
this._array = new Array(length);
|
|
26
|
-
this._length = length;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
(0, _createClass2.default)(ManagedArray, [{
|
|
30
|
-
key: "length",
|
|
31
|
-
get: function get() {
|
|
32
|
-
return this._length;
|
|
33
|
-
},
|
|
34
|
-
set: function set(length) {
|
|
35
|
-
this._length = length;
|
|
36
|
-
|
|
37
|
-
if (length > this._array.length) {
|
|
38
|
-
this._array.length = length;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "values",
|
|
43
|
-
get: function get() {
|
|
44
|
-
return this._array;
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
key: "get",
|
|
48
|
-
value: function get(index) {
|
|
49
|
-
(0, _loaderUtils.assert)(index < this._array.length);
|
|
50
|
-
return this._array[index];
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
key: "set",
|
|
54
|
-
value: function set(index, element) {
|
|
55
|
-
(0, _loaderUtils.assert)(index >= 0);
|
|
56
|
-
|
|
57
|
-
if (index >= this.length) {
|
|
58
|
-
this.length = index + 1;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (this._map.has(this._array[index])) {
|
|
62
|
-
this._map.delete(this._array[index]);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
this._array[index] = element;
|
|
66
|
-
|
|
67
|
-
this._map.set(element, index);
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
key: "delete",
|
|
71
|
-
value: function _delete(element) {
|
|
72
|
-
var index = this._map.get(element);
|
|
73
|
-
|
|
74
|
-
if (index >= 0) {
|
|
75
|
-
this._array.splice(index, 1);
|
|
76
|
-
|
|
77
|
-
this._map.delete(element);
|
|
78
|
-
|
|
79
|
-
this.length--;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
key: "peek",
|
|
84
|
-
value: function peek() {
|
|
85
|
-
return this._array[this._length - 1];
|
|
86
|
-
}
|
|
87
|
-
}, {
|
|
88
|
-
key: "push",
|
|
89
|
-
value: function push(element) {
|
|
90
|
-
if (!this._map.has(element)) {
|
|
91
|
-
var index = this.length++;
|
|
92
|
-
this._array[index] = element;
|
|
93
|
-
|
|
94
|
-
this._map.set(element, index);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}, {
|
|
98
|
-
key: "pop",
|
|
99
|
-
value: function pop() {
|
|
100
|
-
var element = this._array[--this.length];
|
|
101
|
-
|
|
102
|
-
this._map.delete(element);
|
|
103
|
-
|
|
104
|
-
return element;
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
key: "reserve",
|
|
108
|
-
value: function reserve(length) {
|
|
109
|
-
(0, _loaderUtils.assert)(length >= 0);
|
|
110
|
-
|
|
111
|
-
if (length > this._array.length) {
|
|
112
|
-
this._array.length = length;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}, {
|
|
116
|
-
key: "resize",
|
|
117
|
-
value: function resize(length) {
|
|
118
|
-
(0, _loaderUtils.assert)(length >= 0);
|
|
119
|
-
this.length = length;
|
|
120
|
-
}
|
|
121
|
-
}, {
|
|
122
|
-
key: "trim",
|
|
123
|
-
value: function trim(length) {
|
|
124
|
-
if (length === null || length === undefined) {
|
|
125
|
-
length = this.length;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
this._array.length = length;
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
key: "reset",
|
|
132
|
-
value: function reset() {
|
|
133
|
-
this._array = [];
|
|
134
|
-
this._map = new Map();
|
|
135
|
-
this._length = 0;
|
|
136
|
-
}
|
|
137
|
-
}, {
|
|
138
|
-
key: "find",
|
|
139
|
-
value: function find(target) {
|
|
140
|
-
return this._map.has(target);
|
|
141
|
-
}
|
|
142
|
-
}]);
|
|
143
|
-
return ManagedArray;
|
|
144
|
-
}();
|
|
145
|
-
|
|
146
|
-
exports.default = ManagedArray;
|
|
147
|
-
//# sourceMappingURL=managed-array.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/managed-array.ts"],"names":["ManagedArray","length","Map","_array","Array","_length","index","element","_map","has","delete","set","get","splice","undefined","target"],"mappings":";;;;;;;;;;;;;;;AAGA;;IAWqBA,Y;AAKnB,0BAAwB;AAAA,QAAZC,MAAY,uEAAH,CAAG;AAAA;AAAA,gDAJjB,IAAIC,GAAJ,EAIiB;AAAA;AAAA;AACtB,SAAKC,MAAL,GAAc,IAAIC,KAAJ,CAAUH,MAAV,CAAd;AACA,SAAKI,OAAL,GAAeJ,MAAf;AACD;;;;SASD,eAAa;AACX,aAAO,KAAKI,OAAZ;AACD,K;SAED,aAAWJ,MAAX,EAAmB;AACjB,WAAKI,OAAL,GAAeJ,MAAf;;AACA,UAAIA,MAAM,GAAG,KAAKE,MAAL,CAAYF,MAAzB,EAAiC;AAC/B,aAAKE,MAAL,CAAYF,MAAZ,GAAqBA,MAArB;AACD;AACF;;;SASD,eAAa;AACX,aAAO,KAAKE,MAAZ;AACD;;;WAOD,aAAIG,KAAJ,EAAW;AACT,+BAAOA,KAAK,GAAG,KAAKH,MAAL,CAAYF,MAA3B;AACA,aAAO,KAAKE,MAAL,CAAYG,KAAZ,CAAP;AACD;;;WAQD,aAAIA,KAAJ,EAAWC,OAAX,EAAoB;AAClB,+BAAOD,KAAK,IAAI,CAAhB;;AAEA,UAAIA,KAAK,IAAI,KAAKL,MAAlB,EAA0B;AACxB,aAAKA,MAAL,GAAcK,KAAK,GAAG,CAAtB;AACD;;AAED,UAAI,KAAKE,IAAL,CAAUC,GAAV,CAAc,KAAKN,MAAL,CAAYG,KAAZ,CAAd,CAAJ,EAAuC;AACrC,aAAKE,IAAL,CAAUE,MAAV,CAA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AAKA,MAAL,EAAa;AACX,UAAIA,MAAM,KAAK,IAAX,IAAmBA,MAAM,KAAKa,SAAlC,EAA6C;AAC3Cb,QAAAA,MAAM,GAAG,KAAKA,MAAd;AACD;;AACD,WAAKE,MAAL,CAAYF,MAAZ,GAAqBA,MAArB;AACD;;;WAED,iBAAQ;AACN,WAAKE,MAAL,GAAc,EAAd;AACA,WAAKK,IAAL,GAAY,IAAIN,GAAJ,EAAZ;AACA,WAAKG,OAAL,GAAe,CAAf;AACD;;;WAED,cAAKU,MAAL,EAAa;AACX,aAAO,KAAKP,IAAL,CAAUC,GAAV,CAAcM,MAAd,CAAP;AACD","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/dist/esm/bundle.js
DELETED
package/dist/esm/bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
|
package/dist/esm/constants.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export const TILE_CONTENT_STATE = {
|
|
2
|
-
UNLOADED: 0,
|
|
3
|
-
LOADING: 1,
|
|
4
|
-
PROCESSING: 2,
|
|
5
|
-
READY: 3,
|
|
6
|
-
EXPIRED: 4,
|
|
7
|
-
FAILED: 5
|
|
8
|
-
};
|
|
9
|
-
export const TILE_REFINEMENT = {
|
|
10
|
-
ADD: 1,
|
|
11
|
-
REPLACE: 2
|
|
12
|
-
};
|
|
13
|
-
export const TILE_TYPE = {
|
|
14
|
-
EMPTY: 'empty',
|
|
15
|
-
SCENEGRAPH: 'scenegraph',
|
|
16
|
-
POINTCLOUD: 'pointcloud',
|
|
17
|
-
MESH: 'mesh'
|
|
18
|
-
};
|
|
19
|
-
export const TILESET_TYPE = {
|
|
20
|
-
I3S: 'I3S',
|
|
21
|
-
TILES3D: 'TILES3D'
|
|
22
|
-
};
|
|
23
|
-
export const LOD_METRIC_TYPE = {
|
|
24
|
-
GEOMETRIC_ERROR: 'geometricError',
|
|
25
|
-
MAX_SCREEN_THRESHOLD: 'maxScreenThreshold'
|
|
26
|
-
};
|
|
27
|
-
export const TILE3D_OPTIMIZATION_HINT = {
|
|
28
|
-
NOT_COMPUTED: -1,
|
|
29
|
-
USE_OPTIMIZATION: 1,
|
|
30
|
-
SKIP_OPTIMIZATION: 0
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants.ts"],"names":["TILE_CONTENT_STATE","UNLOADED","LOADING","PROCESSING","READY","EXPIRED","FAILED","TILE_REFINEMENT","ADD","REPLACE","TILE_TYPE","EMPTY","SCENEGRAPH","POINTCLOUD","MESH","TILESET_TYPE","I3S","TILES3D","LOD_METRIC_TYPE","GEOMETRIC_ERROR","MAX_SCREEN_THRESHOLD","TILE3D_OPTIMIZATION_HINT","NOT_COMPUTED","USE_OPTIMIZATION","SKIP_OPTIMIZATION"],"mappings":"AAAA,OAAO,MAAMA,kBAAkB,GAAG;AAChCC,EAAAA,QAAQ,EAAE,CADsB;AAEhCC,EAAAA,OAAO,EAAE,CAFuB;AAGhCC,EAAAA,UAAU,EAAE,CAHoB;AAIhCC,EAAAA,KAAK,EAAE,CAJyB;AAKhCC,EAAAA,OAAO,EAAE,CALuB;AAMhCC,EAAAA,MAAM,EAAE;AANwB,CAA3B;AASP,OAAO,MAAMC,eAAe,GAAG;AAC7BC,EAAAA,GAAG,EAAE,CADwB;AAE7BC,EAAAA,OAAO,EAAE;AAFoB,CAAxB;AAKP,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,KAAK,EAAE,OADgB;AAEvBC,EAAAA,UAAU,EAAE,YAFW;AAGvBC,EAAAA,UAAU,EAAE,YAHW;AAIvBC,EAAAA,IAAI,EAAE;AAJiB,CAAlB;AAOP,OAAO,MAAMC,YAAY,GAAG;AAC1BC,EAAAA,GAAG,EAAE,KADqB;AAE1BC,EAAAA,OAAO,EAAE;AAFiB,CAArB;AAKP,OAAO,MAAMC,eAAe,GAAG;AAC7BC,EAAAA,eAAe,EAAE,gBADY;AAE7BC,EAAAA,oBAAoB,EAAE;AAFO,CAAxB;AAMP,OAAO,MAAMC,wBAAwB,GAAG;AACtCC,EAAAA,YAAY,EAAE,CAAC,CADuB;AAEtCC,EAAAA,gBAAgB,EAAE,CAFoB;AAGtCC,EAAAA,iBAAiB,EAAE;AAHmB,CAAjC","sourcesContent":["export const TILE_CONTENT_STATE = {\n UNLOADED: 0, // Has never been requested\n LOADING: 1, // Is waiting on a pending request\n PROCESSING: 2, // Request received. Contents are being processed for rendering. Depending on the content, it might make its own requests for external data.\n READY: 3, // Ready to render.\n EXPIRED: 4, // Is expired and will be unloaded once new content is loaded.\n FAILED: 5 // Request failed.\n};\n\nexport const TILE_REFINEMENT = {\n ADD: 1, // Render tile and, if screen space error exceeded, also refine to its children.\n REPLACE: 2 // Render tile or, if screen space error exceeded, refine to its descendants instead.\n};\n\nexport const TILE_TYPE = {\n EMPTY: 'empty',\n SCENEGRAPH: 'scenegraph',\n POINTCLOUD: 'pointcloud',\n MESH: 'mesh'\n};\n\nexport const TILESET_TYPE = {\n I3S: 'I3S',\n TILES3D: 'TILES3D'\n};\n\nexport const LOD_METRIC_TYPE = {\n GEOMETRIC_ERROR: 'geometricError',\n MAX_SCREEN_THRESHOLD: 'maxScreenThreshold'\n};\n\n// Cesium 3D Tiles Specific\nexport const TILE3D_OPTIMIZATION_HINT = {\n NOT_COMPUTED: -1,\n USE_OPTIMIZATION: 1,\n SKIP_OPTIMIZATION: 0\n};\n"],"file":"constants.js"}
|
package/dist/esm/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { default as Tileset3D } from './tileset/tileset-3d';
|
|
2
|
-
export { default as Tile3D } from './tileset/tile-3d';
|
|
3
|
-
export { default as TilesetTraverser } from './tileset/traversers/tileset-traverser';
|
|
4
|
-
export { default as TilesetCache } from './tileset/tileset-cache';
|
|
5
|
-
export { createBoundingVolume } from './tileset/helpers/bounding-volume';
|
|
6
|
-
export { calculateTransformProps } from './tileset/helpers/transform-utils';
|
|
7
|
-
export { getFrameState } from './tileset/helpers/frame-state';
|
|
8
|
-
export { getLodStatus } from './tileset/helpers/i3s-lod';
|
|
9
|
-
export { TILE_CONTENT_STATE, TILE_REFINEMENT, TILE_TYPE, TILESET_TYPE, LOD_METRIC_TYPE } from './constants';
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":["default","Tileset3D","Tile3D","TilesetTraverser","TilesetCache","createBoundingVolume","calculateTransformProps","getFrameState","getLodStatus","TILE_CONTENT_STATE","TILE_REFINEMENT","TILE_TYPE","TILESET_TYPE","LOD_METRIC_TYPE"],"mappings":"AACA,SAAQA,OAAO,IAAIC,SAAnB,QAAmC,sBAAnC;AACA,SAAQD,OAAO,IAAIE,MAAnB,QAAgC,mBAAhC;AAEA,SAAQF,OAAO,IAAIG,gBAAnB,QAA0C,wCAA1C;AACA,SAAQH,OAAO,IAAII,YAAnB,QAAsC,yBAAtC;AAEA,SAAQC,oBAAR,QAAmC,mCAAnC;AACA,SAAQC,uBAAR,QAAsC,mCAAtC;AAEA,SAAQC,aAAR,QAA4B,+BAA5B;AACA,SAAQC,YAAR,QAA2B,2BAA3B;AAEA,SACEC,kBADF,EAEEC,eAFF,EAGEC,SAHF,EAIEC,YAJF,EAKEC,eALF,QAMO,aANP","sourcesContent":["export type {Tileset3DProps} from './tileset/tileset-3d';\nexport {default as Tileset3D} from './tileset/tileset-3d';\nexport {default as Tile3D} from './tileset/tile-3d';\n\nexport {default as TilesetTraverser} from './tileset/traversers/tileset-traverser';\nexport {default as TilesetCache} from './tileset/tileset-cache';\n\nexport {createBoundingVolume} from './tileset/helpers/bounding-volume';\nexport {calculateTransformProps} from './tileset/helpers/transform-utils';\n\nexport {getFrameState} from './tileset/helpers/frame-state';\nexport {getLodStatus} from './tileset/helpers/i3s-lod';\n\nexport {\n TILE_CONTENT_STATE,\n TILE_REFINEMENT,\n TILE_TYPE,\n TILESET_TYPE,\n LOD_METRIC_TYPE\n} from './constants';\n"],"file":"index.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tileset/helpers/3d-tiles-options.ts"],"names":["get3dTilesOptions","tileset","assetGltfUpAxis","asset","gltfUpAxis"],"mappings":"AAAA,OAAO,SAASA,iBAAT,CAA2BC,OAA3B,EAAoC;AACzC,SAAO;AACLC,IAAAA,eAAe,EAAGD,OAAO,CAACE,KAAR,IAAiBF,OAAO,CAACE,KAAR,CAAcC,UAAhC,IAA+C;AAD3D,GAAP;AAGD","sourcesContent":["export function get3dTilesOptions(tileset) {\n return {\n assetGltfUpAxis: (tileset.asset && tileset.asset.gltfUpAxis) || 'Y'\n };\n}\n"],"file":"3d-tiles-options.js"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { Quaternion, Vector3, Matrix3, Matrix4, degrees } from '@math.gl/core';
|
|
2
|
-
import { BoundingSphere, OrientedBoundingBox } from '@math.gl/culling';
|
|
3
|
-
import { Ellipsoid } from '@math.gl/geospatial';
|
|
4
|
-
import { assert } from '@loaders.gl/loader-utils';
|
|
5
|
-
|
|
6
|
-
function defined(x) {
|
|
7
|
-
return x !== undefined && x !== null;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const scratchScale = new Vector3();
|
|
11
|
-
const scratchNorthWest = new Vector3();
|
|
12
|
-
const scratchSouthEast = new Vector3();
|
|
13
|
-
export function createBoundingVolume(boundingVolumeHeader, transform, result) {
|
|
14
|
-
assert(boundingVolumeHeader, '3D Tile: boundingVolume must be defined');
|
|
15
|
-
|
|
16
|
-
if (boundingVolumeHeader.box) {
|
|
17
|
-
return createBox(boundingVolumeHeader.box, transform, result);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (boundingVolumeHeader.region) {
|
|
21
|
-
const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;
|
|
22
|
-
const northWest = Ellipsoid.WGS84.cartographicToCartesian([degrees(west), degrees(north), minHeight], scratchNorthWest);
|
|
23
|
-
const southEast = Ellipsoid.WGS84.cartographicToCartesian([degrees(east), degrees(south), maxHeight], scratchSouthEast);
|
|
24
|
-
const centerInCartesian = new Vector3().addVectors(northWest, southEast).multiplyScalar(0.5);
|
|
25
|
-
const radius = new Vector3().subVectors(northWest, southEast).len() / 2.0;
|
|
26
|
-
return createSphere([centerInCartesian[0], centerInCartesian[1], centerInCartesian[2], radius], new Matrix4());
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (boundingVolumeHeader.sphere) {
|
|
30
|
-
return createSphere(boundingVolumeHeader.sphere, transform, result);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
throw new Error('3D Tile: boundingVolume must contain a sphere, region, or box');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function createBox(box, transform, result) {
|
|
37
|
-
const center = new Vector3(box[0], box[1], box[2]);
|
|
38
|
-
transform.transform(center, center);
|
|
39
|
-
let origin = [];
|
|
40
|
-
|
|
41
|
-
if (box.length === 10) {
|
|
42
|
-
const halfSize = box.slice(3, 6);
|
|
43
|
-
const quaternion = new Quaternion();
|
|
44
|
-
quaternion.fromArray(box, 6);
|
|
45
|
-
const x = new Vector3([1, 0, 0]);
|
|
46
|
-
const y = new Vector3([0, 1, 0]);
|
|
47
|
-
const z = new Vector3([0, 0, 1]);
|
|
48
|
-
x.transformByQuaternion(quaternion);
|
|
49
|
-
x.scale(halfSize[0]);
|
|
50
|
-
y.transformByQuaternion(quaternion);
|
|
51
|
-
y.scale(halfSize[1]);
|
|
52
|
-
z.transformByQuaternion(quaternion);
|
|
53
|
-
z.scale(halfSize[2]);
|
|
54
|
-
origin = [...x.toArray(), ...y.toArray(), ...z.toArray()];
|
|
55
|
-
} else {
|
|
56
|
-
origin = [...box.slice(3, 6), ...box.slice(6, 9), ...box.slice(9, 12)];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const xAxis = transform.transformAsVector(origin.slice(0, 3));
|
|
60
|
-
const yAxis = transform.transformAsVector(origin.slice(3, 6));
|
|
61
|
-
const zAxis = transform.transformAsVector(origin.slice(6, 9));
|
|
62
|
-
const halfAxes = new Matrix3([xAxis[0], xAxis[1], xAxis[2], yAxis[0], yAxis[1], yAxis[2], zAxis[0], zAxis[1], zAxis[2]]);
|
|
63
|
-
|
|
64
|
-
if (defined(result)) {
|
|
65
|
-
result.center = center;
|
|
66
|
-
result.halfAxes = halfAxes;
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return new OrientedBoundingBox(center, halfAxes);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function createSphere(sphere, transform, result) {
|
|
74
|
-
const center = new Vector3(sphere[0], sphere[1], sphere[2]);
|
|
75
|
-
transform.transform(center, center);
|
|
76
|
-
const scale = transform.getScale(scratchScale);
|
|
77
|
-
const uniformScale = Math.max(Math.max(scale[0], scale[1]), scale[2]);
|
|
78
|
-
const radius = sphere[3] * uniformScale;
|
|
79
|
-
|
|
80
|
-
if (defined(result)) {
|
|
81
|
-
result.center = center;
|
|
82
|
-
result.radius = radius;
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return new BoundingSphere(center, radius);
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=bounding-volume.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tileset/helpers/bounding-volume.ts"],"names":["Quaternion","Vector3","Matrix3","Matrix4","degrees","BoundingSphere","OrientedBoundingBox","Ellipsoid","assert","defined","x","undefined","scratchScale","scratchNorthWest","scratchSouthEast","createBoundingVolume","boundingVolumeHeader","transform","result","box","createBox","region","west","south","east","north","minHeight","maxHeight","northWest","WGS84","cartographicToCartesian","southEast","centerInCartesian","addVectors","multiplyScalar","radius","subVectors","len","createSphere","sphere","Error","center","origin","length","halfSize","slice","quaternion","fromArray","y","z","transformByQuaternion","scale","toArray","xAxis","transformAsVector","yAxis","zAxis","halfAxes","getScale","uniformScale","Math","max"],"mappings":"AAIA,SAAQA,UAAR,EAAoBC,OAApB,EAA6BC,OAA7B,EAAsCC,OAAtC,EAA+CC,OAA/C,QAA6D,eAA7D;AACA,SAAQC,cAAR,EAAwBC,mBAAxB,QAAkD,kBAAlD;AACA,SAAQC,SAAR,QAAwB,qBAAxB;AACA,SAAQC,MAAR,QAAqB,0BAArB;;AAIA,SAASC,OAAT,CAAiBC,CAAjB,EAAoB;AAClB,SAAOA,CAAC,KAAKC,SAAN,IAAmBD,CAAC,KAAK,IAAhC;AACD;;AAG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,cAAJ,CAAmBoC,MAAnB,EAA2BN,MAA3B,CAAP;AACD","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/* eslint-disable */\nimport {Quaternion, Vector3, Matrix3, Matrix4, degrees} from '@math.gl/core';\nimport {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {assert} from '@loaders.gl/loader-utils';\n\n// const scratchProjectedBoundingSphere = new BoundingSphere();\n\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\n\n// const scratchMatrix = new Matrix3();\nconst scratchScale = new Vector3();\nconst scratchNorthWest = new Vector3();\nconst scratchSouthEast = new Vector3();\n// const scratchRectangle = new Rectangle();\n// const scratchOrientedBoundingBox = new OrientedBoundingBox();\n// const scratchTransform = new Matrix4();\n\n/**\n * Create a bounding volume from the tile's bounding volume header.\n * @param {Object} boundingVolumeHeader The tile's bounding volume header.\n * @param {Matrix4} transform The transform to apply to the bounding volume.\n * @param [result] The object onto which to store the result.\n * @returns The modified result parameter or a new TileBoundingVolume instance if none was provided.\n */\nexport function createBoundingVolume(boundingVolumeHeader, transform, result) {\n assert(boundingVolumeHeader, '3D Tile: boundingVolume must be defined');\n\n // boundingVolume schema:\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/specification/schema/boundingVolume.schema.json\n if (boundingVolumeHeader.box) {\n return createBox(boundingVolumeHeader.box, transform, result);\n }\n if (boundingVolumeHeader.region) {\n // [west, south, east, north, minimum height, maximum height]\n // Latitudes and longitudes are in the WGS 84 datum as defined in EPSG 4979 and are in radians.\n // Heights are in meters above (or below) the WGS 84 ellipsoid.\n const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;\n\n const northWest = Ellipsoid.WGS84.cartographicToCartesian(\n [degrees(west), degrees(north), minHeight],\n scratchNorthWest\n );\n const southEast = Ellipsoid.WGS84.cartographicToCartesian(\n [degrees(east), degrees(south), maxHeight],\n scratchSouthEast\n );\n const centerInCartesian = new Vector3().addVectors(northWest, southEast).multiplyScalar(0.5);\n const radius = new Vector3().subVectors(northWest, southEast).len() / 2.0;\n\n // TODO improve region boundingVolume\n // for now, create a sphere as the boundingVolume instead of box\n return createSphere(\n [centerInCartesian[0], centerInCartesian[1], centerInCartesian[2], radius],\n new Matrix4()\n );\n }\n\n if (boundingVolumeHeader.sphere) {\n return createSphere(boundingVolumeHeader.sphere, transform, result);\n }\n\n throw new Error('3D Tile: boundingVolume must contain a sphere, region, or box');\n}\n\nfunction createBox(box, transform, result) {\n // https://math.gl/modules/culling/docs/api-reference/oriented-bounding-box\n // 1. A half-axes based representation.\n // box: An array of 12 numbers that define an oriented bounding box.\n // The first three elements define the x, y, and z values for the center of the box.\n // The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length.\n // The next three elements (indices 6, 7, and 8) define the y axis direction and half-length.\n // The last three elements (indices 9, 10, and 11) define the z axis direction and half-length.\n // 2. A half-size-quaternion based representation.\n // box: An array of 10 numbers that define an oriented bounding box.\n // The first three elements define the x, y, and z values for the center of the box in a right-handed 3-axis (x, y, z) Cartesian coordinate system where the z-axis is up.\n // The next three elements (with indices 3, 4, and 5) define the halfSize.\n // The last four elements (indices 6, 7, 8 and 10) define the quaternion.\n const center = new Vector3(box[0], box[1], box[2]);\n transform.transform(center, center);\n let origin: number[] = [];\n if (box.length === 10) {\n const halfSize = box.slice(3, 6);\n const quaternion = new Quaternion();\n quaternion.fromArray(box, 6);\n const x = new Vector3([1, 0, 0]);\n const y = new Vector3([0, 1, 0]);\n const z = new Vector3([0, 0, 1]);\n x.transformByQuaternion(quaternion);\n x.scale(halfSize[0]);\n y.transformByQuaternion(quaternion);\n y.scale(halfSize[1]);\n z.transformByQuaternion(quaternion);\n z.scale(halfSize[2]);\n origin = [...x.toArray(), ...y.toArray(), ...z.toArray()];\n } else {\n origin = [...box.slice(3, 6), ...box.slice(6, 9), ...box.slice(9, 12)];\n }\n const xAxis = transform.transformAsVector(origin.slice(0, 3));\n const yAxis = transform.transformAsVector(origin.slice(3, 6));\n const zAxis = transform.transformAsVector(origin.slice(6, 9));\n const halfAxes = new Matrix3([\n xAxis[0],\n xAxis[1],\n xAxis[2],\n yAxis[0],\n yAxis[1],\n yAxis[2],\n zAxis[0],\n zAxis[1],\n zAxis[2]\n ]);\n\n if (defined(result)) {\n result.center = center;\n result.halfAxes = halfAxes;\n return result;\n }\n\n return new OrientedBoundingBox(center, halfAxes);\n}\n\n/*\nfunction createBoxFromTransformedRegion(region, transform, initialTransform, result) {\n const rectangle = Rectangle.unpack(region, 0, scratchRectangle);\n const minimumHeight = region[4];\n const maximumHeight = region[5];\n\n const orientedBoundingBox = OrientedBoundingBox.fromRectangle(\n rectangle,\n minimumHeight,\n maximumHeight,\n Ellipsoid.WGS84,\n scratchOrientedBoundingBox\n );\n const center = orientedBoundingBox.center;\n const halfAxes = orientedBoundingBox.halfAxes;\n\n // A region bounding volume is not transformed by the transform in the tileset JSON,\n // but may be transformed by additional transforms applied in Cesium.\n // This is why the transform is calculated as the difference between the initial transform and the current transform.\n transform = Matrix4.multiplyTransformation(\n transform,\n Matrix4.inverseTransformation(initialTransform, scratchTransform),\n scratchTransform\n );\n center = Matrix4.multiplyByPoint(transform, center, center);\n const rotationScale = Matrix4.getRotation(transform, scratchMatrix);\n halfAxes = Matrix3.multiply(rotationScale, halfAxes, halfAxes);\n\n if (defined(result) && result instanceof TileOrientedBoundingBox) {\n result.update(center, halfAxes);\n return result;\n }\n\n return new TileOrientedBoundingBox(center, halfAxes);\n}\n\nfunction createRegion(region, transform, initialTransform, result) {\n if (!Matrix4.equalsEpsilon(transform, initialTransform, CesiumMath.EPSILON8)) {\n return createBoxFromTransformedRegion(region, transform, initialTransform, result);\n }\n\n if (defined(result)) {\n return result;\n }\n\n const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);\n\n return new TileBoundingRegion({\n rectangle: rectangleRegion,\n minimumHeight: region[4],\n maximumHeight: region[5]\n });\n}\n*/\n\nfunction createSphere(sphere, transform, result?) {\n // Find the transformed center\n const center = new Vector3(sphere[0], sphere[1], sphere[2]);\n transform.transform(center, center);\n const scale = transform.getScale(scratchScale);\n\n const uniformScale = Math.max(Math.max(scale[0], scale[1]), scale[2]);\n const radius = sphere[3] * uniformScale;\n\n if (defined(result)) {\n result.center = center;\n result.radius = radius;\n return result;\n }\n\n return new BoundingSphere(center, radius);\n}\n"],"file":"bounding-volume.js"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Vector3 } from '@math.gl/core';
|
|
2
|
-
import { CullingVolume, Plane } from '@math.gl/culling';
|
|
3
|
-
import { Ellipsoid } from '@math.gl/geospatial';
|
|
4
|
-
const scratchVector = new Vector3();
|
|
5
|
-
const scratchPosition = new Vector3();
|
|
6
|
-
const cullingVolume = new CullingVolume([new Plane(), new Plane(), new Plane(), new Plane(), new Plane(), new Plane()]);
|
|
7
|
-
export function getFrameState(viewport, frameNumber) {
|
|
8
|
-
const {
|
|
9
|
-
cameraDirection,
|
|
10
|
-
cameraUp,
|
|
11
|
-
height
|
|
12
|
-
} = viewport;
|
|
13
|
-
const {
|
|
14
|
-
metersPerUnit
|
|
15
|
-
} = viewport.distanceScales;
|
|
16
|
-
const viewportCenterCartographic = viewport.unprojectPosition(viewport.center);
|
|
17
|
-
const viewportCenterCartesian = Ellipsoid.WGS84.cartographicToCartesian(viewportCenterCartographic, new Vector3());
|
|
18
|
-
const enuToFixedTransform = Ellipsoid.WGS84.eastNorthUpToFixedFrame(viewportCenterCartesian);
|
|
19
|
-
const cameraPositionCartographic = viewport.unprojectPosition(viewport.cameraPosition);
|
|
20
|
-
const cameraPositionCartesian = Ellipsoid.WGS84.cartographicToCartesian(cameraPositionCartographic, new Vector3());
|
|
21
|
-
const cameraDirectionCartesian = new Vector3(enuToFixedTransform.transformAsVector(new Vector3(cameraDirection).scale(metersPerUnit))).normalize();
|
|
22
|
-
const cameraUpCartesian = new Vector3(enuToFixedTransform.transformAsVector(new Vector3(cameraUp).scale(metersPerUnit))).normalize();
|
|
23
|
-
commonSpacePlanesToWGS84(viewport, viewportCenterCartesian);
|
|
24
|
-
return {
|
|
25
|
-
camera: {
|
|
26
|
-
position: cameraPositionCartesian,
|
|
27
|
-
direction: cameraDirectionCartesian,
|
|
28
|
-
up: cameraUpCartesian
|
|
29
|
-
},
|
|
30
|
-
viewport,
|
|
31
|
-
height,
|
|
32
|
-
cullingVolume,
|
|
33
|
-
frameNumber,
|
|
34
|
-
sseDenominator: 1.15
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function commonSpacePlanesToWGS84(viewport, viewportCenterCartesian) {
|
|
39
|
-
const frustumPlanes = viewport.getFrustumPlanes();
|
|
40
|
-
let i = 0;
|
|
41
|
-
|
|
42
|
-
for (const dir in frustumPlanes) {
|
|
43
|
-
const plane = frustumPlanes[dir];
|
|
44
|
-
const distanceToCenter = plane.normal.dot(viewport.center);
|
|
45
|
-
scratchPosition.copy(plane.normal).scale(plane.distance - distanceToCenter).add(viewport.center);
|
|
46
|
-
const cartographicPos = viewport.unprojectPosition(scratchPosition);
|
|
47
|
-
const cartesianPos = Ellipsoid.WGS84.cartographicToCartesian(cartographicPos, new Vector3());
|
|
48
|
-
cullingVolume.planes[i++].fromPointNormal(cartesianPos, scratchVector.copy(viewportCenterCartesian).subtract(cartesianPos));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=frame-state.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tileset/helpers/frame-state.ts"],"names":["Vector3","CullingVolume","Plane","Ellipsoid","scratchVector","scratchPosition","cullingVolume","getFrameState","viewport","frameNumber","cameraDirection","cameraUp","height","metersPerUnit","distanceScales","viewportCenterCartographic","unprojectPosition","center","viewportCenterCartesian","WGS84","cartographicToCartesian","enuToFixedTransform","eastNorthUpToFixedFrame","cameraPositionCartographic","cameraPosition","cameraPositionCartesian","cameraDirectionCartesian","transformAsVector","scale","normalize","cameraUpCartesian","commonSpacePlanesToWGS84","camera","position","direction","up","sseDenominator","frustumPlanes","getFrustumPlanes","i","dir","plane","distanceToCenter","normal","dot","copy","distance","add","cartographicPos","cartesianPos","planes","fromPointNormal","subtract"],"mappings":"AAAA,SAAQA,OAAR,QAAsB,eAAtB;AACA,SAAQC,aAAR,EAAuBC,KAAvB,QAAmC,kBAAnC;AACA,SAAQC,SAAR,QAAwB,qBAAxB;AAeA,MAAMC,aAAa,GAAG,IAAIJ,OAAJ,EAAtB;AACA,MAAMK,eAAe,GAAG,IAAIL,OAAJ,EAAxB;AACA,MAAMM,aAAa,GAAG,IAAIL,aAAJ,CAAkB,CACtC,IAAIC,KAAJ,EADsC,EAEtC,IAAIA,KAAJ,EAFsC,EAGtC,IAAIA,KAAJ,EAHsC,EAItC,IAAIA,KAAJ,EAJsC,EAKtC,IAAIA,KAAJ,EALsC,EAMtC,IAAIA,KAAJ,EANsC,CAAlB,CAAtB;AAWA,OAAO,SAASK,aAAT,CAAuBC,QAAvB,EAAiCC,WAAjC,EAAkE;AAEvE,QAAM;AAACC,IAAAA,eAAD;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAsCJ,QAA5C;AACA,QAAM;AAACK,IAAAA;AAAD,MAAkBL,QAAQ,CAACM,cAAjC;AAEA,QAAMC,0BAA0B,GAAGP,QAAQ,CAACQ,iBAAT,CAA2BR,QAAQ,CAACS,MAApC,CAAnC;AAGA,QAAMC,uBAAuB,GAAGf,SAAS,CAACgB,KAAV,CAAgBC,uBAAhB,CAC9BL,0BAD8B,EAE9B,IAAIf,OAAJ,EAF8B,CAAhC;AAIA,QAAMqB,mBAAmB,GAAGlB,SAAS,CAACgB,KAAV,CAAgBG,uBAAhB,CAAwCJ,uBAAxC,CAA5B;AAEA,QAAMK,0BAA0B,GAAGf,QAAQ,CAACQ,iBAAT,CAA2BR,QAAQ,CAACgB,cAApC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FH,CAESa,KAAK,CAACK,QAAN,GAAiBJ,gBAF1B,EAGGK,GAHH,CAGOvC,QAAQ,CAACS,MAHhB;AAIA,UAAM+B,eAAe,GAAGxC,QAAQ,CAACQ,iBAAT,CAA2BX,eAA3B,CAAxB;AAEA,UAAM4C,YAAY,GAAG9C,SAAS,CAACgB,KAAV,CAAgBC,uBAAhB,CAAwC4B,eAAxC,EAAyD,IAAIhD,OAAJ,EAAzD,CAArB;AAEAM,IAAAA,aAAa,CAAC4C,MAAd,CAAqBX,CAAC,EAAtB,EAA0BY,eAA1B,CACEF,YADF,EAGE7C,aAAa,CAACyC,IAAd,CAAmB3B,uBAAnB,EAA4CkC,QAA5C,CAAqDH,YAArD,CAHF;AAKD;AACF","sourcesContent":["import {Vector3} from '@math.gl/core';\nimport {CullingVolume, Plane} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\n\nexport type FrameState = {\n camera: {\n position: number[];\n direction: number[];\n up: number[];\n };\n viewport: {[key: string]: any};\n height: number;\n cullingVolume: CullingVolume;\n frameNumber: number; // TODO: This can be the same between updates, what number is unique for between updates?\n sseDenominator: number; // Assumes fovy = 60 degrees\n};\n\nconst scratchVector = new Vector3();\nconst scratchPosition = new Vector3();\nconst cullingVolume = new CullingVolume([\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane()\n]);\n\n// Extracts a frame state appropriate for tile culling from a deck.gl viewport\n// TODO - this could likely be generalized and merged back into deck.gl for other culling scenarios\nexport function getFrameState(viewport, frameNumber: number): FrameState {\n // Traverse and and request. Update _selectedTiles so that we know what to render.\n const {cameraDirection, cameraUp, height} = viewport;\n const {metersPerUnit} = viewport.distanceScales;\n\n const viewportCenterCartographic = viewport.unprojectPosition(viewport.center);\n // TODO - Ellipsoid.eastNorthUpToFixedFrame() breaks on raw array, create a Vector.\n // TODO - Ellipsoid.eastNorthUpToFixedFrame() takes a cartesian, is that intuitive?\n const viewportCenterCartesian = Ellipsoid.WGS84.cartographicToCartesian(\n viewportCenterCartographic,\n new Vector3()\n );\n const enuToFixedTransform = Ellipsoid.WGS84.eastNorthUpToFixedFrame(viewportCenterCartesian);\n\n const cameraPositionCartographic = viewport.unprojectPosition(viewport.cameraPosition);\n const cameraPositionCartesian = Ellipsoid.WGS84.cartographicToCartesian(\n cameraPositionCartographic,\n new Vector3()\n );\n\n // These should still be normalized as the transform has scale 1 (goes from meters to meters)\n const cameraDirectionCartesian = new Vector3(\n // @ts-ignore\n enuToFixedTransform.transformAsVector(new Vector3(cameraDirection).scale(metersPerUnit))\n ).normalize();\n const cameraUpCartesian = new Vector3(\n // @ts-ignore\n enuToFixedTransform.transformAsVector(new Vector3(cameraUp).scale(metersPerUnit))\n ).normalize();\n\n commonSpacePlanesToWGS84(viewport, viewportCenterCartesian);\n\n // TODO: make a file/class for frameState and document what needs to be attached to this so that traversal can function\n return {\n camera: {\n position: cameraPositionCartesian,\n direction: cameraDirectionCartesian,\n up: cameraUpCartesian\n },\n viewport,\n height,\n cullingVolume,\n frameNumber, // TODO: This can be the same between updates, what number is unique for between updates?\n sseDenominator: 1.15 // Assumes fovy = 60 degrees\n };\n}\n\nfunction commonSpacePlanesToWGS84(viewport, viewportCenterCartesian) {\n // Extract frustum planes based on current view.\n const frustumPlanes = viewport.getFrustumPlanes();\n let i = 0;\n for (const dir in frustumPlanes) {\n const plane = frustumPlanes[dir];\n const distanceToCenter = plane.normal.dot(viewport.center);\n scratchPosition\n .copy(plane.normal)\n .scale(plane.distance - distanceToCenter)\n .add(viewport.center);\n const cartographicPos = viewport.unprojectPosition(scratchPosition);\n\n const cartesianPos = Ellipsoid.WGS84.cartographicToCartesian(cartographicPos, new Vector3());\n\n cullingVolume.planes[i++].fromPointNormal(\n cartesianPos,\n // Want the normal to point into the frustum since that's what culling expects\n scratchVector.copy(viewportCenterCartesian).subtract(cartesianPos)\n );\n }\n}\n"],"file":"frame-state.js"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Matrix4, Vector3 } from '@math.gl/core';
|
|
2
|
-
import { Ellipsoid } from '@math.gl/geospatial';
|
|
3
|
-
export function getLodStatus(tile, frameState) {
|
|
4
|
-
if (tile.lodMetricValue === 0 || isNaN(tile.lodMetricValue)) {
|
|
5
|
-
return 'DIG';
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const screenSize = 2 * getProjectedRadius(tile, frameState);
|
|
9
|
-
|
|
10
|
-
if (screenSize < 2) {
|
|
11
|
-
return 'OUT';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (!tile.header.children || screenSize <= tile.lodMetricValue) {
|
|
15
|
-
return 'DRAW';
|
|
16
|
-
} else if (tile.header.children) {
|
|
17
|
-
return 'DIG';
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return 'OUT';
|
|
21
|
-
}
|
|
22
|
-
export function getProjectedRadius(tile, frameState) {
|
|
23
|
-
const originalViewport = frameState.viewport;
|
|
24
|
-
const ViewportClass = originalViewport.constructor;
|
|
25
|
-
const {
|
|
26
|
-
longitude,
|
|
27
|
-
latitude,
|
|
28
|
-
height,
|
|
29
|
-
width,
|
|
30
|
-
bearing,
|
|
31
|
-
zoom
|
|
32
|
-
} = originalViewport;
|
|
33
|
-
const viewport = new ViewportClass({
|
|
34
|
-
longitude,
|
|
35
|
-
latitude,
|
|
36
|
-
height,
|
|
37
|
-
width,
|
|
38
|
-
bearing,
|
|
39
|
-
zoom,
|
|
40
|
-
pitch: 0
|
|
41
|
-
});
|
|
42
|
-
const mbsLat = tile.header.mbs[1];
|
|
43
|
-
const mbsLon = tile.header.mbs[0];
|
|
44
|
-
const mbsZ = tile.header.mbs[2];
|
|
45
|
-
const mbsR = tile.header.mbs[3];
|
|
46
|
-
const mbsCenterCartesian = [...tile.boundingVolume.center];
|
|
47
|
-
const cameraPositionCartographic = viewport.unprojectPosition(viewport.cameraPosition);
|
|
48
|
-
const cameraPositionCartesian = Ellipsoid.WGS84.cartographicToCartesian(cameraPositionCartographic, new Vector3());
|
|
49
|
-
const toEye = new Vector3(cameraPositionCartesian).subtract(mbsCenterCartesian).normalize();
|
|
50
|
-
const enuToCartesianMatrix = new Matrix4();
|
|
51
|
-
Ellipsoid.WGS84.eastNorthUpToFixedFrame(mbsCenterCartesian, enuToCartesianMatrix);
|
|
52
|
-
const cartesianToEnuMatrix = new Matrix4(enuToCartesianMatrix).invert();
|
|
53
|
-
const cameraPositionEnu = new Vector3(cameraPositionCartesian).transform(cartesianToEnuMatrix);
|
|
54
|
-
const projection = Math.sqrt(cameraPositionEnu[0] * cameraPositionEnu[0] + cameraPositionEnu[1] * cameraPositionEnu[1]);
|
|
55
|
-
const extraZ = projection * projection / cameraPositionEnu[2];
|
|
56
|
-
const extraVertexEnu = new Vector3([cameraPositionEnu[0], cameraPositionEnu[1], extraZ]);
|
|
57
|
-
const extraVertexCartesian = extraVertexEnu.transform(enuToCartesianMatrix);
|
|
58
|
-
const extraVectorCartesian = new Vector3(extraVertexCartesian).subtract(mbsCenterCartesian).normalize();
|
|
59
|
-
const radiusVector = toEye.cross(extraVectorCartesian).normalize().scale(mbsR);
|
|
60
|
-
const sphereMbsBorderVertexCartesian = new Vector3(mbsCenterCartesian).add(radiusVector);
|
|
61
|
-
const sphereMbsBorderVertexCartographic = Ellipsoid.WGS84.cartesianToCartographic(sphereMbsBorderVertexCartesian);
|
|
62
|
-
const projectedOrigin = viewport.project([mbsLon, mbsLat, mbsZ]);
|
|
63
|
-
const projectedMbsBorderVertex = viewport.project(sphereMbsBorderVertexCartographic);
|
|
64
|
-
const projectedRadius = new Vector3(projectedOrigin).subtract(projectedMbsBorderVertex).magnitude();
|
|
65
|
-
return projectedRadius;
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=i3s-lod.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tileset/helpers/i3s-lod.ts"],"names":["Matrix4","Vector3","Ellipsoid","getLodStatus","tile","frameState","lodMetricValue","isNaN","screenSize","getProjectedRadius","header","children","originalViewport","viewport","ViewportClass","constructor","longitude","latitude","height","width","bearing","zoom","pitch","mbsLat","mbs","mbsLon","mbsZ","mbsR","mbsCenterCartesian","boundingVolume","center","cameraPositionCartographic","unprojectPosition","cameraPosition","cameraPositionCartesian","WGS84","cartographicToCartesian","toEye","subtract","normalize","enuToCartesianMatrix","eastNorthUpToFixedFrame","cartesianToEnuMatrix","invert","cameraPositionEnu","transform","projection","Math","sqrt","extraZ","extraVertexEnu","extraVertexCartesian","extraVectorCartesian","radiusVector","cross","scale","sphereMbsBorderVertexCartesian","add","sphereMbsBorderVertexCartographic","cartesianToCartographic","projectedOrigin","project","projectedMbsBorderVertex","projectedRadius","magnitude"],"mappings":"AAAA,SAAQA,OAAR,EAAiBC,OAAjB,QAA+B,eAA/B;AACA,SAAQC,SAAR,QAAwB,qBAAxB;AAaA,OAAO,SAASC,YAAT,CAAsBC,IAAtB,EAAoCC,UAApC,EAAoF;AACzF,MAAID,IAAI,CAACE,cAAL,KAAwB,CAAxB,IAA6BC,KAAK,CAACH,IAAI,CAACE,cAAN,CAAtC,EAA6D;AAC3D,WAAO,KAAP;AACD;;AACD,QAAME,UAAU,GAAG,IAAIC,kBAAkB,CAACL,IAAD,EAAOC,UAAP,CAAzC;;AACA,MAAIG,UAAU,GAAG,CAAjB,EAAoB;AAClB,WAAO,KAAP;AACD;;AACD,MAAI,CAACJ,IAAI,CAACM,MAAL,CAAYC,QAAb,IAAyBH,UAAU,IAAIJ,IAAI,CAACE,cAAhD,EAAgE;AAC9D,WAAO,MAAP;AACD,GAFD,MAEO,IAAIF,IAAI,CAACM,MAAL,CAAYC,QAAhB,EAA0B;AAC/B,WAAO,KAAP;AACD;;AACD,SAAO,KAAP;AACD;AASD,OAAO,SAASF,kBAAT,CAA4BL,IAA5B,EAA0CC,UAA1C,EAA0E;AAC/E,QAAMO,gBAAgB,GAAGP,UAAU,CAACQ,QAApC;AACA,QAAMC,aAAa,GAAGF,gBAAgB,CAACG,WAAvC;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jD,QAAQ,CAACgD,OAAT,CAAiBH,iCAAjB,CAAjC;AACA,QAAMK,eAAe,GAAG,IAAI9D,OAAJ,CAAY2D,eAAZ,EACrBtB,QADqB,CACZwB,wBADY,EAErBE,SAFqB,EAAxB;AAGA,SAAOD,eAAP;AACD","sourcesContent":["import {Matrix4, Vector3} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport Tile3D from '../tile-3d';\nimport {FrameState} from './frame-state';\n\n/**\n * For the maxScreenThreshold error metric, maxError means that you should replace the node with it's children\n as soon as the nodes bounding sphere has a screen radius larger than maxError pixels.\n In this sense a value of 0 means you should always load it's children,\n or if it's a leaf node, you should always display it.\n * @param tile \n * @param frameState \n * @returns \n */\nexport function getLodStatus(tile: Tile3D, frameState: FrameState): 'DIG' | 'OUT' | 'DRAW' {\n if (tile.lodMetricValue === 0 || isNaN(tile.lodMetricValue)) {\n return 'DIG';\n }\n const screenSize = 2 * getProjectedRadius(tile, frameState);\n if (screenSize < 2) {\n return 'OUT';\n }\n if (!tile.header.children || screenSize <= tile.lodMetricValue) {\n return 'DRAW';\n } else if (tile.header.children) {\n return 'DIG';\n }\n return 'OUT';\n}\n\n/**\n * Calculate size of MBS radius projected on the screen plane\n * @param tile\n * @param frameState\n * @returns\n */\n// eslint-disable-next-line max-statements\nexport function getProjectedRadius(tile: Tile3D, frameState: FrameState): number {\n const originalViewport = frameState.viewport;\n const ViewportClass = originalViewport.constructor;\n const {longitude, latitude, height, width, bearing, zoom} = originalViewport;\n // @ts-ignore\n const viewport = new ViewportClass({longitude, latitude, height, width, bearing, zoom, pitch: 0});\n const mbsLat = tile.header.mbs[1];\n const mbsLon = tile.header.mbs[0];\n const mbsZ = tile.header.mbs[2];\n const mbsR = tile.header.mbs[3];\n const mbsCenterCartesian = [...tile.boundingVolume.center];\n const cameraPositionCartographic = viewport.unprojectPosition(viewport.cameraPosition);\n const cameraPositionCartesian = Ellipsoid.WGS84.cartographicToCartesian(\n cameraPositionCartographic,\n new Vector3()\n );\n\n // ---------------------------\n // Calculate mbs border vertex\n // ---------------------------\n const toEye = new Vector3(cameraPositionCartesian).subtract(mbsCenterCartesian).normalize();\n // Add extra vector to form plane\n const enuToCartesianMatrix = new Matrix4();\n Ellipsoid.WGS84.eastNorthUpToFixedFrame(mbsCenterCartesian, enuToCartesianMatrix);\n const cartesianToEnuMatrix = new Matrix4(enuToCartesianMatrix).invert();\n const cameraPositionEnu = new Vector3(cameraPositionCartesian).transform(cartesianToEnuMatrix);\n // Mean Proportionals in Right Triangles - Altitude rule\n // https://mathbitsnotebook.com/Geometry/RightTriangles/RTmeanRight.html\n const projection = Math.sqrt(\n cameraPositionEnu[0] * cameraPositionEnu[0] + cameraPositionEnu[1] * cameraPositionEnu[1]\n );\n const extraZ = (projection * projection) / cameraPositionEnu[2];\n const extraVertexEnu = new Vector3([cameraPositionEnu[0], cameraPositionEnu[1], extraZ]);\n const extraVertexCartesian = extraVertexEnu.transform(enuToCartesianMatrix);\n const extraVectorCartesian = new Vector3(extraVertexCartesian)\n .subtract(mbsCenterCartesian)\n .normalize();\n // We need radius vector orthogonal to toEye vector\n const radiusVector = toEye.cross(extraVectorCartesian).normalize().scale(mbsR);\n const sphereMbsBorderVertexCartesian = new Vector3(mbsCenterCartesian).add(radiusVector);\n const sphereMbsBorderVertexCartographic = Ellipsoid.WGS84.cartesianToCartographic(\n sphereMbsBorderVertexCartesian\n );\n // ---------------------------\n\n // Project center vertex and border vertex and calculate projected radius of MBS\n const projectedOrigin = viewport.project([mbsLon, mbsLat, mbsZ]);\n const projectedMbsBorderVertex = viewport.project(sphereMbsBorderVertexCartographic);\n const projectedRadius = new Vector3(projectedOrigin)\n .subtract(projectedMbsBorderVertex)\n .magnitude();\n return projectedRadius;\n}\n"],"file":"i3s-lod.js"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Matrix4, Vector3, clamp } from '@math.gl/core';
|
|
2
|
-
const scratchPositionNormal = new Vector3();
|
|
3
|
-
const scratchCartographic = new Vector3();
|
|
4
|
-
const scratchMatrix = new Matrix4();
|
|
5
|
-
const scratchCenter = new Vector3();
|
|
6
|
-
const scratchPosition = new Vector3();
|
|
7
|
-
const scratchDirection = new Vector3();
|
|
8
|
-
export function calculateDynamicScreenSpaceError(root, {
|
|
9
|
-
camera,
|
|
10
|
-
mapProjection
|
|
11
|
-
}, options = {}) {
|
|
12
|
-
const {
|
|
13
|
-
dynamicScreenSpaceErrorHeightFalloff = 0.25,
|
|
14
|
-
dynamicScreenSpaceErrorDensity = 0.00278
|
|
15
|
-
} = options;
|
|
16
|
-
let up;
|
|
17
|
-
let direction;
|
|
18
|
-
let height;
|
|
19
|
-
let minimumHeight;
|
|
20
|
-
let maximumHeight;
|
|
21
|
-
const tileBoundingVolume = root.contentBoundingVolume;
|
|
22
|
-
|
|
23
|
-
if (tileBoundingVolume instanceof TileBoundingRegion) {
|
|
24
|
-
up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);
|
|
25
|
-
direction = camera.directionWC;
|
|
26
|
-
height = camera.positionCartographic.height;
|
|
27
|
-
minimumHeight = tileBoundingVolume.minimumHeight;
|
|
28
|
-
maximumHeight = tileBoundingVolume.maximumHeight;
|
|
29
|
-
} else {
|
|
30
|
-
const transformLocal = Matrix4.inverseTransformation(root.computedTransform, scratchMatrix);
|
|
31
|
-
const ellipsoid = mapProjection.ellipsoid;
|
|
32
|
-
const boundingVolume = tileBoundingVolume.boundingVolume;
|
|
33
|
-
const centerLocal = Matrix4.multiplyByPoint(transformLocal, boundingVolume.center, scratchCenter);
|
|
34
|
-
|
|
35
|
-
if (Cartesian3.magnitude(centerLocal) > ellipsoid.minimumRadius) {
|
|
36
|
-
const centerCartographic = Cartographic.fromCartesian(centerLocal, ellipsoid, scratchCartographic);
|
|
37
|
-
up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);
|
|
38
|
-
direction = camera.directionWC;
|
|
39
|
-
height = camera.positionCartographic.height;
|
|
40
|
-
minimumHeight = 0.0;
|
|
41
|
-
maximumHeight = centerCartographic.height * 2.0;
|
|
42
|
-
} else {
|
|
43
|
-
const positionLocal = Matrix4.multiplyByPoint(transformLocal, camera.positionWC, scratchPosition);
|
|
44
|
-
up = Cartesian3.UNIT_Z;
|
|
45
|
-
direction = Matrix4.multiplyByPointAsVector(transformLocal, camera.directionWC, scratchDirection);
|
|
46
|
-
direction = Cartesian3.normalize(direction, direction);
|
|
47
|
-
height = positionLocal.z;
|
|
48
|
-
|
|
49
|
-
if (tileBoundingVolume instanceof TileOrientedBoundingBox) {
|
|
50
|
-
const boxHeight = root._header.boundingVolume.box[11];
|
|
51
|
-
minimumHeight = centerLocal.z - boxHeight;
|
|
52
|
-
maximumHeight = centerLocal.z + boxHeight;
|
|
53
|
-
} else if (tileBoundingVolume instanceof TileBoundingSphere) {
|
|
54
|
-
const radius = boundingVolume.radius;
|
|
55
|
-
minimumHeight = centerLocal.z - radius;
|
|
56
|
-
maximumHeight = centerLocal.z + radius;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const heightFalloff = dynamicScreenSpaceErrorHeightFalloff;
|
|
62
|
-
const heightClose = minimumHeight + (maximumHeight - minimumHeight) * heightFalloff;
|
|
63
|
-
const heightFar = maximumHeight;
|
|
64
|
-
const t = clamp((height - heightClose) / (heightFar - heightClose), 0.0, 1.0);
|
|
65
|
-
const dot = Math.abs(Cartesian3.dot(direction, up));
|
|
66
|
-
let horizonFactor = 1.0 - dot;
|
|
67
|
-
horizonFactor = horizonFactor * (1.0 - t);
|
|
68
|
-
return dynamicScreenSpaceErrorDensity * horizonFactor;
|
|
69
|
-
}
|
|
70
|
-
export function fog(distanceToCamera, density) {
|
|
71
|
-
const scalar = distanceToCamera * density;
|
|
72
|
-
return 1.0 - Math.exp(-(scalar * scalar));
|
|
73
|
-
}
|
|
74
|
-
export function getDynamicScreenSpaceError(tileset, distanceToCamera) {
|
|
75
|
-
if (tileset.dynamicScreenSpaceError && tileset.dynamicScreenSpaceErrorComputedDensity) {
|
|
76
|
-
const density = tileset.dynamicScreenSpaceErrorComputedDensity;
|
|
77
|
-
const factor = tileset.dynamicScreenSpaceErrorFactor;
|
|
78
|
-
const dynamicError = fog(distanceToCamera, density) * factor;
|
|
79
|
-
return dynamicError;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return 0;
|
|
83
|
-
}
|
|
84
|
-
export function getTiles3DScreenSpaceError(tile, frameState, useParentLodMetric) {
|
|
85
|
-
const tileset = tile.tileset;
|
|
86
|
-
const parentLodMetricValue = tile.parent && tile.parent.lodMetricValue || tile.lodMetricValue;
|
|
87
|
-
const lodMetricValue = useParentLodMetric ? parentLodMetricValue : tile.lodMetricValue;
|
|
88
|
-
|
|
89
|
-
if (lodMetricValue === 0.0) {
|
|
90
|
-
return 0.0;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const distance = Math.max(tile._distanceToCamera, 1e-7);
|
|
94
|
-
const {
|
|
95
|
-
height,
|
|
96
|
-
sseDenominator
|
|
97
|
-
} = frameState;
|
|
98
|
-
const {
|
|
99
|
-
viewDistanceScale
|
|
100
|
-
} = tileset.options;
|
|
101
|
-
let error = lodMetricValue * height * (viewDistanceScale || 1.0) / (distance * sseDenominator);
|
|
102
|
-
error -= getDynamicScreenSpaceError(tileset, distance);
|
|
103
|
-
return error;
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=tiles-3d-lod.js.map
|