Added Mtx_Transpose().
This commit is contained in:
parent
ae0ce14c9d
commit
fbd3200abe
@ -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.
|
* @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);
|
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
|
///@name Quaternion Math
|
||||||
|
15
source/maths/mtx_transpose.c
Normal file
15
source/maths/mtx_transpose.c
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user