prime/include/Collision/CRayCastResult.hpp

49 lines
1.3 KiB
C++
Raw Normal View History

#ifndef _CRAYCASTRESULT
#define _CRAYCASTRESULT
#include "types.h"
#include "Kyoto/Math/CPlane.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Collision/CMaterialList.hpp"
class CRayCastResult {
public:
enum EInvalid {
kI_Invalid,
kI_Valid,
};
CRayCastResult(float time, const CVector3f& point, const CPlane& plane, const CMaterialList& list)
: x0_time(time), x4_point(point), x10_plane(plane), x20_valid(kI_Valid), x28_material(list) {}
CRayCastResult(EInvalid invalid)
: x0_time(0)
, x4_point(CVector3f(0.f, 0.f, 0.f))
, x10_plane(CPlane(0.f, CUnitVector3f(1.f, 0.f, 0.f, CUnitVector3f::kN_Yes)))
, x20_valid(invalid) {}
float GetTime() const { return x0_time; }
const CVector3f& GetPoint() const { return x4_point; }
const CPlane& GetPlane() const { return x10_plane; }
2022-11-03 17:09:58 +00:00
bool IsValid() const { return x20_valid != kI_Invalid; }
2022-10-30 19:47:50 +00:00
// TODO: figure out what's going on here
bool IsInvalid() const { return x20_valid == kI_Invalid; }
const CMaterialList& GetMaterial() const { return x28_material; }
void Transform(const CTransform4f& xf);
2022-09-29 05:30:20 +00:00
static CRayCastResult MakeInvalid() {
return CRayCastResult(kI_Invalid);
}
2022-09-29 05:30:20 +00:00
private:
float x0_time;
CVector3f x4_point;
CPlane x10_plane;
2022-09-29 05:30:20 +00:00
bool x20_valid;
CMaterialList x28_material;
};
CHECK_SIZEOF(CRayCastResult, 0x30)
#endif // _CRAYCASTRESULT