Game Development Reference
In-Depth Information
*/
class Matrix4
{
// ... Other Matrix4 code as before ...
/**
* Returns a matrix that is this matrix multiplied by the given
* other matrix.
*/
Matrix4 operator*(const Matrix4 &o) const
{
Matrix4 result;
result.data[0] = (o.data[0]*data[0]) + (o.data[4]*data[1]) +
(o.data[8]*data[2]);
result.data[4] = (o.data[0]*data[4]) + (o.data[4]*data[5]) +
(o.data[8]*data[6]);
result.data[8] = (o.data[0]*data[8]) + (o.data[4]*data[9]) +
(o.data[8]*data[10]);
result.data[1] = (o.data[1]*data[0]) + (o.data[5]*data[1]) +
(o.data[9]*data[2]);
result.data[5] = (o.data[1]*data[4]) + (o.data[5]*data[5]) +
(o.data[9]*data[6]);
result.data[9] = (o.data[1]*data[8]) + (o.data[5]*data[9]) +
(o.data[9]*data[10]);
result.data[2] = (o.data[2]*data[0]) + (o.data[6]*data[1]) +
(o.data[10]*data[2]);
result.data[6] = (o.data[2]*data[4]) + (o.data[6]*data[5]) +
(o.data[10]*data[6]);
result.data[10] = (o.data[2]*data[8]) + (o.data[6]*data[9]) +
(o.data[10]*data[10]);
result.data[3] = (o.data[3]*data[0]) + (o.data[7]*data[1]) +
(o.data[11]*data[2]) + data[3];
result.data[7] = (o.data[3]*data[4]) + (o.data[7]*data[5]) +
(o.data[11]*data[6]) + data[7];
result.data[11] = (o.data[3]*data[8]) + (o.data[7]*data[9]) +
(o.data[11]*data[10]) + data[11];
return result;
}
};
Search Nedrilad ::




Custom Search