Conversions

Commit from Azaezel to fix the naming of inspector fields.
TypeMatrixField still messes around on first responder, we know these functions convert angAxis to eul properly and from eul to angAxis but when the data comes to TypeMatrix it changes.... weird issue is weird.
This commit is contained in:
marauder2k7 2023-06-11 21:59:03 +01:00
parent 92920dbcd9
commit cbe2bd4c7b
7 changed files with 146 additions and 53 deletions

View file

@ -464,3 +464,13 @@ DefineEngineFunction(mDecToBin, const char*, (S32 n), , "convert decimal to a bi
}
return ret.c_str();
}
DefineEngineFunction(mEulDegToAng, AngAxisF, (EulerF euler), , "convert euler to degrees")
{
return mEulDegToAng(euler);
}
DefineEngineFunction(mAngToEul, EulerF, (AngAxisF angAx), , "convert degrees to euler")
{
return mAngToEul(angAx);
}

View file

@ -52,4 +52,20 @@
#include "math/mRotation.h"
#endif
inline AngAxisF mEulDegToAng(EulerF euler)
{
MatrixF tempMat = MatrixF(euler * M_PI_F / 180.0f, Point3F::Zero);
AngAxisF angAx = AngAxisF(tempMat);
return angAx;
}
inline EulerF mAngToEul(AngAxisF angAx)
{
MatrixF tempMat;
angAx.setMatrix(&tempMat);
EulerF euler = tempMat.toEuler();
euler *= 180.0f / M_PI_F;
return euler;
}
#endif //_MMATH_H_