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