… | |
… | |
142 | if (ctx.frustum.t.distance (center) < -dia) return; |
142 | if (ctx.frustum.t.distance (center) < -dia) return; |
143 | if (ctx.frustum.b.distance (center) < -dia) return; |
143 | if (ctx.frustum.b.distance (center) < -dia) return; |
144 | if (ctx.frustum.l.distance (center) < -dia) return; |
144 | if (ctx.frustum.l.distance (center) < -dia) return; |
145 | if (ctx.frustum.r.distance (center) < -dia) return; |
145 | if (ctx.frustum.r.distance (center) < -dia) return; |
146 | if (ctx.frustum.n.distance (center) < -dia) return; |
146 | if (ctx.frustum.n.distance (center) < -dia) return; |
147 | if (ctx.frustum.f.distance (center) < -dia) return; |
147 | |
|
|
148 | GLfloat fd = ctx.frustum.f.distance (center); |
|
|
149 | |
|
|
150 | if (fd < -dia) |
|
|
151 | { |
|
|
152 | // but _do_ check |
|
|
153 | ctx.farlist.push_back (this); |
|
|
154 | return; |
|
|
155 | } |
148 | } |
156 | } |
149 | |
157 | |
150 | if (size ()) |
158 | if (size ()) |
151 | ctx.vislist.push_back (this); |
159 | ctx.vislist.push_back (this); |
152 | |
160 | |
… | |
… | |
172 | |
180 | |
173 | void octant::display (view &ctx) |
181 | void octant::display (view &ctx) |
174 | { |
182 | { |
175 | #if 0 |
183 | #if 0 |
176 | glBegin (GL_LINES); |
184 | glBegin (GL_LINES); |
177 | sector s = orig; |
185 | sector s = orig - ctx.orig; |
178 | s.x -= ctx.orig.x; |
|
|
179 | s.y -= ctx.orig.y; |
|
|
180 | s.z -= ctx.orig.z; |
|
|
181 | vec3 clr(0, 0.8, 0); |
186 | vec3 clr(0, 0.8, 0); |
182 | glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, (const GLfloat*)&clr); |
187 | glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, (const GLfloat*)&clr); |
183 | |
188 | |
184 | for (int i = 8; i--; ) |
189 | for (int i = 8; i--; ) |
185 | for (int ji = 3; ji--; ) |
190 | for (int ji = 3; ji--; ) |
… | |
… | |
198 | |
203 | |
199 | glEnd (); |
204 | glEnd (); |
200 | glDisable(GL_COLOR_MATERIAL); |
205 | glDisable(GL_COLOR_MATERIAL); |
201 | #endif |
206 | #endif |
202 | |
207 | |
203 | occ_query = begin_occ_query (); |
|
|
204 | ctx.checklist.push_back (this); |
|
|
205 | for (iterator i = end (); i != begin (); ) |
208 | for (iterator i = end (); i != begin (); ) |
206 | (*--i)->display (ctx); |
209 | (*--i)->display (ctx); |
207 | end_occ_query (); |
|
|
208 | } |
210 | } |
209 | |
211 | |
|
|
212 | void |
|
|
213 | octant::draw_bbox (view &ctx) |
|
|
214 | { |
|
|
215 | sector s = orig - ctx.orig; |
210 | |
216 | |
|
|
217 | GLfloat cube[8][3] = |
|
|
218 | { |
|
|
219 | { s.x + (soffs)extent, s.y + (soffs)extent, s.z }, |
|
|
220 | { s.x + (soffs)extent, s.y , s.z }, |
|
|
221 | { s.x , s.y , s.z }, |
|
|
222 | { s.x , s.y + (soffs)extent, s.z }, |
|
|
223 | { s.x , s.y + (soffs)extent, s.z + (soffs)extent }, |
|
|
224 | { s.x + (soffs)extent, s.y + (soffs)extent, s.z + (soffs)extent }, |
|
|
225 | { s.x + (soffs)extent, s.y , s.z + (soffs)extent }, |
|
|
226 | { s.x , s.y , s.z + (soffs)extent }, |
|
|
227 | }; |
211 | |
228 | |
|
|
229 | glBegin (GL_QUADS); |
|
|
230 | glVertex3fv (cube [0]); glVertex3fv (cube [1]); glVertex3fv (cube [2]); glVertex3fv (cube [3]); |
|
|
231 | glVertex3fv (cube [3]); glVertex3fv (cube [4]); glVertex3fv (cube [7]); glVertex3fv (cube [2]); |
|
|
232 | glVertex3fv (cube [0]); glVertex3fv (cube [5]); glVertex3fv (cube [6]); glVertex3fv (cube [1]); |
|
|
233 | glVertex3fv (cube [5]); glVertex3fv (cube [4]); glVertex3fv (cube [7]); glVertex3fv (cube [6]); |
|
|
234 | glVertex3fv (cube [5]); glVertex3fv (cube [0]); glVertex3fv (cube [3]); glVertex3fv (cube [4]); |
|
|
235 | glVertex3fv (cube [6]); glVertex3fv (cube [1]); glVertex3fv (cube [2]); glVertex3fv (cube [7]); |
|
|
236 | glEnd (); |
|
|
237 | } |
|
|
238 | |
|
|
239 | |