Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Matrix multiplication --------------------------------------------------------------
- static Float4x4 Multiply(const Float4x4& matrixA, const Float4x4 matrixB)
- {
- // Transpose B so everything becomes dot products
- Float4x4 matrixBtranspose = Transpose(matrixB);
- Float4x4 result;
- // Dot products infinity
- result.x.x = Dot(matrixA.x, matrixBtranspose.x);
- result.x.y = Dot(matrixA.x, matrixBtranspose.y);
- result.x.z = Dot(matrixA.x, matrixBtranspose.z);
- result.x.w = Dot(matrixA.x, matrixBtranspose.w);
- // -- //
- result.y.x = Dot(matrixA.y, matrixBtranspose.x);
- result.y.y = Dot(matrixA.y, matrixBtranspose.y);
- result.y.z = Dot(matrixA.y, matrixBtranspose.z);
- result.y.w = Dot(matrixA.y, matrixBtranspose.w);
- // -- //
- result.z.x = Dot(matrixA.z, matrixBtranspose.x);
- result.z.y = Dot(matrixA.z, matrixBtranspose.y);
- result.z.z = Dot(matrixA.z, matrixBtranspose.z);
- result.z.w = Dot(matrixA.z, matrixBtranspose.w);
- // -- //
- result.w.x = Dot(matrixA.w, matrixBtranspose.x);
- result.w.y = Dot(matrixA.w, matrixBtranspose.y);
- result.w.z = Dot(matrixA.w, matrixBtranspose.z);
- result.w.w = Dot(matrixA.w, matrixBtranspose.w);
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement