Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
Octree(Private) Category Reference

Instance Methods

(void) - drawOctreeFromLocation:loc:scale:
 
(void) - drawOctreeCollisionFromLocation:loc:scale:
 
(BOOL) - hasCollision
 
(void) - setHasCollision:
 
(Octree_details- octreeDetails
 

Detailed Description

Definition at line 51 of file Octree.m.

Method Documentation

◆ drawOctreeCollisionFromLocation:loc:scale:

- (void) drawOctreeCollisionFromLocation: (uint32_t)
loc: (GLfloat)
scale: (Vector) offset 

Extends class Octree.

Definition at line 270 of file Octree.m.

289 :(uint32_t)loc :(GLfloat)scale :(Vector)offset
290{
291 if (_octree[loc] == 0)
292 {
293 return;
294 }
295
296 if ((_octree[loc] != 0)&&(_collisionOctree[loc] != (unsigned char)0)) // full - draw
297 {
299
300 GLfloat red = (GLfloat)(_collisionOctree[loc])/255.0;
301 glColor4f(1.0, 0.0, 0.0, red); // 50% translucent
302
304 _collisionOctree[loc]--;
305
306 // draw a cube
307 OOGL(glDisable(GL_CULL_FACE)); // face culling
308
309 OOGL(glDisable(GL_TEXTURE_2D));
310
311 OOGLBEGIN(GL_LINE_STRIP);
312 glVertex3f(-scale + offset.x, -scale + offset.y, -scale + offset.z);
313 glVertex3f(-scale + offset.x, scale + offset.y, -scale + offset.z);
314 glVertex3f(scale + offset.x, scale + offset.y, -scale + offset.z);
315 glVertex3f(scale + offset.x, -scale + offset.y, -scale + offset.z);
316 glVertex3f(-scale + offset.x, -scale + offset.y, -scale + offset.z);
317 OOGLEND();
318
319 OOGLBEGIN(GL_LINE_STRIP);
320 glVertex3f(-scale + offset.x, -scale + offset.y, scale + offset.z);
321 glVertex3f(-scale + offset.x, scale + offset.y, scale + offset.z);
322 glVertex3f(scale + offset.x, scale + offset.y, scale + offset.z);
323 glVertex3f(scale + offset.x, -scale + offset.y, scale + offset.z);
324 glVertex3f(-scale + offset.x, -scale + offset.y, scale + offset.z);
325 OOGLEND();
326
327 OOGLBEGIN(GL_LINES);
328 glVertex3f(-scale + offset.x, -scale + offset.y, -scale + offset.z);
329 glVertex3f(-scale + offset.x, -scale + offset.y, scale + offset.z);
330
331 glVertex3f(-scale + offset.x, scale + offset.y, -scale + offset.z);
332 glVertex3f(-scale + offset.x, scale + offset.y, scale + offset.z);
333
334 glVertex3f(scale + offset.x, scale + offset.y, -scale + offset.z);
335 glVertex3f(scale + offset.x, scale + offset.y, scale + offset.z);
336
337 glVertex3f(scale + offset.x, -scale + offset.y, -scale + offset.z);
338 glVertex3f(scale + offset.x, -scale + offset.y, scale + offset.z);
339 OOGLEND();
340
341 OOGL(glEnable(GL_CULL_FACE)); // face culling
342 }
343 if (_octree[loc] > 0)
344 {
345 GLfloat sc = 0.5f * scale;
346 [self drawOctreeCollisionFromLocation:loc + _octree[loc] + 0 :sc :make_vector(offset.x - sc, offset.y - sc, offset.z - sc)];
347 [self drawOctreeCollisionFromLocation:loc + _octree[loc] + 1 :sc :make_vector(offset.x - sc, offset.y - sc, offset.z + sc)];
348 [self drawOctreeCollisionFromLocation:loc + _octree[loc] + 2 :sc :make_vector(offset.x - sc, offset.y + sc, offset.z - sc)];
349 [self drawOctreeCollisionFromLocation:loc + _octree[loc] + 3 :sc :make_vector(offset.x - sc, offset.y + sc, offset.z + sc)];
350 [self drawOctreeCollisionFromLocation:loc + _octree[loc] + 4 :sc :make_vector(offset.x + sc, offset.y - sc, offset.z - sc)];
351 [self drawOctreeCollisionFromLocation:loc + _octree[loc] + 5 :sc :make_vector(offset.x + sc, offset.y - sc, offset.z + sc)];
352 [self drawOctreeCollisionFromLocation:loc + _octree[loc] + 6 :sc :make_vector(offset.x + sc, offset.y + sc, offset.z - sc)];
353 [self drawOctreeCollisionFromLocation:loc + _octree[loc] + 7 :sc :make_vector(offset.x + sc, offset.y + sc, offset.z + sc)];
354 }
355}
#define OO_ENTER_OPENGL()
#define OOGLBEGIN
Definition OOOpenGL.h:253
#define OOGL(statement)
Definition OOOpenGL.h:251
#define OOGLEND
Definition OOOpenGL.h:254
static BOOL drawTestForCollisions
Definition Octree.m:270
voidpf uLong offset
Definition ioapi.h:140

References drawTestForCollisions, OOCheckOpenGLErrors(), OODebugBeginWireframe(), and OODebugEndWireframe().

+ Here is the call graph for this function:

◆ drawOctreeFromLocation:loc:scale:

- (void) drawOctreeFromLocation: (uint32_t)
loc: (GLfloat)
scale: (Vector) offset 

Extends class Octree.

Definition at line 170 of file Octree.m.

204 :(uint32_t)loc :(GLfloat)scale :(Vector)offset
205{
206 if (_octree[loc] == 0)
207 {
208 return;
209 }
210
212
213 if (_octree[loc] == -1) // full
214 {
215 // draw a cube
216 glVertex3f(-scale + offset.x, -scale + offset.y, -scale + offset.z);
217 glVertex3f(-scale + offset.x, scale + offset.y, -scale + offset.z);
218 glVertex3f(-scale + offset.x, scale + offset.y, -scale + offset.z);
219 glVertex3f(scale + offset.x, scale + offset.y, -scale + offset.z);
220 glVertex3f(scale + offset.x, scale + offset.y, -scale + offset.z);
221 glVertex3f(scale + offset.x, -scale + offset.y, -scale + offset.z);
222 glVertex3f(scale + offset.x, -scale + offset.y, -scale + offset.z);
223 glVertex3f(-scale + offset.x, -scale + offset.y, -scale + offset.z);
224
225
226 glVertex3f(-scale + offset.x, -scale + offset.y, scale + offset.z);
227 glVertex3f(-scale + offset.x, scale + offset.y, scale + offset.z);
228 glVertex3f(-scale + offset.x, scale + offset.y, scale + offset.z);
229 glVertex3f(scale + offset.x, scale + offset.y, scale + offset.z);
230 glVertex3f(scale + offset.x, scale + offset.y, scale + offset.z);
231 glVertex3f(scale + offset.x, -scale + offset.y, scale + offset.z);
232 glVertex3f(scale + offset.x, -scale + offset.y, scale + offset.z);
233 glVertex3f(-scale + offset.x, -scale + offset.y, scale + offset.z);
234
235 glVertex3f(-scale + offset.x, -scale + offset.y, -scale + offset.z);
236 glVertex3f(-scale + offset.x, -scale + offset.y, scale + offset.z);
237
238 glVertex3f(-scale + offset.x, scale + offset.y, -scale + offset.z);
239 glVertex3f(-scale + offset.x, scale + offset.y, scale + offset.z);
240
241 glVertex3f(scale + offset.x, scale + offset.y, -scale + offset.z);
242 glVertex3f(scale + offset.x, scale + offset.y, scale + offset.z);
243
244 glVertex3f(scale + offset.x, -scale + offset.y, -scale + offset.z);
245 glVertex3f(scale + offset.x, -scale + offset.y, scale + offset.z);
246 }
247 else if (_octree[loc] > 0)
248 {
249 GLfloat sc = 0.5f * scale;
250 OCTREE_COLOR(0.4f, 0.4f, 0.4f, 0.5f);
251 [self drawOctreeFromLocation:loc + _octree[loc] + 0 :sc :make_vector(offset.x - sc, offset.y - sc, offset.z - sc)];
252 OCTREE_COLOR(0.0f, 0.0f, 1.0f, 0.5f);
253 [self drawOctreeFromLocation:loc + _octree[loc] + 1 :sc :make_vector(offset.x - sc, offset.y - sc, offset.z + sc)];
254 OCTREE_COLOR(0.0f, 1.0f, 0.0f, 0.5f);
255 [self drawOctreeFromLocation:loc + _octree[loc] + 2 :sc :make_vector(offset.x - sc, offset.y + sc, offset.z - sc)];
256 OCTREE_COLOR(0.0f, 1.0f, 1.0f, 0.5f);
257 [self drawOctreeFromLocation:loc + _octree[loc] + 3 :sc :make_vector(offset.x - sc, offset.y + sc, offset.z + sc)];
258 OCTREE_COLOR(1.0f, 0.0f, 0.0f, 0.5f);
259 [self drawOctreeFromLocation:loc + _octree[loc] + 4 :sc :make_vector(offset.x + sc, offset.y - sc, offset.z - sc)];
260 OCTREE_COLOR(1.0f, 0.0f, 1.0f, 0.5f);
261 [self drawOctreeFromLocation:loc + _octree[loc] + 5 :sc :make_vector(offset.x + sc, offset.y - sc, offset.z + sc)];
262 OCTREE_COLOR(1.0f, 1.0f, 0.0f, 0.5f);
263 [self drawOctreeFromLocation:loc + _octree[loc] + 6 :sc :make_vector(offset.x + sc, offset.y + sc, offset.z - sc)];
264 OCTREE_COLOR(1.0f, 1.0f, 1.0f, 0.5f);
265 [self drawOctreeFromLocation:loc + _octree[loc] + 7 :sc :make_vector(offset.x + sc, offset.y + sc, offset.z + sc)];
266 }
267}
#define OCTREE_COLOR(r, g, b, a)
Definition Octree.m:200

◆ hasCollision

- (BOOL) hasCollision

Extends class Octree.

Definition at line 47 of file Octree.m.

140{
141 return _hasCollision;
142}

◆ octreeDetails

- (Octree_details) octreeDetails

Extends class Octree.

Definition at line 47 of file Octree.m.

152{
153 Octree_details details =
154 {
155 .octree = _octree,
156 .radius = _radius,
157 .octree_collision = _collisionOctree
158 };
159 return details;
160}

◆ setHasCollision:

- (void) setHasCollision: (BOOL) value

Extends class Octree.

Definition at line 47 of file Octree.m.

145 :(BOOL)value
146{
147 _hasCollision = !!value;
148}

The documentation for this category was generated from the following file: