ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/oct.C
(Generate patch)

Comparing libgender/oct.C (file contents):
Revision 1.43 by root, Sat Oct 9 21:25:18 2004 UTC vs.
Revision 1.44 by root, Sat Oct 9 22:43:31 2004 UTC

80 GLfloat extent2 = 0.5F * (GLfloat)extent; 80 GLfloat extent2 = 0.5F * (GLfloat)extent;
81 point center = point (orig + (extent >> 1) - ctx.orig); 81 point center = point (orig + (extent >> 1) - ctx.orig);
82 if (extent & 1) center = center + 0.5F; 82 if (extent & 1) center = center + 0.5F;
83 GLfloat rad = ctx.diagfact * extent2; 83 GLfloat rad = ctx.diagfact * extent2;
84 84
85 if (vs.generation != ctx.generation) 85 if (vs.generation + 1 < ctx.generation)
86 vs.visibility = visibility_state::UNKNOWN; 86 vs.visibility = visibility_state::UNKNOWN;
87 87
88 vs.generation = ctx.generation; 88 vs.generation = ctx.generation;
89 89
90#if 0
90 if (orig <= ctx.orig && ctx.orig <= orig + extent) 91 if (orig <= ctx.orig && ctx.orig <= orig + extent)
91 vs.visibility = visibility_state::PARTIAL; 92 vs.visibility = visibility_state::PARTIAL;
92 else 93 else
94#endif
93 { 95 {
94 if (ctx.frustum.t.distance (center) < -rad) return; 96 if (ctx.frustum.t.distance (center) < -rad) return;
95 if (ctx.frustum.b.distance (center) < -rad) return; 97 if (ctx.frustum.b.distance (center) < -rad) return;
96 if (ctx.frustum.l.distance (center) < -rad) return; 98 if (ctx.frustum.l.distance (center) < -rad) return;
97 if (ctx.frustum.r.distance (center) < -rad) return; 99 if (ctx.frustum.r.distance (center) < -rad) return;
119 && (vs.visibility == visibility_state::PARTIAL 121 && (vs.visibility == visibility_state::PARTIAL
120 || vs.visibility == visibility_state::FULL)) 122 || vs.visibility == visibility_state::FULL))
121 { 123 {
122 ctx.nextfar = max (ctx.nextfar, ctx.near + ctx.frustum.n.distance (center) + extent); 124 ctx.nextfar = max (ctx.nextfar, ctx.near + ctx.frustum.n.distance (center) + extent);
123 ctx.vislist.push_back (this); 125 ctx.vislist.push_back (this);
126 }
127
128 if (vs.visibility == visibility_state::OCCLUDED)
129 {
130 ctx.farlist.push_back (this);
131 return;
124 } 132 }
125 133
126 // node to start with 134 // node to start with
127 unsigned char si = ctx.d.x < 0 ? 1 : 0 135 unsigned char si = ctx.d.x < 0 ? 1 : 0
128 | ctx.d.y < 0 ? 2 : 0 136 | ctx.d.y < 0 ? 2 : 0
178 gl::draw_box (ctx, s, s + extent); 186 gl::draw_box (ctx, s, s + extent);
179} 187}
180 188
181void octant::event (occ_query &ev) 189void octant::event (occ_query &ev)
182{ 190{
183 ev.v.vismap[this].visibility = visibility_state::FULL; 191 visibility_state &vs = ev.v.vismap[this];
184 return; 192
193 vs.last = timer.now;
185 ev.v.vismap[this].visibility = ev.r < 4 194 vs.visibility = ev.r < 4
186 ? visibility_state::OCCLUDED 195 ? visibility_state::OCCLUDED
187 : visibility_state::FULL; 196 : visibility_state::FULL;
188 printf ("OCT(%x,%x,%x+%x) samples %d\n", orig.x, orig.y, orig.z, extent, ev.r); 197 //printf ("OCT(%x,%x,%x+%x) samples %d\n", orig.x, orig.y, orig.z, extent, ev.r);
189} 198}
190 199

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines