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

Comparing libgender/entity.h (file contents):
Revision 1.10 by root, Sun Oct 3 20:14:33 2004 UTC vs.
Revision 1.13 by root, Mon Oct 4 02:06:57 2004 UTC

16 sector orig; 16 sector orig;
17 vector<octant *> o; 17 vector<octant *> o;
18 box bbox; 18 box bbox;
19 19
20 virtual void update_bbox (); 20 virtual void update_bbox ();
21 virtual void show () { world.add (orig, this); }; 21 virtual void show () { world.add (this); };
22 void hide (); 22 void hide ();
23 void display (draw_context &ctx); 23 void display (draw_context &ctx);
24 virtual void draw (draw_context &ctx) = 0; 24 virtual void draw (draw_context &ctx) = 0;
25 25
26 entity_base (); 26 entity_base ();
61}; 61};
62 62
63struct entity : entity_filter { 63struct entity : entity_filter {
64}; 64};
65 65
66#if 0
67struct entity_affine : entity_filter {
68 GLfloat m[4][4];
69
70 void draw (draw_context &ctx);
71};
72#endif
73
74struct vertex1d { 66struct vertex1d {
75 colour c; // colour 67 colour c; // colour
76 point p; // vertex 68 point p; // vertex
77}; 69};
78 70
84 vertex2d () { }; 76 vertex2d () { };
85 vertex2d (point p, vec3 n, texc t = texc()) : p(p), n(n), t(t) { }; 77 vertex2d (point p, vec3 n, texc t = texc()) : p(p), n(n), t(t) { };
86}; 78};
87 79
88struct entity_opengl : entity_base { 80struct entity_opengl : entity_base {
81 GLuint list;
82
83 entity_opengl ();
84 ~entity_opengl ();
89}; 85};
90 86
91template<GLenum type> 87template<GLenum type>
92struct entity_opengl1d : entity_opengl, vector<vertex1d> { 88struct entity_opengl1d : entity_opengl, vector<vertex1d> {
93 void update_bbox (); 89 void update_bbox ();
94 void draw (draw_context &ctx); 90 void draw (draw_context &ctx);
95}; 91};
96 92
97template<GLenum type> 93template<GLenum type>
98struct entity_opengl2d : entity_opengl, vector<vertex2d> { 94struct entity_opengl2d : entity_opengl {
99 material m; 95 material m;
100 GLuint list;
101 96
102 void update_bbox (); 97 void set (const vector<vertex2d> &v);
103 void draw (draw_context &ctx); 98 void draw (draw_context &ctx);
104 99
105 entity_opengl2d ()
106 : list(0)
107 {
108 }
109
110 ~entity_opengl2d ()
111 {
112 if (list)
113 glDeleteLists (list, 1);
114 }
115}; 100};
116 101
117typedef entity_opengl1d<GL_POINTS> entity_points; 102typedef entity_opengl1d<GL_POINTS> entity_points;
118typedef entity_opengl1d<GL_LINES> entity_lines; 103typedef entity_opengl1d<GL_LINES> entity_lines;
119typedef entity_opengl1d<GL_LINE_STRIP> entity_line_strip; 104typedef entity_opengl1d<GL_LINE_STRIP> entity_line_strip;
123typedef entity_opengl2d<GL_TRIANGLE_FAN> entity_triangle_fan; 108typedef entity_opengl2d<GL_TRIANGLE_FAN> entity_triangle_fan;
124typedef entity_opengl2d<GL_QUADS> entity_quads; 109typedef entity_opengl2d<GL_QUADS> entity_quads;
125typedef entity_opengl2d<GL_QUAD_STRIP> entity_quad_strip; 110typedef entity_opengl2d<GL_QUAD_STRIP> entity_quad_strip;
126typedef entity_opengl2d<GL_POLYGON> entity_polygon; 111typedef entity_opengl2d<GL_POLYGON> entity_polygon;
127 112
113struct entity_transform : entity_filter {
114 gl_matrix m;
115
116 entity_transform ();
117
118 void update_bbox ();
119 void show ();
120 void draw (draw_context &ctx);
121};
122
123struct entity_anim : entity_transform {
124 GLfloat vx, vy, vz;
125 void draw (draw_context &ctx);
126};
127
128#endif 128#endif
129 129
130 130
131 131

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines