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
{
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),
dir(dir),
unk3(1.0 / dir),
unk4(end)
end(end),
d(d),
invD(1.f/d)
{
unk1 = start + (dir * end);
unk2 = (unk1 - start);
normal = start + (d * end);
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),
dir(dir),
unk3(unk),
unk4(end)
normal(norm),
d(d),
invD(invD)
{
unk1 = start + (dir * end);
unk2 = (unk1 - start);
delta = normal - start;
end = invD * delta;
}
CMRay GetInvUnscaledTransformRay(const CTransform& xfrm)
CMRay getInvUnscaledTransformRay(const CTransform& xfrm)
{
CTransform inv = xfrm.inverse();
return CMRay(newStart, newEnd, dir, unk3);
return CMRay(inv * start, inv * normal, d, invD);
}
CVector3f start;
CVector3f unk1;
CVector3f unk2;
float dir;
float unk3;
CVector3f unk4;
CVector3f normal;
CVector3f delta;
float d;
float invD;
CVector3f end;
};
}

View File

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