Finish CMRay

Unify paths
This commit is contained in:
Phillip Stephens 2016-04-25 00:30:35 -07:00
parent ac44f808ce
commit 7af2c491da
2 changed files with 30 additions and 30 deletions

View File

@ -6,41 +6,40 @@
namespace zeus namespace zeus
{ {
struct alignas(16) CMRay struct CMRay
{ {
CMRay(const CVector3f& start, const CVector3f& end, float dir) CMRay(const CVector3f& start, const CVector3f& end, float d)
: start(start), : start(start),
dir(dir), end(end),
unk3(1.0 / dir), d(d),
unk4(end) invD(1.f/d)
{ {
unk1 = start + (dir * end); normal = start + (d * end);
unk2 = (unk1 - start); delta = normal - start;
} }
CMRay(const CVector3f &start, const CVector3f &end, float dir, float unk) CMRay(const CVector3f& start, const CVector3f& norm, float d, float invD)
: start(start), : start(start),
dir(dir), normal(norm),
unk3(unk), d(d),
unk4(end) invD(invD)
{ {
unk1 = start + (dir * end); delta = normal - start;
unk2 = (unk1 - start); end = invD * delta;
} }
CMRay GetInvUnscaledTransformRay(const CTransform& xfrm) CMRay getInvUnscaledTransformRay(const CTransform& xfrm)
{ {
CTransform inv = xfrm.inverse(); CTransform inv = xfrm.inverse();
return CMRay(inv * start, inv * normal, d, invD);
return CMRay(newStart, newEnd, dir, unk3);
} }
CVector3f start; CVector3f start;
CVector3f unk1; CVector3f normal;
CVector3f unk2; CVector3f delta;
float dir; float d;
float unk3; float invD;
CVector3f unk4; CVector3f end;
}; };
} }

View File

@ -1,8 +1,8 @@
#ifndef __MATHLIB_HPP #ifndef __MATHLIB_HPP
#define __MATHLIB_HPP #define __MATHLIB_HPP
#include "CAxisAngle.hpp" #include "zeus/CAxisAngle.hpp"
#include "CRelAngle.hpp" #include "zeus/CRelAngle.hpp"
#include "zeus/CMatrix3f.hpp" #include "zeus/CMatrix3f.hpp"
#include "zeus/CMatrix4f.hpp" #include "zeus/CMatrix4f.hpp"
#include "zeus/CProjection.hpp" #include "zeus/CProjection.hpp"
@ -10,18 +10,19 @@
#include "zeus/CQuaternion.hpp" #include "zeus/CQuaternion.hpp"
#include "zeus/CVector2f.hpp" #include "zeus/CVector2f.hpp"
#include "zeus/CVector3f.hpp" #include "zeus/CVector3f.hpp"
#include "CVector3d.hpp" #include "zeus/CVector3d.hpp"
#include "zeus/CVector4f.hpp" #include "zeus/CVector4f.hpp"
#include "CUnitVector.hpp" #include "zeus/CUnitVector.hpp"
#include "zeus/CRectangle.hpp" #include "zeus/CRectangle.hpp"
#include "zeus/CPlane.hpp" #include "zeus/CPlane.hpp"
#include "CLine.hpp" #include "zeus/CLine.hpp"
#include "zeus/CAABox.hpp" #include "zeus/CAABox.hpp"
#include "COBBox.hpp" #include "zeus/COBBox.hpp"
#include "CSphere.hpp" #include "zeus/CSphere.hpp"
#include "CFrustum.hpp" #include "zeus/CFrustum.hpp"
#include "zeus/CMRay.hpp"
#include "zeus/CColor.hpp" #include "zeus/CColor.hpp"
#include "Global.hpp" #include "zeus/Global.hpp"
#include "zeus/Math.hpp" #include "zeus/Math.hpp"
#endif // __MATHLIB_HPP #endif // __MATHLIB_HPP