mirror of https://github.com/PrimeDecomp/prime.git
Match and link CPlane
This commit is contained in:
parent
19c1aa3ae1
commit
302df55a60
|
@ -2,8 +2,8 @@
|
|||
|
||||
.section .text, "ax"
|
||||
|
||||
.global ProjectedDeltaDist__RC6CPlaneRC9CVector3fRC9CVector3f
|
||||
ProjectedDeltaDist__RC6CPlaneRC9CVector3fRC9CVector3f:
|
||||
.global ClipLineSegment__6CPlaneCFRC9CVector3fRC9CVector3f
|
||||
ClipLineSegment__6CPlaneCFRC9CVector3fRC9CVector3f:
|
||||
/* 8033700C 00333F6C 94 21 FF E0 */ stwu r1, -0x20(r1)
|
||||
/* 80337010 00333F70 C0 64 00 04 */ lfs f3, 4(r4)
|
||||
/* 80337014 00333F74 C0 43 00 04 */ lfs f2, 4(r3)
|
||||
|
@ -117,4 +117,3 @@ lbl_805AE8A0:
|
|||
lbl_805AE8A4:
|
||||
# ROM: 0x3FB144
|
||||
.float 1.0
|
||||
|
||||
|
|
|
@ -6465,7 +6465,7 @@ lbl_802BB7DC:
|
|||
/* 802BB7E4 002B8744 7F A4 EB 78 */ mr r4, r29
|
||||
/* 802BB7E8 002B8748 7E 55 02 14 */ add r18, r21, r0
|
||||
/* 802BB7EC 002B874C 7E 45 93 78 */ mr r5, r18
|
||||
/* 802BB7F0 002B8750 48 07 B8 1D */ bl ProjectedDeltaDist__RC6CPlaneRC9CVector3fRC9CVector3f
|
||||
/* 802BB7F0 002B8750 48 07 B8 1D */ bl ClipLineSegment__6CPlaneCFRC9CVector3fRC9CVector3f
|
||||
/* 802BB7F4 002B8754 C0 02 C2 74 */ lfs f0, lbl_805ADF94@sda21(r2)
|
||||
/* 802BB7F8 002B8758 FC 01 00 40 */ fcmpo cr0, f1, f0
|
||||
/* 802BB7FC 002B875C 40 81 00 6C */ ble lbl_802BB868
|
||||
|
@ -13056,4 +13056,3 @@ lbl_803D685C:
|
|||
.byte 0x54
|
||||
.asciz "XTR_ThermoPalette"
|
||||
.balign 4
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
#include "Kyoto/Math/CUnitVector3f.hpp"
|
||||
#include "Kyoto/Math/CVector3f.hpp"
|
||||
|
||||
class CPlane {
|
||||
|
@ -16,7 +17,7 @@ public:
|
|||
f32 GetConstant() const { return xc_constant; }
|
||||
// GetHeight__6CPlaneCFRC9CVector3f
|
||||
// IsFacing__6CPlaneCFRC9CVector3f
|
||||
// ClipLineSegment__6CPlaneCFRC9CVector3fRC9CVector3f
|
||||
float ClipLineSegment(const CVector3f& start, const CVector3f& end) const;
|
||||
|
||||
private:
|
||||
CUnitVector3f x0_normal;
|
||||
|
|
|
@ -41,7 +41,12 @@ public:
|
|||
bool IsEqu(const CVector3f& other, f32 epsilon = FLT_EPSILON) const;
|
||||
// Lerp__9CVector3fFRC9CVector3fRC9CVector3ff
|
||||
// MagSquared__9CVector3fCFv weak
|
||||
// Cross__9CVector3fFRC9CVector3fRC9CVector3f weak
|
||||
static CVector3f Cross(const CVector3f& lhs, const CVector3f& rhs) {
|
||||
const float x = (lhs.GetY() * rhs.GetZ()) - (rhs.GetY() * lhs.GetZ());
|
||||
const float y = (lhs.GetZ() * rhs.GetX()) - (rhs.GetZ() * lhs.GetX());
|
||||
const float z = (lhs.GetX() * rhs.GetY()) - (rhs.GetX() * lhs.GetY());
|
||||
return CVector3f(x, y, z);
|
||||
}
|
||||
|
||||
f32& operator[](EDimX dim) { return mX; }
|
||||
f32& operator[](EDimY dim) { return mY; }
|
||||
|
|
|
@ -542,7 +542,7 @@ KYOTO_1 :=\
|
|||
$(BUILD_DIR)/asm/Kyoto/Particles/CUVElement.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Particles/CVectorElement.o\
|
||||
$(BUILD_DIR)/src/Kyoto/Particles/CWarp.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Math/CPlane.o\
|
||||
$(BUILD_DIR)/src/Kyoto/Math/CPlane.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Math/CSphere.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Math/CAABox.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/CFactoryMgr.o\
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#include "Kyoto/Math/CPlane.hpp"
|
||||
#include "Kyoto/Math/CMath.hpp"
|
||||
|
||||
CPlane::CPlane(const CVector3f& a, const CVector3f& b, const CVector3f& c)
|
||||
: x0_normal(CVector3f::Cross(b - a, c - a))
|
||||
, xc_constant(CVector3f::Dot(x0_normal, a)) {
|
||||
}
|
||||
|
||||
float CPlane::ClipLineSegment(const CVector3f& start, const CVector3f& end) const {
|
||||
float dist = -(CVector3f::Dot(start, GetNormal()) - GetConstant()) / CVector3f::Dot(end - start, GetNormal());
|
||||
return dist <= 0.f ? 0.f : (dist >= 1.f ? 1.f : dist);
|
||||
}
|
Loading…
Reference in New Issue