--- libgender/oct.C 2004/11/07 02:28:18 1.71 +++ libgender/oct.C 2004/11/07 03:05:41 1.73 @@ -9,7 +9,7 @@ #include "view.h" #include "entity.h" -enum visibility_state { FULL, PARTIAL, SMALL, OCCLUDED }; +enum visibility_state { FULL, PARTIAL, SMALL, OCCLUDED, SUBTREE_OCCLUDED }; struct evis { visibility_state state; @@ -158,6 +158,12 @@ ctx.nc_far = max (ctx.nc_far, z); #endif + if (vs.state == SUBTREE_OCCLUDED) + { + ctx.vislist.push_back (this); + return false; + } + // node to start with unsigned char si = centeri.x > 0 ? 1 : 0 | centeri.y > 0 ? 2 : 0 @@ -167,7 +173,7 @@ static unsigned char toggle[8+1] = { 0, 0^1, 1^2, 2^4, 4^3, 3^5, 5^6, 6^7, 0 }; - bool visible = vs.state == PARTIAL || vs.state == FULL; + bool visible = size () && (vs.state == PARTIAL || vs.state == FULL); unsigned char *next = toggle; do @@ -186,7 +192,7 @@ } else { - vs.state = OCCLUDED; + vs.state = SUBTREE_OCCLUDED; ctx.vislist.push_back (this); } @@ -197,7 +203,7 @@ { oct_visibility &vs = *(oct_visibility *)get_visibility (ctx); - if (vs.state == OCCLUDED) + if (vs.state == OCCLUDED || vs.state == SUBTREE_OCCLUDED) { if (ctx.pass_type == view::POSTDEPTH) { @@ -243,7 +249,7 @@ ctx.nz_far = max (ctx.nz_far, z + extent); ctx.nz_near = min (ctx.nz_near, z - extent); - if (ctx.pass_type == view::DEPTH || evs.last + 0.3 > timer.now) + if (ctx.pass_type == view::DEPTH || evs.last + 0.1 > timer.now) e->draw (ctx); else {