From 35a6a511d82c1b155deb2f2a9e040dd65f19eda5 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 8 Nov 2015 19:39:51 -0800 Subject: [PATCH] Add forgotten CMRay --- include/CMRay.hpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 include/CMRay.hpp diff --git a/include/CMRay.hpp b/include/CMRay.hpp new file mode 100644 index 0000000..cfd11bc --- /dev/null +++ b/include/CMRay.hpp @@ -0,0 +1,47 @@ +#ifndef CMRAY_HPP +#define CMRAY_HPP +#include "CVector3f.hpp" +#include "CTransform.hpp" +#include "Math.hpp" + +namespace Zeus +{ +struct alignas(16) CMRay +{ + CMRay(const CVector3f& start, const CVector3f& end, float dir) + : start(start), + dir(dir), + unk3(1.0 / dir), + unk4(end) + { + unk1 = start + (dir * end); + unk2 = (unk1 - start); + } + + CMRay(const CVector3f &start, const CVector3f &end, float dir, float unk) + : start(start), + dir(dir), + unk3(unk), + unk4(end) + { + unk1 = start + (dir * end); + unk2 = (unk1 - start); + } + + CMRay GetInvUnscaledTransformRay(const CTransform& xfrm) + { + CTransform inv = xfrm.inverse(); + + return CMRay(newStart, newEnd, dir, unk3); + } + + CVector3f start; + CVector3f unk1; + CVector3f unk2; + float dir; + float unk3; + CVector3f unk4; +}; +} + +#endif