From 9018b253dfb1f06c959dccd6d659ca4e29b7efc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Mal=C3=BD?= Date: Tue, 29 Jan 2019 10:25:15 +0100 Subject: [PATCH] fix that coarseness test with disks ignored fov --- browser/src/vts-libbrowser/camera/camera.cpp | 4 +++- browser/src/vts-libbrowser/camera/camera.hpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/browser/src/vts-libbrowser/camera/camera.cpp b/browser/src/vts-libbrowser/camera/camera.cpp index a9cea36c..d29fb734 100644 --- a/browser/src/vts-libbrowser/camera/camera.cpp +++ b/browser/src/vts-libbrowser/camera/camera.cpp @@ -44,6 +44,7 @@ OldDraw::OldDraw(const TileId &id) : trav(id), orig(id), age(0) CameraImpl::CameraImpl(MapImpl *map, Camera *cam) : map(map), camera(cam), + diskNominalDistance(0), windowWidth(0), windowHeight(0) {} @@ -182,7 +183,7 @@ double CameraImpl::coarsenessValue(TraverseNode *trav) double dist = distanceToDisk(trav->diskNormalPhys, trav->diskHeightsPhys, trav->diskHalfAngle, cameraPosPhys); - double v = texelSize * windowHeight / dist; + double v = texelSize * diskNominalDistance / dist; assert(v == v && v > 0); return v; } @@ -571,6 +572,7 @@ void CameraImpl::renderUpdate() vts::frustumPlanes(viewProjCulling, cullingPlanes); cameraPosPhys = eye; focusPosPhys = target; + diskNominalDistance = windowHeight * apiProj(1, 1) * 0.5; } else { diff --git a/browser/src/vts-libbrowser/camera/camera.hpp b/browser/src/vts-libbrowser/camera/camera.hpp index 90bcf367..86175ccd 100644 --- a/browser/src/vts-libbrowser/camera/camera.hpp +++ b/browser/src/vts-libbrowser/camera/camera.hpp @@ -122,6 +122,7 @@ class CameraImpl vec3 cameraPosPhys; vec3 focusPosPhys; vec3 eye, target, up; + double diskNominalDistance; uint32 windowWidth; uint32 windowHeight;