mirror of https://github.com/AxioDL/zeus.git
Add `MakeRotationsBasedOnY` to CTransform
This commit is contained in:
parent
bf13f1f49c
commit
0b67ecf073
|
@ -5,6 +5,7 @@
|
||||||
#include "zeus/CMatrix3f.hpp"
|
#include "zeus/CMatrix3f.hpp"
|
||||||
#include "zeus/CMatrix4f.hpp"
|
#include "zeus/CMatrix4f.hpp"
|
||||||
#include "zeus/CVector3f.hpp"
|
#include "zeus/CVector3f.hpp"
|
||||||
|
#include "zeus/CUnitVector.hpp"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -246,6 +247,20 @@ public:
|
||||||
0.f, 0.f, 0.f, 1.f);
|
0.f, 0.f, 0.f, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static zeus::CTransform MakeRotationsBasedOnY(const CUnitVector3f& uVec)
|
||||||
|
{
|
||||||
|
uint32_t i;
|
||||||
|
if (uVec.y < uVec.x || uVec.z < uVec.y || uVec.z < uVec.x)
|
||||||
|
i = 2;
|
||||||
|
else
|
||||||
|
i = 1;
|
||||||
|
|
||||||
|
CVector3f v = CVector3f::skZero;
|
||||||
|
v[i] = 1.f;
|
||||||
|
CUnitVector3f newUVec(uVec.cross(v));
|
||||||
|
return {newUVec, uVec, uVec.cross(newUVec), CVector3f::skZero};
|
||||||
|
}
|
||||||
|
|
||||||
CMatrix3f basis;
|
CMatrix3f basis;
|
||||||
CVector3f origin;
|
CVector3f origin;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue