Add z-index to tiles
authorAndy Spencer <andy753421@gmail.com>
Mon, 19 Apr 2010 06:27:17 +0000 (06:27 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 19 Apr 2010 06:27:17 +0000 (06:27 +0000)
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.

src/gis-opengl.c
src/objects/gis-tile.h
src/plugins/sat.c

index 9f1940b..57cfb47 100644 (file)
@@ -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);
index 4ebf7ef..e2b7252 100644 (file)
@@ -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;
 
index 66150be..9e1af30 100644 (file)
@@ -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;
 }