Added Mtx_Transpose().

This commit is contained in:
Thompson Lee 2016-08-11 19:53:20 -04:00
parent ae0ce14c9d
commit fbd3200abe
2 changed files with 21 additions and 0 deletions

View File

@ -489,6 +489,12 @@ void Mtx_PerspStereoTilt(C3D_Mtx* mtx, float fovy, float aspect, float near, flo
* @param[in] isLeftHanded If true, output matrix is left-handed. If false, output matrix is right-handed.
*/
void Mtx_LookAt(C3D_Mtx* out, C3D_FVec cameraPosition, C3D_FVec cameraTarget, C3D_FVec cameraUpVector, bool isLeftHanded);
/**
*@brief Transposes the matrix. Row => Column, and vice versa.
*@param[in,out] out Output matrix.
*/
void Mtx_Transpose(C3D_Mtx* out);
///@}
///@name Quaternion Math

View File

@ -0,0 +1,15 @@
#include <c3d/maths.h>
void Mtx_Transpose(C3D_Mtx* out)
{
float swap;
for (int i = 0; i < 4; i++)
{
for (int j = i+1; j < 4; j++)
{
swap = out->r[j].c[i];
out->r[j].c[i] = out->r[i].c[j];
out->r[i].c[j] = swap;
}
}
}