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

Comparing libgender/entity.h (file contents):
Revision 1.2 by root, Sat Oct 2 16:16:03 2004 UTC vs.
Revision 1.3 by root, Sun Oct 3 01:14:40 2004 UTC

19 soffs x, y, z; 19 soffs x, y, z;
20}; 20};
21 21
22struct point { 22struct point {
23 GLfloat x, y, z; 23 GLfloat x, y, z;
24
25 point () { };
26 point (GLfloat x, GLfloat y, GLfloat z) : x(x), y(y), z(z) { };
24}; 27};
25 28
26struct colour { 29struct colour {
27 GLfloat r, g, b; 30 GLfloat r, g, b;
31 colour (GLfloat r = 1., GLfloat g = 1., GLfloat b = 1.) : r(r), g(g), b(b) { };
28}; 32};
29 33
30struct vect { 34struct vec3 {
31 GLfloat x, y, z; 35 GLfloat x, y, z;
36 vec3 () { };
37 vec3 (GLfloat x, GLfloat y, GLfloat z) : x(x), y(y), z(z) { };
38
39 const vec3 operator -() const
40 { return vec3 (-x, -y, -z); }
32}; 41};
33 42
43const vec3 cross (const vec3 &a, const vec3 &b);
44GLfloat dot (const vec3 &a, const vec3 &b);
45
34struct texc { 46struct texc {
35 GLfloat u, v; 47 GLfloat s, t;
48 texc () { };
49 texc (GLfloat s, GLfloat t) : s(s), t(t) { };
36}; 50};
37 51
38struct box { 52struct box {
39 point a, b; 53 point a, b;
40 54
41 void reset () 55 void reset ()
42 { 56 {
43 a.x = a.y = a.z = GLFLOAT_MAX; 57 a = point (GLFLOAT_MAX, GLFLOAT_MAX, GLFLOAT_MAX);
44 b.x = b.y = b.z = GLFLOAT_MIN; 58 b = point (GLFLOAT_MIN, GLFLOAT_MIN, GLFLOAT_MIN);
45 } 59 }
46 60
47 void add (const box &o); 61 void add (const box &o);
48}; 62};
49 63
96 110
97struct entity : entity_filter { 111struct entity : entity_filter {
98 sector sec; 112 sector sec;
99 113
100 void show (const sector &sec); 114 void show (const sector &sec);
115 void show ();
101 void draw (); 116 void draw ();
102}; 117};
103 118
104struct entity_affine : entity_filter { 119struct entity_affine : entity_filter {
105 //matrix m; 120 //matrix m;
106}; 121};
107 122
108struct vertex1d { 123struct vertex1d {
124 colour c; // colour
109 point p; // vertex 125 point p; // vertex
110 colour c; // colour
111}; 126};
112 127
113struct vertex2d { 128struct vertex2d {
129 colour c; // colour
114 point p; // vertex 130 point p; // vertex
115 colour c; // colour
116 vect n; // normal 131 vec3 n; // normal
117 texc t; // texture 132 texc t; // texture
133
134 vertex2d () { };
135 vertex2d (colour c, point p, vec3 n, texc t = texc()) : c(c), p(p), n(n), t(t) { };
118}; 136};
119 137
120template<GLenum type> 138template<GLenum type>
121struct entity_opengl1d : entity_base, vector<vertex1d> { 139struct entity_opengl1d : entity_base, vector<vertex1d> {
122 void update_bbox (); 140 void update_bbox ();
154 light *l; 172 light *l;
155}; 173};
156 174
157struct view { 175struct view {
158 point p; 176 point p;
159 vect d; 177 vec3 d, u;
160 float fov; 178 float fov;
161 179 int w, h;
162 int width, height;
163 180
164 void draw (const draw_context &c); 181 void draw (const draw_context &c);
165}; 182};
166 183
167#endif 184#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines