ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/entity.h
(Generate patch)

Comparing libgender/entity.h (file contents):
Revision 1.9 by root, Sun Oct 3 05:53:09 2004 UTC vs.
Revision 1.10 by root, Sun Oct 3 20:14:33 2004 UTC

11 11
12using namespace std; 12using namespace std;
13 13
14struct entity_base { 14struct entity_base {
15 struct entity_base *parent; 15 struct entity_base *parent;
16 sector orig;
16 vector<octant *> o; 17 vector<octant *> o;
17 box bbox; 18 box bbox;
18 19
19 virtual void update_bbox (); 20 virtual void update_bbox ();
20 virtual void show (const sector &sec) { }; 21 virtual void show () { world.add (orig, this); };
21 void hide (); 22 void hide ();
23 void display (draw_context &ctx);
22 virtual void draw (draw_context &ctx) = 0; 24 virtual void draw (draw_context &ctx) = 0;
23 void try_draw (draw_context &ctx) { if (ctx.may_draw (this)) draw (ctx); } 25
26 entity_base ();
24 virtual ~entity_base () 27 virtual ~entity_base ();
25 {
26 hide ();
27 };
28}; 28};
29 29
30struct entity_container : entity_base, protected vector<entity_base *> { 30struct entity_container : entity_base, protected vector<entity_base *> {
31 void add (entity_base *e) { push_back (e); e->parent = this; } 31 void add (entity_base *e) { push_back (e); e->parent = this; }
32 void update_bbox (); 32 void update_bbox ();
33 void show (const sector &sec); 33 void show ();
34 void draw (draw_context &ctx); 34 void draw (draw_context &ctx);
35 ~entity_container (); 35 ~entity_container ();
36}; 36};
37 37
38struct entity_filter : entity_base { 38struct entity_filter : entity_base {
53 } 53 }
54 54
55 entity_base *content () { return e; }; 55 entity_base *content () { return e; };
56 56
57 void update_bbox (); 57 void update_bbox ();
58 void show (const sector &sec); 58 void show ();
59 void draw (draw_context &ctx); 59 void draw (draw_context &ctx);
60 ~entity_filter (); 60 ~entity_filter ();
61}; 61};
62 62
63struct entity : entity_filter { 63struct entity : entity_filter {
64 sector sec;
65
66 void show (const sector &sec);
67 void show ();
68 void draw (draw_context &ctx);
69}; 64};
70 65
71#if 0 66#if 0
72struct entity_affine : entity_filter { 67struct entity_affine : entity_filter {
73 GLfloat m[4][4]; 68 GLfloat m[4][4];
94}; 89};
95 90
96template<GLenum type> 91template<GLenum type>
97struct entity_opengl1d : entity_opengl, vector<vertex1d> { 92struct entity_opengl1d : entity_opengl, vector<vertex1d> {
98 void update_bbox (); 93 void update_bbox ();
99 void show (const sector &sec);
100 void draw (draw_context &ctx); 94 void draw (draw_context &ctx);
101}; 95};
102 96
103template<GLenum type> 97template<GLenum type>
104struct entity_opengl2d : entity_opengl, vector<vertex2d> { 98struct entity_opengl2d : entity_opengl, vector<vertex2d> {
105 material m; 99 material m;
106 GLuint list; 100 GLuint list;
107 101
108 void update_bbox (); 102 void update_bbox ();
109 void show (const sector &sec);
110 void draw (draw_context &ctx); 103 void draw (draw_context &ctx);
111 104
112 entity_opengl2d () 105 entity_opengl2d ()
113 : list(0) 106 : list(0)
114 { 107 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines