X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=src%2Fgis-opengl.c;h=a70c6a8ebb3e251fda82c3a24ab2b711a514d5af;hb=bcdeec5b92de26d6892f0db3b213d1a8d281f390;hp=8f03e8df4cc9c95f568877dfc2c1d7d7ce7ad625;hpb=e589cb4bee133b2df34853fbbcc24355e1f2f4c9;p=grits diff --git a/src/gis-opengl.c b/src/gis-opengl.c index 8f03e8d..a70c6a8 100644 --- a/src/gis-opengl.c +++ b/src/gis-opengl.c @@ -233,6 +233,7 @@ static void _draw_marker(GisOpenGL *opengl, GisMarker *marker) gis_viewer_project(GIS_VIEWER(opengl), point->lat, point->lon, point->elev, &px, &py, &pz); + gint win_width = GTK_WIDGET(opengl)->allocation.width; gint win_height = GTK_WIDGET(opengl)->allocation.height; py = win_height - py; @@ -275,14 +276,23 @@ static void _draw_object(GisOpenGL *opengl, GisObject *object) //g_debug("GisOpenGL: draw_object"); /* Skip out of range objects */ if (object->lod > 0) { + /* LOD test */ gdouble eye[3], obj[3]; gis_viewer_get_location(GIS_VIEWER(opengl), &eye[0], &eye[1], &eye[2]); + gdouble elev = eye[2]; lle2xyz(eye[0], eye[1], eye[2], &eye[0], &eye[1], &eye[2]); lle2xyz(object->center.lat, object->center.lon, object->center.elev, &obj[0], &obj[1], &obj[2]); gdouble dist = distd(obj, eye); if (object->lod < dist) return; + + /* Horizon testing */ + gdouble c = EARTH_R+elev; + gdouble a = EARTH_R; + gdouble horizon = sqrt(c*c - a*a); + if (dist > horizon) + return; } /* Draw */