Merge remote-tracking branch 'origin/920-support-orthographic-camera-for-the-globe-navigation' into 920-support-orthographic-camera-for-the-globe-navigation

This commit is contained in:
Michael Gevlich 2025-09-05 15:52:42 +04:00
commit c3598c52de
2 changed files with 18 additions and 8 deletions

View File

@ -281,18 +281,28 @@ class Node {
let h = Math.abs(cam._lonLat.height);
let horizonDist = cam.eye.length2() - planet.ellipsoid.polarSizeSqr;
horizonDist = horizonDist < 106876472875.63281 * planet._heightFactor ? 106876472875.63281 * planet._heightFactor : horizonDist;
let maxDist = 106876472875.63281 * planet._heightFactor;
horizonDist = horizonDist < maxDist ? maxDist : horizonDist;
let altVis = seg.tileZoom < 2 || seg.tileZoom > 19 ||
/* Could be replaced with camera frustum always looking down check,
and not to go through nodes from the opposite of the globe*/
(seg.tileZoom < 6 && !seg.terrainReady);
altVis = altVis ||
cam.eye.distance2(seg._sw) < horizonDist ||
cam.eye.distance2(seg._nw) < horizonDist ||
cam.eye.distance2(seg._ne) < horizonDist ||
cam.eye.distance2(seg._se) < horizonDist;
if (cam.isOrthographic) {
let f = cam.getForward();
altVis = altVis ||
f.dot(seg._sw.getNormal()) < -0 ||
f.dot(seg._nw.getNormal()) < -0 ||
f.dot(seg._ne.getNormal()) < -0 ||
f.dot(seg._se.getNormal()) < -0;
} else {
altVis = altVis ||
cam.eye.distance2(seg._sw) < horizonDist ||
cam.eye.distance2(seg._nw) < horizonDist ||
cam.eye.distance2(seg._ne) < horizonDist ||
cam.eye.distance2(seg._se) < horizonDist;
}
if ((this.inFrustum && (altVis || h > 10000.0)) || this._cameraInside) {
this.quadTreeStrategy.collectVisibleNode(this);

View File

@ -250,7 +250,7 @@ export class QuadTreeStrategy {
this._renderedNodes = [];
}
protected _clearRenderNodesInFrustum() {
protected _clearRenderNodesInFrustum() {1
for (let i = 0, len = this._renderedNodesInFrustum.length; i < len; i++) {
this._renderedNodesInFrustum[i].length = 0;
this._renderedNodesInFrustum[i] = [];
@ -258,7 +258,7 @@ export class QuadTreeStrategy {
}
protected _collectRenderedNodesMaxZoom(cam: PlanetCamera) {
if (cam.slope > this.minEqualZoomCameraSlope && cam._lonLat.height < this.maxEqualZoomAltitude && cam._lonLat.height > this.minEqualZoomAltitude) {
if (cam.isOrthographic || cam.slope > this.minEqualZoomCameraSlope && cam._lonLat.height < this.maxEqualZoomAltitude && cam._lonLat.height > this.minEqualZoomAltitude) {
this.minCurrZoom = this.maxCurrZoom;