… | |
… | |
151 | if (!overlap (ctx.frustum.c, sphere (centerf, rad))) |
151 | if (!overlap (ctx.frustum.c, sphere (centerf, rad))) |
152 | return false; |
152 | return false; |
153 | |
153 | |
154 | oct_visibility &vs = *(oct_visibility *)get_visibility (ctx); |
154 | oct_visibility &vs = *(oct_visibility *)get_visibility (ctx); |
155 | |
155 | |
|
|
156 | vs.state = FULL;//D |
|
|
157 | |
156 | #if 0 |
158 | #if 0 |
157 | if (max (abs (centeri)) <= extent) |
159 | if (max (abs (centeri)) <= extent) |
158 | ; |
160 | ; |
159 | else |
161 | else |
160 | { |
162 | { |
|
|
163 | #endif |
|
|
164 | |
161 | if (distance (ctx.frustum.t, centerf) < -rad) return false; |
165 | //if (distance (ctx.frustum.t, centerf) < -rad) return false; |
162 | if (distance (ctx.frustum.b, centerf) < -rad) return false; |
166 | //if (distance (ctx.frustum.b, centerf) < -rad) return false; |
163 | if (distance (ctx.frustum.l, centerf) < -rad) return false; |
167 | //if (distance (ctx.frustum.l, centerf) < -rad) return false; |
164 | if (distance (ctx.frustum.r, centerf) < -rad) return false; |
168 | //if (distance (ctx.frustum.r, centerf) < -rad) return false; |
165 | if (distance (ctx.frustum.n, centerf) < -rad) return false; |
169 | ////if (distance (ctx.frustum.n, centerf) < -rad) return false; |
166 | |
170 | |
167 | #if 0 |
171 | #if 0 |
168 | GLfloat fd = distance (ctx.frustum.f, centerf); |
172 | GLfloat fd = distance (ctx.frustum.f, centerf); |
169 | |
173 | |
170 | if (fd < -(ctx.c_far - ctx.z_far) -rad * 3.F) |
174 | if (fd < -(ctx.c_far - ctx.z_far) -rad * 3.F) |
171 | return false; |
175 | return false; |
172 | #endif |
|
|
173 | } |
|
|
174 | #endif |
176 | #endif |
175 | |
177 | |
176 | // very important, optimize? |
178 | // very important, optimize? |
177 | GLfloat z = ctx.z_near + distance (ctx.frustum.n, centerf) + rad; |
179 | GLfloat z = ctx.z_near + distance (ctx.frustum.n, centerf) + rad; |
178 | if (ctx.perspfact * extent / z < 10.) // very crude "too small to see" check |
180 | if (ctx.perspfact * extent / z < 10.) // very crude "too small to see" check |