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

Comparing libgender/util.h (file contents):
Revision 1.11 by root, Mon Oct 4 16:03:49 2004 UTC vs.
Revision 1.12 by root, Mon Oct 4 23:44:54 2004 UTC

49} 49}
50 50
51struct gl_matrix { 51struct gl_matrix {
52 GLfloat data[4][4]; 52 GLfloat data[4][4];
53 53
54 const GLfloat operator ()(int i, int j) const { return data[i][j]; }; 54 const GLfloat operator ()(int i, int j) const { return data[j][i]; };
55 GLfloat &operator ()(int i, int j) { return data[i][j]; }; 55 GLfloat &operator ()(int i, int j) { return data[j][i]; };
56 56
57 void diagonal (GLfloat v); 57 void diagonal (GLfloat v);
58 void clear () { diagonal (0.); }; 58 void clear () { diagonal (0.); };
59 void identity () { diagonal (1.); }; 59 void identity () { diagonal (1.); };
60 60
61 void print (); // ugly 61 void print (); // ugly
62 62
63 void translate (const vec3 &v); 63 static const gl_matrix translation (const vec3 &v);
64 void rotate (GLfloat degrees, const vec3 &axis); 64 static const gl_matrix rotation (GLfloat degrees, const vec3 &axis);
65 65
66 gl_matrix () { }; 66 gl_matrix () { };
67 gl_matrix (GLfloat diag) { diagonal (diag); }; 67 gl_matrix (GLfloat diag) { diagonal (diag); };
68}; 68};
69 69
71const vec3 operator *(const gl_matrix &a, const vec3 &v); 71const vec3 operator *(const gl_matrix &a, const vec3 &v);
72 72
73typedef vec3 point; 73typedef vec3 point;
74 74
75// a generic plane 75// a generic plane
76class plane { 76struct plane {
77 vec3 n; 77 vec3 n;
78 GLfloat d; 78 GLfloat d;
79public:
80 79
81 GLfloat distance (const point &p) const 80 GLfloat distance (const point &p) const
82 { 81 {
83 return dot (n, p) + d; 82 return dot (n, p) + d;
84 } 83 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines