Replace deltaLod with minLod. Increase max node count. Navigation cam slope has been changed.

This commit is contained in:
Zemledelec 2018-12-01 16:17:19 +03:00
parent 704d9e628e
commit c0463fa899
7 changed files with 15 additions and 29 deletions

View File

@ -221,7 +221,7 @@ class MouseNavigation extends Control {
var cam = this.renderer.activeCamera;
if (cam.slope > 0.28) {
if (cam.slope > 0.2) {
var targetPoint = new Ray(cam.eye, e.direction).hitSphere(this.grabbedSpheroid);
if (targetPoint) {
this.scaleRot = 1;

View File

@ -230,7 +230,7 @@ class TouchNavigation extends Control {
var targetPoint = new Ray(cam.eye, direction).hitSphere(t.grabbedSpheroid);
if (targetPoint) {
if (cam._n.dot(cam.eye.normal()) > 0.28) {
if (cam.slope > 0.2) {
this.qRot = Quat.getRotationBetweenVectors(targetPoint.normal(), t.grabbedPoint.normal());
var rot = this.qRot;
cam.eye = rot.mulVec3(cam.eye);

View File

@ -1,7 +1,3 @@
/**
* @module og/quadTree/Node
*/
'use strict';
import { Extent } from '../Extent.js';
@ -394,7 +390,7 @@ Node.prototype.renderTree = function (cam, maxZoom) {
let h = cam._lonLat.height;
let inFrustum = inExcFrustum && cam.frustum.containsSphereButtom(seg.bsphere),
altVis = cam.eye.distance(seg.bsphere.center) - seg.bsphere.radius < 3570.0 * Math.sqrt(h);
altVis = cam.eye.distance(seg.bsphere.center) - seg.bsphere.radius < VISIBLE_DISTANCE * Math.sqrt(h);
if (inFrustum && (altVis || h > 10000.0) || this._cameraInside) {
seg._collectVisibleNodes();

View File

@ -1,11 +1,7 @@
/**
* @module og/quadTree/quadTree
*/
'use strict';
export const VISIBLE_DISTANCE = 3570;
export const MAX_RENDERED_NODES = 150;
export const VISIBLE_DISTANCE = 3570.0;
export const MAX_RENDERED_NODES = 250;
export const NW = 0;
export const NE = 1;

View File

@ -38,8 +38,8 @@ import { SPECULAR } from '../res/spec.js';
import { Plane } from '../math/Plane.js';
import { Geoid } from '../terrain/Geoid.js';
const DEFAULT_LOD_RATIO = 0.98;
const DELTA_LOD = 0.35;
const MAX_LOD = 0.98;
const MIN_LOD = MAX_LOD - 0.35;
/**
* Maximum created nodes count. The more nodes count the more memory usage.
@ -350,9 +350,9 @@ class Planet extends RenderNode {
* @public
* @type {number}
*/
this._lodRatio = DEFAULT_LOD_RATIO;
this._maxLodRatio = this._lodRatio;
this._minLodRatio = this._maxLodRatio - DELTA_LOD;
this._lodRatio = MAX_LOD;
this._maxLodRatio = MAX_LOD;
this._minLodRatio = MIN_LOD;
this._diffuseMaterialArr = new Float32Array(this.SLICE_SIZE_3 + 3);
@ -400,9 +400,10 @@ class Planet extends RenderNode {
control.addTo(this.renderer);
}
setRatioLod(v) {
this._maxLodRatio = v;
this._minLodRatio = v - DELTA_LOD;
setRatioLod(maxLod, minLod) {
this._maxLodRatio = maxLod;
if (minLod)
this._minLodRatio = minLod;
}
/**

View File

@ -74,7 +74,7 @@ NormalMapCreator.prototype._init = function () {
"blurCoordinates[4] = vt - " + (1.0 / this._height * 3.294215) + ";" +
"}",
fragmentShader:
"precision highp float;\n\
"precision lowp float;\n\
uniform sampler2D s_texture; \n\
\n\
varying vec2 blurCoordinates[5]; \n\
@ -304,9 +304,6 @@ NormalMapCreator.prototype.frame = function () {
var deltaTime = 0,
startTime = window.performance.now();
var width = this._width,
height = this._height;
while (this._lock.isFree() && this._queue.length && deltaTime < 0.25) {
var segment = this._queue.shift();
if (segment.terrainReady && this._drawNormalMap(segment)) {

View File

@ -1,7 +1,3 @@
/**
* @module og/utils/TerrainWorker
*/
'use sctrict';
import { QueueArray } from '../QueueArray.js';