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

Comparing libgender/util.h (file contents):
Revision 1.15 by root, Tue Oct 5 02:48:17 2004 UTC vs.
Revision 1.16 by root, Tue Oct 5 03:39:47 2004 UTC

52inline const GLfloat abs (const vec3 &v) 52inline const GLfloat abs (const vec3 &v)
53{ 53{
54 return sqrtf (dot (v, v)); 54 return sqrtf (dot (v, v));
55} 55}
56 56
57struct gl_matrix { 57struct matrix {
58 GLfloat data[4][4]; 58 GLfloat data[4][4];
59 59
60 const GLfloat operator ()(int i, int j) const { return data[j][i]; }; 60 const GLfloat operator ()(int i, int j) const { return data[j][i]; };
61 GLfloat &operator ()(int i, int j) { return data[j][i]; }; 61 GLfloat &operator ()(int i, int j) { return data[j][i]; };
62 62
64 void clear () { diagonal (0.); }; 64 void clear () { diagonal (0.); };
65 void identity () { diagonal (1.); }; 65 void identity () { diagonal (1.); };
66 66
67 void print (); // ugly 67 void print (); // ugly
68 68
69 static const gl_matrix translation (const vec3 &v); 69 static const matrix translation (const vec3 &v);
70 static const gl_matrix rotation (GLfloat degrees, const vec3 &axis); 70 static const matrix rotation (GLfloat degrees, const vec3 &axis);
71 71
72 gl_matrix () { }; 72 matrix () { };
73 gl_matrix (GLfloat diag) { diagonal (diag); }; 73 matrix (GLfloat diag) { diagonal (diag); };
74};
75 74
75 operator ShMatrix4x4f() const
76 {
77 ShMatrix4x4f r;
78
79 for (int i = 0; i < 4; i++)
80 for (int j = 0; j < 4 ; j++)
81 r[i][j] = data[j][i];
82
83 return r;
84 }
85};
86
76const gl_matrix operator *(const gl_matrix &a, const gl_matrix &b); 87const matrix operator *(const matrix &a, const matrix &b);
77const vec3 operator *(const gl_matrix &a, const vec3 &v); 88const vec3 operator *(const matrix &a, const vec3 &v);
78 89
79typedef vec3 point; 90typedef vec3 point;
80 91
81// a generic plane 92// a generic plane
82struct plane { 93struct plane {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines