… | |
… | |
119 | |
119 | |
120 | if (vs.generation != ctx.generation) |
120 | if (vs.generation != ctx.generation) |
121 | vs.visibility = visibility_state::UNKNOWN; |
121 | vs.visibility = visibility_state::UNKNOWN; |
122 | |
122 | |
123 | const sector &cam = ctx.v.orig; |
123 | const sector &cam = ctx.v.orig; |
|
|
124 | #if 0 |
124 | if (cam.x >= orig.x && cam.x <= orig.x + extent |
125 | if (cam.x >= orig.x && cam.x <= orig.x + extent |
125 | && cam.y >= orig.y && cam.y <= orig.y + extent |
126 | && cam.y >= orig.y && cam.y <= orig.y + extent |
126 | && cam.z >= orig.z && cam.z <= orig.z + extent) |
127 | && cam.z >= orig.z && cam.z <= orig.z + extent) |
127 | { |
128 | { |
128 | vs.visibility = visibility_state::PARTIAL; |
129 | vs.visibility = visibility_state::PARTIAL; |
129 | vs.generation = ctx.generation; |
130 | vs.generation = ctx.generation; |
130 | } |
131 | } |
131 | else |
132 | else |
|
|
133 | #endif |
132 | { |
134 | { |
133 | //printf ("OCTANT %d,%d,%d+%d\n", orig.x, orig.y, orig.z, extent); |
135 | //printf ("OCTANT %d,%d,%d+%d\n", orig.x, orig.y, orig.z, extent); |
134 | point center ( |
136 | point center ( |
135 | orig.x + (soffs)extent / 2 - cam.x, |
137 | orig.x + (soffs)extent / 2 - cam.x , |
136 | orig.y + (soffs)extent / 2 - cam.y, |
138 | orig.y + (soffs)extent / 2 - cam.y , |
137 | orig.z + (soffs)extent / 2 - cam.z |
139 | orig.z + (soffs)extent / 2 - cam.z |
138 | ); |
140 | ); |
139 | |
141 | |
140 | if (size () && center.x > 0 && center.y > 0) |
142 | GLfloat dia = (0.5 * sqrtf (3))*(GLfloat)extent; |
141 | { |
143 | |
142 | #if 0 |
144 | #if 0 |
143 | printf ("DISTANCE %f,%f,%f TO near: %f\n", |
145 | printf ("DISTANCE %f,%f,%f TO near: %f\n", |
144 | center.x, center.y, center.z, |
146 | center.x, center.y, center.z, |
145 | ctx.frustum.n.distance (center) |
147 | ctx.frustum.n.distance (center) |
146 | ); |
148 | ); |
… | |
… | |
149 | printf ("DISTANCE %f,%f,%f TO far: %f\n", |
151 | printf ("DISTANCE %f,%f,%f TO far: %f\n", |
150 | center.x, center.y, center.z, |
152 | center.x, center.y, center.z, |
151 | ctx.frustum.f.distance (center) |
153 | ctx.frustum.f.distance (center) |
152 | ); |
154 | ); |
153 | #endif |
155 | #endif |
154 | } |
|
|
155 | #if 1 |
156 | #if 1 |
|
|
157 | if (ctx.frustum.t.distance (center) < -dia) return; |
|
|
158 | if (ctx.frustum.b.distance (center) < -dia) return; |
|
|
159 | if (ctx.frustum.l.distance (center) < -dia) return; |
|
|
160 | if (ctx.frustum.r.distance (center) < -dia) return; |
156 | if (ctx.frustum.n.distance (center) < -extent) |
161 | if (ctx.frustum.n.distance (center) < -dia) return; |
157 | return; //cull |
162 | if (ctx.frustum.f.distance (center) < -dia) return; |
158 | #endif |
163 | #endif |
159 | |
164 | |
160 | } |
165 | } |
161 | |
166 | |
162 | #if 1 |
167 | #if 1 |