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.12 by root, Sun Oct 3 23:59:30 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 (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
71#if 0
72struct entity_affine : entity_filter {
73 GLfloat m[4][4];
74
75 void draw (draw_context &ctx);
76};
77#endif
78 65
79struct vertex1d { 66struct vertex1d {
80 colour c; // colour 67 colour c; // colour
81 point p; // vertex 68 point p; // vertex
82}; 69};
94}; 81};
95 82
96template<GLenum type> 83template<GLenum type>
97struct entity_opengl1d : entity_opengl, vector<vertex1d> { 84struct entity_opengl1d : entity_opengl, vector<vertex1d> {
98 void update_bbox (); 85 void update_bbox ();
99 void show (const sector &sec);
100 void draw (draw_context &ctx); 86 void draw (draw_context &ctx);
101}; 87};
102 88
103template<GLenum type> 89template<GLenum type>
104struct entity_opengl2d : entity_opengl, vector<vertex2d> { 90struct entity_opengl2d : entity_opengl, vector<vertex2d> {
105 material m; 91 material m;
106 GLuint list; 92 GLuint list;
107 93
108 void update_bbox (); 94 void update_bbox ();
109 void show (const sector &sec);
110 void draw (draw_context &ctx); 95 void draw (draw_context &ctx);
111 96
112 entity_opengl2d () 97 entity_opengl2d ()
113 : list(0) 98 : list(0)
114 { 99 {
130typedef entity_opengl2d<GL_TRIANGLE_FAN> entity_triangle_fan; 115typedef entity_opengl2d<GL_TRIANGLE_FAN> entity_triangle_fan;
131typedef entity_opengl2d<GL_QUADS> entity_quads; 116typedef entity_opengl2d<GL_QUADS> entity_quads;
132typedef entity_opengl2d<GL_QUAD_STRIP> entity_quad_strip; 117typedef entity_opengl2d<GL_QUAD_STRIP> entity_quad_strip;
133typedef entity_opengl2d<GL_POLYGON> entity_polygon; 118typedef entity_opengl2d<GL_POLYGON> entity_polygon;
134 119
120struct entity_transform : entity_filter {
121 gl_matrix m;
122
123 entity_transform ();
124
125 void update_bbox ();
126 void show ();
127 void draw (draw_context &ctx);
128};
129
130struct entity_anim : entity_transform {
131 GLfloat vx, vy, vz;
132 void draw (draw_context &ctx);
133};
134
135#endif 135#endif
136 136
137 137
138 138

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines