Initial Commit

This commit is contained in:
2015-04-19 13:39:16 -07:00
commit c8fa20ddbf
23 changed files with 1932 additions and 0 deletions

21
Math.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include "Math.hpp"
const CVector3f Math::kUpVec(0.0, 0.0, 1.0);
const CVector3f Math::kRadToDegVec(180.0f / M_PI);
const CVector3f Math::kDegToRadVec(M_PI / 180.0f);
CTransform Math::lookAt(const CVector3f& pos, const CVector3f& lookPos, const CVector3f& up)
{
CVector3f vLook,vRight,vUp;
vLook = pos - lookPos;
vLook.normalize();
vRight = up.cross(vLook);
vRight.normalize();
vUp = vLook.cross(vRight);
CMatrix3f rmBasis(vRight, vUp, vLook);
return CTransform(rmBasis.transposed(), CVector3f(-pos.dot(vRight), -pos.dot(vUp), -pos.dot(vLook)));
}