[grits] Use depth test for partial tile drawing
- From: Andy Spencer <andys src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grits] Use depth test for partial tile drawing
- Date: Thu, 16 Feb 2012 23:19:09 +0000 (UTC)
commit 957c73ef908b76227135d0c94a4df53ebf582ccd
Author: Andy Spencer <andy753421 gmail com>
Date: Tue Feb 14 04:53:33 2012 +0000
Use depth test for partial tile drawing
If a child tile exists, draw it first and rely on the depth test to
prevent overwriting it with the parent tile.
src/objects/grits-tile.c | 40 ++++++++++++++--------------------------
1 files changed, 14 insertions(+), 26 deletions(-)
---
diff --git a/src/objects/grits-tile.c b/src/objects/grits-tile.c
index 34906e2..e2aeb45 100644
--- a/src/objects/grits-tile.c
+++ b/src/objects/grits-tile.c
@@ -64,10 +64,8 @@ GritsTile *grits_tile_new(GritsTile *parent,
tile->atime = time(NULL);
grits_bounds_set_bounds(&tile->coords, 0, 1, 1, 0);
grits_bounds_set_bounds(&tile->edge, n, s, e, w);
- if (parent) {
+ if (parent)
tile->proj = parent->proj;
- tile->zindex = parent->zindex+1;
- }
return tile;
}
@@ -456,31 +454,21 @@ static gboolean grits_tile_draw_rec(GritsTile *tile, GritsOpenGL *opengl)
return FALSE;
GritsTile *child = NULL;
- gboolean done = FALSE;
- while (!done) {
- /* Only draw children if possible */
- gboolean draw_parent = FALSE;
- grits_tile_foreach(tile, child)
- if (!child || !child->data || GRITS_OBJECT(child)->hidden)
- draw_parent = TRUE;
-
- /* Draw parent tile underneath */
- if (draw_parent) {
- GList *triangles = roam_sphere_get_intersect(opengl->sphere, FALSE,
- tile->edge.n, tile->edge.s, tile->edge.e, tile->edge.w);
- grits_tile_draw_one(tile, opengl, triangles);
- g_list_free(triangles);
- }
-
- /* Draw child tiles */
- gboolean drew_all_children = TRUE;
- grits_tile_foreach(tile, child)
- if (!grits_tile_draw_rec(child, opengl))
- drew_all_children = FALSE;
- /* Check if tiles were hidden by a thread while drawing */
- done = draw_parent || drew_all_children;
+ /* Draw child tiles */
+ gboolean draw_parent = FALSE;
+ grits_tile_foreach(tile, child)
+ if (!grits_tile_draw_rec(child, opengl))
+ draw_parent = TRUE;
+
+ /* Draw parent tile underneath using depth test */
+ if (draw_parent) {
+ GList *triangles = roam_sphere_get_intersect(opengl->sphere, FALSE,
+ tile->edge.n, tile->edge.s, tile->edge.e, tile->edge.w);
+ grits_tile_draw_one(tile, opengl, triangles);
+ g_list_free(triangles);
}
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]