1 |
#include <cstdlib> |
2 |
|
3 |
#include "oct.h" |
4 |
#include "entity.h" |
5 |
|
6 |
octant world(0); |
7 |
|
8 |
octant::octant (octant *parent) |
9 |
: parent(parent) |
10 |
{ |
11 |
for (fill = 8; fill--; ) |
12 |
sub[fill] = 0; |
13 |
|
14 |
extent = parent |
15 |
? parent->extent >> 1 |
16 |
: SOFFS_MAXEXTENT; |
17 |
} |
18 |
|
19 |
octant::~octant () |
20 |
{ |
21 |
for (fill = 8; fill--; ) |
22 |
delete sub[fill]; |
23 |
} |
24 |
|
25 |
void octant::add (entity_base *e) |
26 |
{ |
27 |
push_back (e); |
28 |
e->o.push_back (this); |
29 |
} |
30 |
|
31 |
void octant::remove (entity_base *e) |
32 |
{ |
33 |
} |
34 |
|
35 |
void octant::draw (const draw_context &ctx) |
36 |
{ |
37 |
for (iterator i = end (); i-- != begin (); ) |
38 |
(*i)->draw (ctx); |
39 |
} |
40 |
|