mirror of https://github.com/PrimeDecomp/prime.git
parent
64037a01e3
commit
61eee21924
|
@ -28,6 +28,7 @@ COMPLETE_OBJECTS = [
|
|||
"MetroidPrime/HUD/CHUDMemoParms",
|
||||
"MetroidPrime/ScriptObjects/CScriptDebugCameraWaypoint",
|
||||
"Weapons/IWeaponRenderer",
|
||||
"Collision/CMRay",
|
||||
"Kyoto/Basics/CStopwatch",
|
||||
"Kyoto/Basics/COsContextDolphin",
|
||||
"Kyoto/Basics/CSWDataDolphin",
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef __CMRAY_HPP__
|
||||
#define __CMRAY_HPP__
|
||||
|
||||
#include "Kyoto/Math/CVector3f.hpp"
|
||||
|
||||
class CTransform4f;
|
||||
class CMRay {
|
||||
public:
|
||||
CMRay(const CVector3f& start, const CVector3f& end, float, float);
|
||||
CMRay(const CVector3f& start, const CVector3f& end, float);
|
||||
CMRay GetInvUnscaledTransformRay(const CTransform4f&) const;
|
||||
|
||||
private:
|
||||
CVector3f mStart;
|
||||
CVector3f mEnd;
|
||||
CVector3f mDelta;
|
||||
float mLength;
|
||||
float mInvLength;
|
||||
CVector3f mDir;
|
||||
};
|
||||
|
||||
#endif // __CMRAY_HPP__
|
|
@ -415,7 +415,7 @@ COLLISION :=\
|
|||
$(BUILD_DIR)/asm/Collision/CCollidableSphere.o\
|
||||
$(BUILD_DIR)/asm/Collision/CMaterialFilter.o\
|
||||
$(BUILD_DIR)/asm/Collision/COBBox.o\
|
||||
$(BUILD_DIR)/asm/Collision/CMRay.o\
|
||||
$(BUILD_DIR)/src/Collision/CMRay.o\
|
||||
|
||||
KYOTO_1 :=\
|
||||
$(BUILD_DIR)/asm/Kyoto/Basics/CBasics.o\
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#include "Collision/CMRay.hpp"
|
||||
#include "Kyoto/Math/CTransform4f.hpp"
|
||||
|
||||
CMRay::CMRay(const CVector3f& start, const CVector3f& end, float length, float invLength)
|
||||
: mStart(start)
|
||||
, mEnd(end)
|
||||
, mDelta(mEnd - mStart)
|
||||
, mLength(length)
|
||||
, mInvLength(invLength)
|
||||
, mDir(mInvLength * mDelta) {
|
||||
}
|
||||
|
||||
CMRay::CMRay(const CVector3f& start, const CVector3f& dir, float length)
|
||||
: mStart(start)
|
||||
, mEnd(start + length * dir)
|
||||
, mDelta(mEnd - mStart)
|
||||
, mLength(length)
|
||||
, mInvLength(1.f / length)
|
||||
, mDir(dir) {}
|
||||
|
||||
|
||||
CMRay CMRay::GetInvUnscaledTransformRay(const CTransform4f& xf) const {
|
||||
CTransform4f invXf = xf.GetQuickInverse();
|
||||
return CMRay(invXf * mStart, invXf * mEnd, mLength, mInvLength);
|
||||
}
|
Loading…
Reference in New Issue