]> Pileus Git - grits/commitdiff
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 9f1940bdfdb5d33d177f5e81114546a81a3345fe..57cfb471e901894d3b510c9f0e3b99aabbf50b10 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 4ebf7ef190ac3a8d731431c7046fd3cf8f4e5a2c..e2b72524f53d430e4c12cf0746bccb809e905e4e 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 66150be765791ecd401fa09975ee9d7bc7f1846d..9e1af30e6a5eca5a561c19aac13be5814b4426a9 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;
 }