From ab3a9af6bfc36e5ebeaff1f2e969185cb4faded6 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 8 Apr 2014 17:31:30 -0700 Subject: [PATCH] repair the starfield renderer --- interface/src/starfield/renderer/Renderer.h | 51 ++++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/interface/src/starfield/renderer/Renderer.h b/interface/src/starfield/renderer/Renderer.h index 7eaeb1444e..8b75f4e953 100755 --- a/interface/src/starfield/renderer/Renderer.h +++ b/interface/src/starfield/renderer/Renderer.h @@ -9,6 +9,54 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#ifndef __interface__starfield__renderer__Renderer__ +#define __interface__starfield__renderer__Renderer__ + +#include "starfield/Config.h" +#include "starfield/data/InputVertex.h" +#include "starfield/data/Tile.h" +#include "starfield/data/GpuVertex.h" +#include "starfield/renderer/Tiling.h" + +// +// FOV culling +// =========== +// +// As stars can be thought of as at infinity distance, the field of view only +// depends on perspective and rotation: +// +// _----_ <-- visible stars +// from above +-near-+ - - +// \ / | +// near width: \ / | cos(p/2) +// 2sin(p/2) \/ _ +// center +// +// +// Now it is important to note that a change in altitude maps uniformly to a +// distance on a sphere. This is NOT the case for azimuthal angles: In this +// case a factor of 'cos(alt)' (the orbital radius) applies: +// +// +// |<-cos alt ->| | |<-|<----->|->| d_azi cos(alt) +// | +// __--* | --------- - +// __-- * | | | ^ d_alt +// __-- alt) * | | | v +// --------------*- | ------------- - +// | +// side view | tile on sphere +// +// +// This lets us find a worst-case (Eigen) angle from the center to the edge +// of a tile as +// +// hypot( 0.5 d_alt, 0.5 d_azi cos(alt_absmin) ). +// +// This angle must be added to 'p' (the perspective angle) in order to find +// an altered near plane for the culling decision. +// + namespace starfield { class Renderer { @@ -90,5 +138,4 @@ namespace starfield { } -#endif - +#endif \ No newline at end of file