[grits] Fix clipping plane issues



commit 773d3969b71ac45d11ac8ca431167a2a063ec06e
Author: Andy Spencer <andy753421 gmail com>
Date:   Sun Jan 8 23:06:16 2012 +0000

    Fix clipping plane issues
    
    The clipping plane is flat, so the distance between the camera and the
    clipping plane varies based on where screen location. I.e. it is closest
    in the center and farther at the corners. Add a offset to elev to
    account of this. It would be better to use a sin or to calculate
    distances directly, but this is easy and appears to work.

 src/grits-opengl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/grits-opengl.c b/src/grits-opengl.c
index dc13ea2..323e7f3 100644
--- a/src/grits-opengl.c
+++ b/src/grits-opengl.c
@@ -69,8 +69,8 @@ static void _set_visuals(GritsOpenGL *opengl)
 	double height = GTK_WIDGET(opengl)->allocation.height;
 	double ang    = atan(height/FOV_DIST);
 	double atmos  = 100000;
-	double near   = MAX(elev - atmos, 10);    // View 100km of atmosphere
-	double far    = elev + 2*EARTH_R + atmos; // on both sides of the earth
+	double near   = MAX(elev*0.75 - atmos, 50); // View 100km of atmosphere
+	double far    = elev + 2*EARTH_R + atmos;   // on both sides of the earth
 
 	grits_viewer_get_location(GRITS_VIEWER(opengl), &lat, &lon, &elev);
 	glViewport(0, 0, width, height);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]