From: Andy Spencer Date: Mon, 19 Apr 2010 06:27:17 +0000 (+0000) Subject: Add z-index to tiles X-Git-Tag: v0.4~20 X-Git-Url: http://pileus.org/git/?p=grits;a=commitdiff_plain;h=14c34a746fc94a9e5477d081275f04bd1c8b5d6d;hp=bbf8154058e9cbae03ebb55cd92f804db4f490aa Add z-index to tiles Tiles are still drawn on the ground, Z-indexes are used as polygon offsets so that you can draw things like composite radar images above the satellite imagery. --- diff --git a/src/gis-opengl.c b/src/gis-opengl.c index 9f1940b..57cfb47 100644 --- a/src/gis-opengl.c +++ b/src/gis-opengl.c @@ -178,7 +178,9 @@ static void _draw_tile(GisOpenGL *opengl, GisTile *tile, GList *triangles) if (lat[2] == 90 || lat[2] == -90) xy[2][0] = 0.5; glEnable(GL_TEXTURE_2D); + glEnable(GL_POLYGON_OFFSET_FILL); glBindTexture(GL_TEXTURE_2D, *(guint*)tile->data); + glPolygonOffset(0, -tile->zindex); glBegin(GL_TRIANGLES); glNormal3dv(tri->p.r->norm); glTexCoord2dv(xy[0]); glVertex3dv((double*)tri->p.r); glNormal3dv(tri->p.m->norm); glTexCoord2dv(xy[1]); glVertex3dv((double*)tri->p.m); diff --git a/src/objects/gis-tile.h b/src/objects/gis-tile.h index 4ebf7ef..e2b7252 100644 --- a/src/objects/gis-tile.h +++ b/src/objects/gis-tile.h @@ -38,6 +38,9 @@ struct _GisTile { /* Pointer to the tile data */ gpointer data; + /* Pointer to the tile data */ + gint zindex; + /* North,South,East,West limits */ GisBBox edge; diff --git a/src/plugins/sat.c b/src/plugins/sat.c index 66150be..9e1af30 100644 --- a/src/plugins/sat.c +++ b/src/plugins/sat.c @@ -179,7 +179,7 @@ GisPluginSat *gis_plugin_sat_new(GisViewer *viewer) G_CALLBACK(_on_location_changed), sat); /* Add renderers */ - gis_viewer_add(viewer, GIS_OBJECT(sat->tiles), GIS_LEVEL_WORLD, 0); + gis_viewer_add(viewer, GIS_OBJECT(sat->tiles), GIS_LEVEL_WORLD, FALSE); return sat; }