1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
class Vec3f {
public:
inline Vec3f () : x (0), y (0), z (0) {}
inline Vec3f (float xx, float yy, float zz) : x (xx), y (yy), z (zz) { }
private:
float x,y,z;
};
class Vec4f : Vec3f
{
public:
inline Vec4f (): Vec3f(), w(0) {}
inline Vec4f (float a,float b,float c,float d): Vec3f (a,b,c), w(d) {}
private:
float w;
};
class Matrix4x4 {
public:
void setIdentity ();
private:
Vec4f row1, row2, row3, row4;
};
void Matrix4x4::setIdentity () {
row1 (1.0f,0.0f,0.0f,0.0f);
row2 (0.0f,1.0f,0.0f,0.0f);
row3 (0.0f,0.0f,1.0f,0.0f);
row4 (0.0f,0.0f,0.0f,1.0f);
}
main () {
Matrix4x4 a;
a.setIdentity ();
}
|