@jdultra/threedtiles 11.1.8 → 11.1.9
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/docs/InstancedOGC3DTile.html +3 -0
- package/dist/docs/InstancedTile.html +3 -0
- package/dist/docs/InstancedTileLoader.html +3 -0
- package/dist/docs/OGC3DTile.html +3 -0
- package/dist/docs/OGC3DTile.js.html +1451 -0
- package/dist/docs/OcclusionCullingService.html +3 -0
- package/dist/docs/OcclusionCullingService.js.html +84 -0
- package/dist/docs/TileLoader.html +3 -0
- package/dist/docs/TileLoader.js.html +550 -0
- package/dist/docs/data/search.json +1 -0
- package/dist/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/dist/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/dist/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/dist/docs/global.html +3 -0
- package/dist/docs/index.html +338 -0
- package/dist/docs/instanced_InstancedOGC3DTile.js.html +106 -0
- package/dist/docs/instanced_InstancedTile.js.html +701 -0
- package/dist/docs/instanced_InstancedTileLoader.js.html +497 -0
- package/dist/docs/scripts/core.js +726 -0
- package/dist/docs/scripts/core.min.js +23 -0
- package/dist/docs/scripts/resize.js +90 -0
- package/dist/docs/scripts/search.js +265 -0
- package/dist/docs/scripts/search.min.js +6 -0
- package/dist/docs/scripts/third-party/Apache-License-2.0.txt +202 -0
- package/dist/docs/scripts/third-party/fuse.js +9 -0
- package/dist/docs/scripts/third-party/hljs-line-num-original.js +369 -0
- package/dist/docs/scripts/third-party/hljs-line-num.js +1 -0
- package/dist/docs/scripts/third-party/hljs-original.js +5171 -0
- package/dist/docs/scripts/third-party/hljs.js +1 -0
- package/dist/docs/scripts/third-party/popper.js +5 -0
- package/dist/docs/scripts/third-party/tippy.js +1 -0
- package/dist/docs/scripts/third-party/tocbot.js +672 -0
- package/dist/docs/scripts/third-party/tocbot.min.js +1 -0
- package/dist/docs/styles/clean-jsdoc-theme-base.css +1159 -0
- package/dist/docs/styles/clean-jsdoc-theme-dark.css +412 -0
- package/dist/docs/styles/clean-jsdoc-theme-light.css +482 -0
- package/dist/docs/styles/clean-jsdoc-theme-scrollbar.css +30 -0
- package/dist/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
- package/dist/docs/styles/clean-jsdoc-theme.min.css +1 -0
- package/dist/entry.d.ts +1 -1
- package/dist/threedtiles.min.js +1 -1
- package/dist/threedtiles.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,701 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="en" style="font-size:16px"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Source: instanced/InstancedTile.js</title><!--[if lt IE 9]>
|
|
2
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
3
|
+
<![endif]--><script src="scripts/third-party/hljs.js" defer="defer"></script><script src="scripts/third-party/hljs-line-num.js" defer="defer"></script><script src="scripts/third-party/popper.js" defer="defer"></script><script src="scripts/third-party/tippy.js" defer="defer"></script><script src="scripts/third-party/tocbot.min.js"></script><script>var baseURL="/",locationPathname="";baseURL=(locationPathname=document.location.pathname).substr(0,locationPathname.lastIndexOf("/")+1)</script><link rel="stylesheet" href="styles/clean-jsdoc-theme.min.css"><svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"><defs><symbol id="copy-icon" viewbox="0 0 488.3 488.3"><g><path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/><path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/></g></symbol><symbol id="search-icon" viewBox="0 0 512 512"><g><g><path d="M225.474,0C101.151,0,0,101.151,0,225.474c0,124.33,101.151,225.474,225.474,225.474 c124.33,0,225.474-101.144,225.474-225.474C450.948,101.151,349.804,0,225.474,0z M225.474,409.323 c-101.373,0-183.848-82.475-183.848-183.848S124.101,41.626,225.474,41.626s183.848,82.475,183.848,183.848 S326.847,409.323,225.474,409.323z"/></g></g><g><g><path d="M505.902,476.472L386.574,357.144c-8.131-8.131-21.299-8.131-29.43,0c-8.131,8.124-8.131,21.306,0,29.43l119.328,119.328 c4.065,4.065,9.387,6.098,14.715,6.098c5.321,0,10.649-2.033,14.715-6.098C514.033,497.778,514.033,484.596,505.902,476.472z"/></g></g></symbol><symbol id="font-size-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.246 15H4.754l-2 5H.6L7 4h2l6.4 16h-2.154l-2-5zm-.8-2L8 6.885 5.554 13h4.892zM21 12.535V12h2v8h-2v-.535a4 4 0 1 1 0-6.93zM19 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></symbol><symbol id="add-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></symbol><symbol id="minus-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M5 11h14v2H5z"/></symbol><symbol id="dark-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol><symbol id="light-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol><symbol id="reset-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.537 19.567A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3a8 8 0 1 0-2.46 5.772l.997 1.795z"/></symbol><symbol id="down-icon" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></symbol><symbol id="codepen-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M16.5 13.202L13 15.535v3.596L19.197 15 16.5 13.202zM14.697 12L12 10.202 9.303 12 12 13.798 14.697 12zM20 10.869L18.303 12 20 13.131V10.87zM19.197 9L13 4.869v3.596l3.5 2.333L19.197 9zM7.5 10.798L11 8.465V4.869L4.803 9 7.5 10.798zM4.803 15L11 19.131v-3.596l-3.5-2.333L4.803 15zM4 13.131L5.697 12 4 10.869v2.262zM2 9a1 1 0 0 1 .445-.832l9-6a1 1 0 0 1 1.11 0l9 6A1 1 0 0 1 22 9v6a1 1 0 0 1-.445.832l-9 6a1 1 0 0 1-1.11 0l-9-6A1 1 0 0 1 2 15V9z"/></symbol><symbol id="close-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></symbol><symbol id="menu-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"/></symbol></defs></svg></head><body data-theme="dark"><div class="sidebar-container"><div class="sidebar" id="sidebar"><div class="sidebar-items-container"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="InstancedOGC3DTile.html">InstancedOGC3DTile</a></div><div class="sidebar-section-children"><a href="InstancedTile.html">InstancedTile</a></div><div class="sidebar-section-children"><a href="InstancedTileLoader.html">InstancedTileLoader</a></div><div class="sidebar-section-children"><a href="OGC3DTile.html">OGC3DTile</a></div><div class="sidebar-section-children"><a href="OcclusionCullingService.html">OcclusionCullingService</a></div><div class="sidebar-section-children"><a href="TileLoader.html">TileLoader</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#getOGC3DTilesCopyrightInfo">getOGC3DTilesCopyrightInfo</a></div></div></div></div></div><div class="navbar-container" id="VuAckcnZhf"><nav class="navbar"><div class="navbar-left-items"></div><div class="navbar-right-items"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div><nav></nav></nav></div><div class="toc-container"><div class="toc-content"><span class="bold">On this page</span><div id="eed4d2a0bfd64539bb9df78095dec881"></div></div></div><div class="body-wrapper"><div class="main-content"><div class="main-wrapper"><section id="source-page" class="source-page"><header><h1 id="title" class="has-anchor">instanced_InstancedTile.js</h1></header><article><pre class="prettyprint source lang-js"><code>import * as THREE from 'three';
|
|
4
|
+
import { OBB } from "../../geometry/obb";
|
|
5
|
+
import { v4 as uuidv4 } from "uuid";
|
|
6
|
+
import * as path from "path-browserify";
|
|
7
|
+
|
|
8
|
+
const tempSphere = new THREE.Sphere(new THREE.Vector3(0, 0, 0), 1);
|
|
9
|
+
const tempVec1 = new THREE.Vector3(0, 0, 0);
|
|
10
|
+
const tempVec2 = new THREE.Vector3(0, 0, 0);
|
|
11
|
+
const upVector = new THREE.Vector3(0, 1, 0);
|
|
12
|
+
const rendererSize = new THREE.Vector2();
|
|
13
|
+
const tempQuaternion = new THREE.Quaternion();
|
|
14
|
+
const tempMatrix = new THREE.Matrix4();
|
|
15
|
+
|
|
16
|
+
class InstancedTile extends THREE.Object3D {
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {
|
|
21
|
+
* json: optional,
|
|
22
|
+
* url: optional,
|
|
23
|
+
* rootPath: optional,
|
|
24
|
+
* parentGeometricError: optional,
|
|
25
|
+
* parentBoundingVolume: optional,
|
|
26
|
+
* parentRefinement: optional,
|
|
27
|
+
* loadOutsideView: Boolean,
|
|
28
|
+
* tileLoader : InstancedTileLoader,
|
|
29
|
+
* cameraOnLoad: camera,
|
|
30
|
+
* parentTile: OGC3DTile,
|
|
31
|
+
* onLoadCallback: function,
|
|
32
|
+
* centerModel: Boolean,
|
|
33
|
+
* queryParams: String,
|
|
34
|
+
* distanceBias: distanceBias
|
|
35
|
+
* } properties
|
|
36
|
+
*/
|
|
37
|
+
constructor(properties) {
|
|
38
|
+
super();
|
|
39
|
+
const self = this;
|
|
40
|
+
if (properties.queryParams) {
|
|
41
|
+
this.queryParams = { ...properties.queryParams };
|
|
42
|
+
}
|
|
43
|
+
this.uuid = uuidv4();
|
|
44
|
+
if (!!properties.tileLoader) {
|
|
45
|
+
this.tileLoader = properties.tileLoader;
|
|
46
|
+
} else {
|
|
47
|
+
console.error("an instanced tileset must be provided an InstancedTilesetLoader");
|
|
48
|
+
}
|
|
49
|
+
// set properties general to the entire tileset
|
|
50
|
+
this.master = properties.master;
|
|
51
|
+
this.loadOutsideView = properties.loadOutsideView;
|
|
52
|
+
this.cameraOnLoad = properties.cameraOnLoad;
|
|
53
|
+
this.parentTile = properties.parentTile;
|
|
54
|
+
this.distanceBias = Math.max(0.0001,properties.distanceBias? properties.distanceBias:1);
|
|
55
|
+
|
|
56
|
+
// declare properties specific to the tile for clarity
|
|
57
|
+
this.childrenTiles = [];
|
|
58
|
+
this.jsonChildren = [];
|
|
59
|
+
this.meshContent = new Set();
|
|
60
|
+
|
|
61
|
+
this.static = properties.static;
|
|
62
|
+
if (this.static) {
|
|
63
|
+
this.matrixAutoUpdate = false;
|
|
64
|
+
this.matrixWorldAutoUpdate = false;
|
|
65
|
+
}
|
|
66
|
+
this.tileContent;
|
|
67
|
+
this.refinement; // defaults to "REPLACE"
|
|
68
|
+
this.rootPath;
|
|
69
|
+
this.geometricError;
|
|
70
|
+
this.boundingVolume;
|
|
71
|
+
this.json; // the json corresponding to this tile
|
|
72
|
+
this.materialVisibility = false;
|
|
73
|
+
this.inFrustum = true;
|
|
74
|
+
this.level = properties.level ? properties.level : 0;
|
|
75
|
+
this.hasMeshContent = 0; // true when the provided json has a content field pointing to a B3DM file
|
|
76
|
+
this.hasUnloadedJSONContent = 0; // true when the provided json has a content field pointing to a JSON file that is not yet loaded
|
|
77
|
+
this.centerModel = properties.centerModel;
|
|
78
|
+
|
|
79
|
+
this.deleted = false;
|
|
80
|
+
this.abortController = new AbortController();
|
|
81
|
+
|
|
82
|
+
if (!!properties.json) { // If this tile is created as a child of another tile, properties.json is not null
|
|
83
|
+
this.rootPath = !!properties.json.rootPath ? properties.json.rootPath : properties.rootPath;
|
|
84
|
+
if (properties.json.children) this.jsonChildren = properties.json.children;
|
|
85
|
+
self.setup(properties);
|
|
86
|
+
} else if (properties.url) { // If only the url to the tileset.json is provided
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
this.loadJson = (json, url) => {
|
|
90
|
+
//json = JSON.parse(JSON.stringify(json))
|
|
91
|
+
const p = path.dirname(url);
|
|
92
|
+
self.setup({ rootPath: p, json: json, onLoadCallback: properties.onLoadCallback });
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
var url = properties.url;
|
|
98
|
+
if (self.queryParams) {
|
|
99
|
+
var props = "";
|
|
100
|
+
for (let key in self.queryParams) {
|
|
101
|
+
if (self.queryParams.hasOwnProperty(key)) { // This check is necessary to skip properties from the object's prototype chain
|
|
102
|
+
props += "&" + key + "=" + self.queryParams[key];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (url.includes("?")) {
|
|
106
|
+
url += props;
|
|
107
|
+
} else {
|
|
108
|
+
url += "?" + props.substring(1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
self.tileLoader.get(self.abortController, url, self.uuid, self);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async setup(properties) {
|
|
116
|
+
const self = this;
|
|
117
|
+
|
|
118
|
+
if (!!properties.json.root) {
|
|
119
|
+
self.json = properties.json.root;
|
|
120
|
+
if (!self.json.children && self.json.getChildren) {
|
|
121
|
+
self.json.children = await self.json.getChildren();
|
|
122
|
+
}
|
|
123
|
+
self.jsonChildren = self.json.children;
|
|
124
|
+
if (!self.json.refinement) self.json.refinement = properties.json.refinement;
|
|
125
|
+
if (!self.json.geometricError) self.json.geometricError = properties.json.geometricError;
|
|
126
|
+
if (!self.json.transform) self.json.transform = properties.json.transform;
|
|
127
|
+
if (!self.json.boundingVolume) self.json.boundingVolume = properties.json.boundingVolume;
|
|
128
|
+
} else {
|
|
129
|
+
self.json = properties.json;
|
|
130
|
+
if (!self.json.children && self.json.getChildren) {
|
|
131
|
+
self.json.children = await self.json.getChildren();
|
|
132
|
+
self.jsonChildren = self.json.children;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
self.rootPath = !!properties.json.rootPath ? properties.json.rootPath : properties.rootPath;
|
|
137
|
+
|
|
138
|
+
// decode refinement
|
|
139
|
+
if (!!self.json.refinement) {
|
|
140
|
+
self.refinement = self.json.refinement;
|
|
141
|
+
} else {
|
|
142
|
+
self.refinement = properties.parentRefinement;
|
|
143
|
+
}
|
|
144
|
+
// decode geometric error
|
|
145
|
+
if (!!self.json.geometricError) {
|
|
146
|
+
self.geometricError = self.json.geometricError;
|
|
147
|
+
} else {
|
|
148
|
+
self.geometricError = properties.parentGeometricError;
|
|
149
|
+
}
|
|
150
|
+
// decode transform
|
|
151
|
+
let mat = new THREE.Matrix4();
|
|
152
|
+
if (!!self.json.transform && !self.centerModel) {
|
|
153
|
+
mat.elements = self.json.transform;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
self.applyMatrix4(mat);
|
|
157
|
+
|
|
158
|
+
if (!!self.parentTile && !!self.parentTile.matrix) {
|
|
159
|
+
|
|
160
|
+
self.matrix.premultiply(self.parentTile.matrix);
|
|
161
|
+
//self.matrix.premultiply(self.master.matrixWorld);
|
|
162
|
+
self.matrix.decompose(self.position, self.quaternion, self.scale)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
self.matrixWorldNeedsUpdate = true;
|
|
167
|
+
self.updateWorldMatrix(true, true)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
// decode volume
|
|
171
|
+
if (!!self.json.boundingVolume) {
|
|
172
|
+
if (!!self.json.boundingVolume.box) {
|
|
173
|
+
self.boundingVolume = new OBB(self.json.boundingVolume.box);
|
|
174
|
+
} else if (!!self.json.boundingVolume.region) {
|
|
175
|
+
const region = self.json.boundingVolume.region;
|
|
176
|
+
self.transformWGS84ToCartesian(region[0], region[1], region[4], tempVec1);
|
|
177
|
+
self.transformWGS84ToCartesian(region[2], region[3], region[5], tempVec2);
|
|
178
|
+
tempVec1.lerp(tempVec2, 0.5);
|
|
179
|
+
self.boundingVolume = new THREE.Sphere(new THREE.Vector3(tempVec1.x, tempVec1.y, tempVec1.z), tempVec1.distanceTo(tempVec2));
|
|
180
|
+
} else if (!!self.json.boundingVolume.sphere) {
|
|
181
|
+
const sphere = self.json.boundingVolume.sphere;
|
|
182
|
+
self.boundingVolume = new THREE.Sphere(new THREE.Vector3(sphere[0], sphere[1], sphere[2]), sphere[3]);
|
|
183
|
+
} else {
|
|
184
|
+
self.boundingVolume = properties.parentBoundingVolume;
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
self.boundingVolume = properties.parentBoundingVolume;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function checkContent(e) {
|
|
191
|
+
if (!!e.uri && e.uri.includes("json")) {
|
|
192
|
+
self.hasUnloadedJSONContent++;
|
|
193
|
+
} else if (!!e.url && e.url.includes("json")) {
|
|
194
|
+
self.hasUnloadedJSONContent++;
|
|
195
|
+
} else {
|
|
196
|
+
self.hasMeshContent++;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (!!self.json.content) { //if there is a content, json or otherwise, schedule it to be loaded
|
|
200
|
+
checkContent(self.json.content);
|
|
201
|
+
|
|
202
|
+
self.load();
|
|
203
|
+
} else if (!!self.json.contents) { //if there is a content, json or otherwise, schedule it to be loaded
|
|
204
|
+
self.json.contents.forEach(e => checkContent(e))
|
|
205
|
+
|
|
206
|
+
self.load();
|
|
207
|
+
//scheduleLoadTile(this);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (!!self.centerModel) {
|
|
211
|
+
const tempSphere = new THREE.Sphere();
|
|
212
|
+
if (self.boundingVolume instanceof OBB) {
|
|
213
|
+
// box
|
|
214
|
+
tempSphere.copy(self.boundingVolume.sphere);
|
|
215
|
+
} else if (self.boundingVolume instanceof THREE.Sphere) {
|
|
216
|
+
//sphere
|
|
217
|
+
tempSphere.copy(self.boundingVolume);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
//tempSphere.applyMatrix4(self.matrixWorld);
|
|
221
|
+
if (!!this.json.boundingVolume.region) {
|
|
222
|
+
self.transformWGS84ToCartesian(
|
|
223
|
+
(self.json.boundingVolume.region[0] + self.json.boundingVolume.region[2]) * 0.5,
|
|
224
|
+
(self.json.boundingVolume.region[1] + self.json.boundingVolume.region[3]) * 0.5,
|
|
225
|
+
(self.json.boundingVolume.region[4] + self.json.boundingVolume.region[5]) * 0.5,
|
|
226
|
+
tempVec1);
|
|
227
|
+
|
|
228
|
+
tempQuaternion.setFromUnitVectors(tempVec1.normalize(), upVector.normalize());
|
|
229
|
+
self.master.applyQuaternion(tempQuaternion);
|
|
230
|
+
self.master.updateWorldMatrix(false, false)
|
|
231
|
+
}
|
|
232
|
+
tempMatrix.makeTranslation(-tempSphere.center.x * self.scale.x, -tempSphere.center.y * self.scale.y, -tempSphere.center.z * self.scale.z);
|
|
233
|
+
//self.master.applyMatrix4(tempMatrix);
|
|
234
|
+
self.master.matrix.multiply(tempMatrix);
|
|
235
|
+
self.master.matrix.decompose(self.master.position, self.master.quaternion, self.master.scale);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
self.isSetup = true;
|
|
239
|
+
if (properties.onLoadCallback) properties.onLoadCallback(self);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
isAbsolutePathOrURL(input) {
|
|
243
|
+
// Check if it's an absolute URL with various protocols
|
|
244
|
+
const urlRegex = /^(?:http|https|ftp|tcp|udp):\/\/\S+/;
|
|
245
|
+
const absoluteURL = urlRegex.test(input);
|
|
246
|
+
|
|
247
|
+
// Check if it's an absolute path
|
|
248
|
+
const absolutePath = input.startsWith('/') && !input.startsWith('//');
|
|
249
|
+
|
|
250
|
+
return absoluteURL || absolutePath;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
assembleURL(root, relative) {
|
|
254
|
+
// Append a slash to the root URL if it doesn't already have one
|
|
255
|
+
if (!root.endsWith('/')) {
|
|
256
|
+
root += '/';
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const rootUrl = new URL(root);
|
|
260
|
+
let rootParts = rootUrl.pathname.split('/').filter(p => p !== '');
|
|
261
|
+
let relativeParts = relative.split('/').filter(p => p !== '');
|
|
262
|
+
|
|
263
|
+
for (let i = 1; i <= rootParts.length; i++) {
|
|
264
|
+
if (i >= relativeParts.length) break;
|
|
265
|
+
const rootToken = rootParts.slice(rootParts.length - i, rootParts.length).join('/');
|
|
266
|
+
const relativeToken = relativeParts.slice(0, i).join('/');
|
|
267
|
+
if (rootToken === relativeToken) {
|
|
268
|
+
for (let j = 0; j < i; j++) {
|
|
269
|
+
rootParts.pop();
|
|
270
|
+
}
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
while (relativeParts.length > 0 && relativeParts[0] === '..') {
|
|
277
|
+
rootParts.pop();
|
|
278
|
+
relativeParts.shift();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return `${rootUrl.protocol}//${rootUrl.host}/${[...rootParts, ...relativeParts].join('/')}`;
|
|
282
|
+
}
|
|
283
|
+
extractQueryParams(url, params) {
|
|
284
|
+
const urlObj = new URL(url);
|
|
285
|
+
|
|
286
|
+
// Iterate over all the search parameters
|
|
287
|
+
for (let [key, value] of urlObj.searchParams) {
|
|
288
|
+
params[key] = value;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Remove the query string
|
|
292
|
+
urlObj.search = '';
|
|
293
|
+
return urlObj.toString();
|
|
294
|
+
}
|
|
295
|
+
load() {
|
|
296
|
+
var self = this;
|
|
297
|
+
if (self.deleted) return;
|
|
298
|
+
if (!!self.json.content) {
|
|
299
|
+
|
|
300
|
+
loadContent(self.json.content);
|
|
301
|
+
} else if (!!self.json.contents) {
|
|
302
|
+
self.json.contents.forEach(content => loadContent(content))
|
|
303
|
+
}
|
|
304
|
+
function loadContent(content) {
|
|
305
|
+
let url;
|
|
306
|
+
if (!!content.uri) {
|
|
307
|
+
url = content.uri;
|
|
308
|
+
} else if (!!content.url) {
|
|
309
|
+
url = content.url;
|
|
310
|
+
}
|
|
311
|
+
const urlRegex = /^(?:http|https|ftp|tcp|udp):\/\/\S+/;
|
|
312
|
+
|
|
313
|
+
if (urlRegex.test(self.rootPath)) { // url
|
|
314
|
+
if (!urlRegex.test(url)) {
|
|
315
|
+
url = self.assembleURL(self.rootPath, url)
|
|
316
|
+
}
|
|
317
|
+
} else { //path
|
|
318
|
+
if (path.isAbsolute(self.rootPath)) {
|
|
319
|
+
url = self.rootPath + path.sep + url;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
url = self.extractQueryParams(url, self.queryParams);
|
|
323
|
+
if (self.queryParams) {
|
|
324
|
+
var props = "";
|
|
325
|
+
for (let key in self.queryParams) {
|
|
326
|
+
if (self.queryParams.hasOwnProperty(key)) { // This check is necessary to skip properties from the object's prototype chain
|
|
327
|
+
props += "&" + key + "=" + self.queryParams[key];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (url.includes("?")) {
|
|
331
|
+
url += props;
|
|
332
|
+
} else {
|
|
333
|
+
url += "?" + props.substring(1);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (!!url) {
|
|
338
|
+
if (url.includes(".b3dm") || url.includes(".glb") || url.includes(".gltf")) {
|
|
339
|
+
self.contentURL = url;
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
self.tileLoader.get(self.abortController, url, self.uuid, self, !self.cameraOnLoad ? () => 0 : () => {
|
|
343
|
+
return self.calculateDistanceToCamera(self.cameraOnLoad);
|
|
344
|
+
}, () => self.getSiblings(),
|
|
345
|
+
self.level,
|
|
346
|
+
!!self.json.boundingVolume.region ? false : true,
|
|
347
|
+
!!self.json.boundingVolume.region,
|
|
348
|
+
self.geometricError);
|
|
349
|
+
} else if (url.includes(".json")) {
|
|
350
|
+
self.tileLoader.get(self.abortController, url, self.uuid, self);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
loadMesh(mesh) {
|
|
360
|
+
const self = this;
|
|
361
|
+
if (self.deleted) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
//self.updateWorldMatrix(false, true);
|
|
365
|
+
self.meshContent.add(mesh);
|
|
366
|
+
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
loadJson(json, url) {
|
|
370
|
+
if (this.deleted) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (!!this.json.children) {
|
|
374
|
+
this.jsonChildren = this.json.children;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
json.rootPath = path.dirname(url);
|
|
378
|
+
this.jsonChildren.push(json);
|
|
379
|
+
this.hasUnloadedJSONContent--;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
dispose() {
|
|
383
|
+
|
|
384
|
+
const self = this;
|
|
385
|
+
self.childrenTiles.forEach(tile => tile.dispose());
|
|
386
|
+
|
|
387
|
+
self.deleted = true;
|
|
388
|
+
if (self.abortController) self.abortController.abort();
|
|
389
|
+
this.parent = null;
|
|
390
|
+
this.parentTile = null;
|
|
391
|
+
this.dispatchEvent({ type: 'removed' });
|
|
392
|
+
}
|
|
393
|
+
disposeChildren() {
|
|
394
|
+
|
|
395
|
+
var self = this;
|
|
396
|
+
|
|
397
|
+
self.childrenTiles.forEach(tile => tile.dispose());
|
|
398
|
+
self.childrenTiles = [];
|
|
399
|
+
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
_update(camera, frustum) {
|
|
404
|
+
const self = this;
|
|
405
|
+
if (!self.isSetup) return;
|
|
406
|
+
|
|
407
|
+
const visibilityBeforeUpdate = self.materialVisibility;
|
|
408
|
+
|
|
409
|
+
if (!!self.boundingVolume && !!self.geometricError) {
|
|
410
|
+
self.metric = self.calculateUpdateMetric(camera, frustum);
|
|
411
|
+
}
|
|
412
|
+
self.childrenTiles.forEach(child => child._update(camera, frustum));
|
|
413
|
+
|
|
414
|
+
updateNodeVisibility(self.metric);
|
|
415
|
+
updateTree(self.metric);
|
|
416
|
+
trimTree(self.metric, visibilityBeforeUpdate);
|
|
417
|
+
|
|
418
|
+
function updateTree(metric) {
|
|
419
|
+
// If this tile does not have mesh content but it has children
|
|
420
|
+
if (metric < 0 && self.hasMeshContent) return;
|
|
421
|
+
|
|
422
|
+
if ((!self.hasMeshContent && self.rootPath) || (metric < self.master.geometricErrorMultiplier * self.geometricError && self.meshContent.size > 0)) {
|
|
423
|
+
if (!!self.json && !!self.jsonChildren && self.childrenTiles.length != self.jsonChildren.length) {
|
|
424
|
+
loadJsonChildren();
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function updateNodeVisibility(metric) {
|
|
431
|
+
|
|
432
|
+
//doesn't have a mesh content
|
|
433
|
+
if (!self.hasMeshContent) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
// mesh content not yet loaded
|
|
437
|
+
if (self.meshContent.size < self.hasMeshContent) {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// outside frustum
|
|
442
|
+
if (metric < 0) {
|
|
443
|
+
self.inFrustum = false;
|
|
444
|
+
self.changeContentVisibility(!!self.loadOutsideView);
|
|
445
|
+
return;
|
|
446
|
+
} else {
|
|
447
|
+
self.inFrustum = true;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// has no children
|
|
451
|
+
if (self.childrenTiles.length == 0) {
|
|
452
|
+
self.changeContentVisibility(true);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// has children
|
|
457
|
+
if (metric >= self.master.geometricErrorMultiplier * self.geometricError) { // Ideal LOD or before ideal lod
|
|
458
|
+
|
|
459
|
+
self.changeContentVisibility(true);
|
|
460
|
+
} else if (metric < self.master.geometricErrorMultiplier * self.geometricError) { // Ideal LOD is past this one
|
|
461
|
+
// if children are visible and have been displayed, can be hidden
|
|
462
|
+
let allChildrenReady = true;
|
|
463
|
+
self.childrenTiles.every(child => {
|
|
464
|
+
|
|
465
|
+
if (!child.isReady()) {
|
|
466
|
+
allChildrenReady = false;
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
return true;
|
|
470
|
+
});
|
|
471
|
+
if (allChildrenReady) {
|
|
472
|
+
self.changeContentVisibility(false);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function trimTree(metric, visibilityBeforeUpdate) {
|
|
478
|
+
if (!self.hasMeshContent) return;
|
|
479
|
+
if (!self.inFrustum) { // outside frustum
|
|
480
|
+
self.disposeChildren();
|
|
481
|
+
updateNodeVisibility(metric);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
if (metric >= self.master.geometricErrorMultiplier * self.geometricError) {
|
|
485
|
+
self.disposeChildren();
|
|
486
|
+
updateNodeVisibility(metric);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
function loadJsonChildren() {
|
|
494
|
+
self.jsonChildren.forEach(childJSON => {
|
|
495
|
+
if (!childJSON.root && !childJSON.children && !childJSON.getChildren && !childJSON.content && !childJSON.contents) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
let childTile = new InstancedTile({
|
|
499
|
+
parentTile: self,
|
|
500
|
+
queryParams: self.queryParams,
|
|
501
|
+
parentGeometricError: self.geometricError,
|
|
502
|
+
parentBoundingVolume: self.boundingVolume,
|
|
503
|
+
parentRefinement: self.refinement,
|
|
504
|
+
json: childJSON,
|
|
505
|
+
rootPath: self.rootPath,
|
|
506
|
+
loadOutsideView: self.loadOutsideView,
|
|
507
|
+
level: self.level + 1,
|
|
508
|
+
tileLoader: self.tileLoader,
|
|
509
|
+
cameraOnLoad: camera,
|
|
510
|
+
master: self.master,
|
|
511
|
+
centerModel: false,
|
|
512
|
+
});
|
|
513
|
+
self.childrenTiles.push(childTile);
|
|
514
|
+
//self.add(childTile);
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
areAllChildrenLoadedAndHidden() {
|
|
521
|
+
let allLoadedAndHidden = true;
|
|
522
|
+
const self = this;
|
|
523
|
+
this.childrenTiles.every(child => {
|
|
524
|
+
if (child.hasMeshContent) {
|
|
525
|
+
if (child.childrenTiles.length > 0) {
|
|
526
|
+
allLoadedAndHidden = false;
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
if (!child.inFrustum) {
|
|
530
|
+
return true;
|
|
531
|
+
};
|
|
532
|
+
if (!child.materialVisibility || child.meshesToDisplay != child.meshesDisplayed) {
|
|
533
|
+
allLoadedAndHidden = false;
|
|
534
|
+
return false;
|
|
535
|
+
}
|
|
536
|
+
} else {
|
|
537
|
+
if (!child.areAllChildrenLoadedAndHidden()) {
|
|
538
|
+
allLoadedAndHidden = false;
|
|
539
|
+
return false;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return true;
|
|
543
|
+
});
|
|
544
|
+
return allLoadedAndHidden;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Node is ready if it is outside frustum, if it was drawn at least once or if all it's children are ready
|
|
549
|
+
* @returns true if ready
|
|
550
|
+
*/
|
|
551
|
+
isReady() {
|
|
552
|
+
// if outside frustum
|
|
553
|
+
if (!this.inFrustum) return true;
|
|
554
|
+
|
|
555
|
+
// if json is not done loading
|
|
556
|
+
if (this.hasUnloadedJSONContent) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
if ((!this.hasMeshContent || this.meshContent.size == 0 || !this.materialVisibility)) {
|
|
560
|
+
if (this.childrenTiles.length > 0) {
|
|
561
|
+
var allChildrenReady = true;
|
|
562
|
+
this.childrenTiles.every(child => {
|
|
563
|
+
if (!child.isReady()) {
|
|
564
|
+
allChildrenReady = false;
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
return true;
|
|
568
|
+
});
|
|
569
|
+
return allChildrenReady;
|
|
570
|
+
} else {
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
}
|
|
575
|
+
// if this tile has no mesh content
|
|
576
|
+
if (!this.hasMeshContent) {
|
|
577
|
+
return true;
|
|
578
|
+
}
|
|
579
|
+
// if mesh content not yet loaded
|
|
580
|
+
if (this.meshContent.size < this.hasMeshContent) {
|
|
581
|
+
return false;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// if this tile has been marked to hide it's content
|
|
585
|
+
if (!this.materialVisibility) {
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
return true;
|
|
591
|
+
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
changeContentVisibility(visibility) {
|
|
596
|
+
const self = this;
|
|
597
|
+
self.materialVisibility = visibility;
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
}
|
|
602
|
+
calculateUpdateMetric(camera, frustum) {
|
|
603
|
+
////// return -1 if not in frustum
|
|
604
|
+
if (this.boundingVolume instanceof OBB) {
|
|
605
|
+
// box
|
|
606
|
+
tempSphere.copy(this.boundingVolume.sphere);
|
|
607
|
+
tempSphere.applyMatrix4(this.matrixWorld);
|
|
608
|
+
if (!frustum.intersectsSphere(tempSphere)) return -1;
|
|
609
|
+
} else if (this.boundingVolume instanceof THREE.Sphere) {
|
|
610
|
+
//sphere
|
|
611
|
+
tempSphere.copy(this.boundingVolume);
|
|
612
|
+
tempSphere.applyMatrix4(this.matrixWorld);
|
|
613
|
+
if (!frustum.intersectsSphere(tempSphere)) return -1;
|
|
614
|
+
} else {
|
|
615
|
+
console.error("unsupported shape");
|
|
616
|
+
return -1
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/////// return metric based on geometric error and distance
|
|
620
|
+
|
|
621
|
+
const distance = Math.max(0, camera.position.distanceTo(tempSphere.center) - tempSphere.radius);
|
|
622
|
+
|
|
623
|
+
/////// Apply the bias factor to the distance
|
|
624
|
+
distance = Math.pow(distance,this.distanceBias);
|
|
625
|
+
|
|
626
|
+
if (distance == 0) {
|
|
627
|
+
return 0;
|
|
628
|
+
}
|
|
629
|
+
const scale = this.matrixWorld.getMaxScaleOnAxis();
|
|
630
|
+
this.master._renderSize(rendererSize);
|
|
631
|
+
let s = rendererSize.y;
|
|
632
|
+
let fov = camera.fov;
|
|
633
|
+
if (camera.aspect < 1) {
|
|
634
|
+
fov *= camera.aspect;
|
|
635
|
+
s = rendererSize.x;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
let lambda = 2.0 * Math.tan(0.5 * fov * 0.01745329251994329576923690768489) * distance;
|
|
639
|
+
|
|
640
|
+
return (window.devicePixelRatio * 16 * lambda) / (s * scale);
|
|
641
|
+
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
getSiblings() {
|
|
645
|
+
const self = this;
|
|
646
|
+
const tiles = [];
|
|
647
|
+
if (!self.parentTile) return tiles;
|
|
648
|
+
let p = self.parentTile;
|
|
649
|
+
while (!p.hasMeshContent && !!p.parentTile) {
|
|
650
|
+
p = p.parentTile;
|
|
651
|
+
}
|
|
652
|
+
p.childrenTiles.forEach(child => {
|
|
653
|
+
if (!!child && child != self) {
|
|
654
|
+
while (!child.hasMeshContent && !!child.childrenTiles[0]) {
|
|
655
|
+
child = child.childrenTiles[0];
|
|
656
|
+
}
|
|
657
|
+
tiles.push(child);
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
return tiles;
|
|
661
|
+
}
|
|
662
|
+
calculateDistanceToCamera(camera) {
|
|
663
|
+
if (this.boundingVolume instanceof OBB) {
|
|
664
|
+
// box
|
|
665
|
+
tempSphere.copy(this.boundingVolume.sphere);
|
|
666
|
+
tempSphere.applyMatrix4(this.matrixWorld);
|
|
667
|
+
//if (!frustum.intersectsSphere(tempSphere)) return -1;
|
|
668
|
+
} else if (this.boundingVolume instanceof THREE.Sphere) {
|
|
669
|
+
//sphere
|
|
670
|
+
tempSphere.copy(this.boundingVolume);
|
|
671
|
+
tempSphere.applyMatrix4(this.matrixWorld);
|
|
672
|
+
//if (!frustum.intersectsSphere(tempSphere)) return -1;
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
console.error("unsupported shape")
|
|
676
|
+
}
|
|
677
|
+
return Math.max(0, camera.position.distanceTo(tempSphere.center) - tempSphere.radius);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
getWorldMatrix() {
|
|
681
|
+
const self = this;
|
|
682
|
+
return self.matrixWorld;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
transformWGS84ToCartesian(lon, lat, h, sfct) {
|
|
686
|
+
const a = 6378137.0;
|
|
687
|
+
const e = 0.006694384442042;
|
|
688
|
+
const N = a / (Math.sqrt(1.0 - (e * Math.pow(Math.sin(lat), 2))));
|
|
689
|
+
const cosLat = Math.cos(lat);
|
|
690
|
+
const cosLon = Math.cos(lon);
|
|
691
|
+
const sinLat = Math.sin(lat);
|
|
692
|
+
const sinLon = Math.sin(lon);
|
|
693
|
+
const nPh = (N + h);
|
|
694
|
+
const x = nPh * cosLat * cosLon;
|
|
695
|
+
const y = nPh * cosLat * sinLon;
|
|
696
|
+
const z = (0.993305615557957 * N + h) * sinLat;
|
|
697
|
+
|
|
698
|
+
sfct.set(x, y, z);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
export { InstancedTile };</code></pre></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><div class="mobile-nav-links"></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="InstancedOGC3DTile.html">InstancedOGC3DTile</a></div><div class="sidebar-section-children"><a href="InstancedTile.html">InstancedTile</a></div><div class="sidebar-section-children"><a href="InstancedTileLoader.html">InstancedTileLoader</a></div><div class="sidebar-section-children"><a href="OGC3DTile.html">OGC3DTile</a></div><div class="sidebar-section-children"><a href="OcclusionCullingService.html">OcclusionCullingService</a></div><div class="sidebar-section-children"><a href="TileLoader.html">TileLoader</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#getOGC3DTilesCopyrightInfo">getOGC3DTilesCopyrightInfo</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
|