mirror of https://github.com/PrimeDecomp/prime.git
Some CBallCamera progress
This commit is contained in:
parent
39d1fef022
commit
3831cfa905
|
@ -2101,7 +2101,7 @@ lbl_800822B8:
|
||||||
/* 800823F0 0007F350 91 21 00 4C */ stw r9, 0x4c(r1)
|
/* 800823F0 0007F350 91 21 00 4C */ stw r9, 0x4c(r1)
|
||||||
/* 800823F4 0007F354 91 01 00 50 */ stw r8, 0x50(r1)
|
/* 800823F4 0007F354 91 01 00 50 */ stw r8, 0x50(r1)
|
||||||
/* 800823F8 0007F358 90 01 00 54 */ stw r0, 0x54(r1)
|
/* 800823F8 0007F358 90 01 00 54 */ stw r0, 0x54(r1)
|
||||||
/* 800823FC 0007F35C 48 00 78 B9 */ bl FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb
|
/* 800823FC 0007F35C 48 00 78 B9 */ bl FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb
|
||||||
/* 80082400 0007F360 C0 41 00 58 */ lfs f2, 0x58(r1)
|
/* 80082400 0007F360 C0 41 00 58 */ lfs f2, 0x58(r1)
|
||||||
/* 80082404 0007F364 C0 21 00 5C */ lfs f1, 0x5c(r1)
|
/* 80082404 0007F364 C0 21 00 5C */ lfs f1, 0x5c(r1)
|
||||||
/* 80082408 0007F368 C0 01 00 60 */ lfs f0, 0x60(r1)
|
/* 80082408 0007F368 C0 01 00 60 */ lfs f0, 0x60(r1)
|
||||||
|
@ -2269,7 +2269,7 @@ lbl_80082604:
|
||||||
/* 80082670 0007F5D0 90 01 00 2C */ stw r0, 0x2c(r1)
|
/* 80082670 0007F5D0 90 01 00 2C */ stw r0, 0x2c(r1)
|
||||||
/* 80082674 0007F5D4 80 08 05 14 */ lwz r0, 0x514(r8)
|
/* 80082674 0007F5D4 80 08 05 14 */ lwz r0, 0x514(r8)
|
||||||
/* 80082678 0007F5D8 90 01 00 30 */ stw r0, 0x30(r1)
|
/* 80082678 0007F5D8 90 01 00 30 */ stw r0, 0x30(r1)
|
||||||
/* 8008267C 0007F5DC 48 00 76 39 */ bl FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb
|
/* 8008267C 0007F5DC 48 00 76 39 */ bl FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb
|
||||||
/* 80082680 0007F5E0 C0 41 00 34 */ lfs f2, 0x34(r1)
|
/* 80082680 0007F5E0 C0 41 00 34 */ lfs f2, 0x34(r1)
|
||||||
/* 80082684 0007F5E4 3C 60 80 5A */ lis r3, sUpVector__9CVector3f@ha
|
/* 80082684 0007F5E4 3C 60 80 5A */ lis r3, sUpVector__9CVector3f@ha
|
||||||
/* 80082688 0007F5E8 C0 21 00 38 */ lfs f1, 0x38(r1)
|
/* 80082688 0007F5E8 C0 21 00 38 */ lfs f1, 0x38(r1)
|
||||||
|
@ -3587,7 +3587,7 @@ ActivateFailSafe__11CBallCameraFfR13CStateManager:
|
||||||
/* 800839AC 0008090C 90 01 00 1C */ stw r0, 0x1c(r1)
|
/* 800839AC 0008090C 90 01 00 1C */ stw r0, 0x1c(r1)
|
||||||
/* 800839B0 00080910 80 08 05 14 */ lwz r0, 0x514(r8)
|
/* 800839B0 00080910 80 08 05 14 */ lwz r0, 0x514(r8)
|
||||||
/* 800839B4 00080914 90 01 00 20 */ stw r0, 0x20(r1)
|
/* 800839B4 00080914 90 01 00 20 */ stw r0, 0x20(r1)
|
||||||
/* 800839B8 00080918 48 00 62 FD */ bl FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb
|
/* 800839B8 00080918 48 00 62 FD */ bl FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb
|
||||||
/* 800839BC 0008091C C0 41 00 24 */ lfs f2, 0x24(r1)
|
/* 800839BC 0008091C C0 41 00 24 */ lfs f2, 0x24(r1)
|
||||||
/* 800839C0 00080920 7F C3 F3 78 */ mr r3, r30
|
/* 800839C0 00080920 7F C3 F3 78 */ mr r3, r30
|
||||||
/* 800839C4 00080924 C0 21 00 28 */ lfs f1, 0x28(r1)
|
/* 800839C4 00080924 C0 21 00 28 */ lfs f1, 0x28(r1)
|
||||||
|
@ -5069,7 +5069,7 @@ lbl_80084F3C:
|
||||||
/* 80084F68 00081EC8 90 01 00 E4 */ stw r0, 0xe4(r1)
|
/* 80084F68 00081EC8 90 01 00 E4 */ stw r0, 0xe4(r1)
|
||||||
/* 80084F6C 00081ECC 80 09 05 14 */ lwz r0, 0x514(r9)
|
/* 80084F6C 00081ECC 80 09 05 14 */ lwz r0, 0x514(r9)
|
||||||
/* 80084F70 00081ED0 90 01 00 E8 */ stw r0, 0xe8(r1)
|
/* 80084F70 00081ED0 90 01 00 E8 */ stw r0, 0xe8(r1)
|
||||||
/* 80084F74 00081ED4 48 00 4D 41 */ bl FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb
|
/* 80084F74 00081ED4 48 00 4D 41 */ bl FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb
|
||||||
/* 80084F78 00081ED8 C0 41 00 EC */ lfs f2, 0xec(r1)
|
/* 80084F78 00081ED8 C0 41 00 EC */ lfs f2, 0xec(r1)
|
||||||
/* 80084F7C 00081EDC C0 21 00 F0 */ lfs f1, 0xf0(r1)
|
/* 80084F7C 00081EDC C0 21 00 F0 */ lfs f1, 0xf0(r1)
|
||||||
/* 80084F80 00081EE0 C0 01 00 F4 */ lfs f0, 0xf4(r1)
|
/* 80084F80 00081EE0 C0 01 00 F4 */ lfs f0, 0xf4(r1)
|
||||||
|
@ -7160,7 +7160,7 @@ lbl_80086E2C:
|
||||||
/* 80086E7C 00083DDC 91 21 00 BC */ stw r9, 0xbc(r1)
|
/* 80086E7C 00083DDC 91 21 00 BC */ stw r9, 0xbc(r1)
|
||||||
/* 80086E80 00083DE0 91 01 00 C0 */ stw r8, 0xc0(r1)
|
/* 80086E80 00083DE0 91 01 00 C0 */ stw r8, 0xc0(r1)
|
||||||
/* 80086E84 00083DE4 90 01 00 C4 */ stw r0, 0xc4(r1)
|
/* 80086E84 00083DE4 90 01 00 C4 */ stw r0, 0xc4(r1)
|
||||||
/* 80086E88 00083DE8 48 00 2E 2D */ bl FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb
|
/* 80086E88 00083DE8 48 00 2E 2D */ bl FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb
|
||||||
/* 80086E8C 00083DEC C0 41 00 C8 */ lfs f2, 0xc8(r1)
|
/* 80086E8C 00083DEC C0 41 00 C8 */ lfs f2, 0xc8(r1)
|
||||||
/* 80086E90 00083DF0 C0 21 00 CC */ lfs f1, 0xcc(r1)
|
/* 80086E90 00083DF0 C0 21 00 CC */ lfs f1, 0xcc(r1)
|
||||||
/* 80086E94 00083DF4 C0 01 00 D0 */ lfs f0, 0xd0(r1)
|
/* 80086E94 00083DF4 C0 01 00 D0 */ lfs f0, 0xd0(r1)
|
||||||
|
@ -7735,7 +7735,7 @@ lbl_8008770C:
|
||||||
/* 80087734 00084694 38 E0 00 00 */ li r7, 0
|
/* 80087734 00084694 38 E0 00 00 */ li r7, 0
|
||||||
/* 80087738 00084698 C0 41 00 10 */ lfs f2, 0x10(r1)
|
/* 80087738 00084698 C0 41 00 10 */ lfs f2, 0x10(r1)
|
||||||
/* 8008773C 0008469C 90 01 00 58 */ stw r0, 0x58(r1)
|
/* 8008773C 0008469C 90 01 00 58 */ stw r0, 0x58(r1)
|
||||||
/* 80087740 000846A0 48 00 25 75 */ bl FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb
|
/* 80087740 000846A0 48 00 25 75 */ bl FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb
|
||||||
/* 80087744 000846A4 C0 22 89 B0 */ lfs f1, lbl_805AA6D0@sda21(r2)
|
/* 80087744 000846A4 C0 22 89 B0 */ lfs f1, lbl_805AA6D0@sda21(r2)
|
||||||
/* 80087748 000846A8 38 7E 03 7C */ addi r3, r30, 0x37c
|
/* 80087748 000846A8 38 7E 03 7C */ addi r3, r30, 0x37c
|
||||||
/* 8008774C 000846AC C0 81 00 5C */ lfs f4, 0x5c(r1)
|
/* 8008774C 000846AC C0 81 00 5C */ lfs f4, 0x5c(r1)
|
||||||
|
@ -8185,7 +8185,7 @@ lbl_80087D70:
|
||||||
/* 80087E08 00084D68 91 21 01 48 */ stw r9, 0x148(r1)
|
/* 80087E08 00084D68 91 21 01 48 */ stw r9, 0x148(r1)
|
||||||
/* 80087E0C 00084D6C 91 01 01 4C */ stw r8, 0x14c(r1)
|
/* 80087E0C 00084D6C 91 01 01 4C */ stw r8, 0x14c(r1)
|
||||||
/* 80087E10 00084D70 90 01 01 50 */ stw r0, 0x150(r1)
|
/* 80087E10 00084D70 90 01 01 50 */ stw r0, 0x150(r1)
|
||||||
/* 80087E14 00084D74 48 00 1E A1 */ bl FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb
|
/* 80087E14 00084D74 48 00 1E A1 */ bl FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb
|
||||||
/* 80087E18 00084D78 38 61 01 3C */ addi r3, r1, 0x13c
|
/* 80087E18 00084D78 38 61 01 3C */ addi r3, r1, 0x13c
|
||||||
/* 80087E1C 00084D7C 38 81 02 88 */ addi r4, r1, 0x288
|
/* 80087E1C 00084D7C 38 81 02 88 */ addi r4, r1, 0x288
|
||||||
/* 80087E20 00084D80 38 A1 02 98 */ addi r5, r1, 0x298
|
/* 80087E20 00084D80 38 A1 02 98 */ addi r5, r1, 0x298
|
||||||
|
@ -10215,7 +10215,7 @@ lbl_80089BE0:
|
||||||
/* 80089C30 00086B90 38 E0 00 00 */ li r7, 0
|
/* 80089C30 00086B90 38 E0 00 00 */ li r7, 0
|
||||||
/* 80089C34 00086B94 C0 41 00 08 */ lfs f2, 8(r1)
|
/* 80089C34 00086B94 C0 41 00 08 */ lfs f2, 8(r1)
|
||||||
/* 80089C38 00086B98 90 01 00 18 */ stw r0, 0x18(r1)
|
/* 80089C38 00086B98 90 01 00 18 */ stw r0, 0x18(r1)
|
||||||
/* 80089C3C 00086B9C 48 00 00 79 */ bl FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb
|
/* 80089C3C 00086B9C 48 00 00 79 */ bl FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb
|
||||||
/* 80089C40 00086BA0 C0 21 00 1C */ lfs f1, 0x1c(r1)
|
/* 80089C40 00086BA0 C0 21 00 1C */ lfs f1, 0x1c(r1)
|
||||||
/* 80089C44 00086BA4 7F C3 F3 78 */ mr r3, r30
|
/* 80089C44 00086BA4 7F C3 F3 78 */ mr r3, r30
|
||||||
/* 80089C48 00086BA8 C0 41 00 20 */ lfs f2, 0x20(r1)
|
/* 80089C48 00086BA8 C0 41 00 20 */ lfs f2, 0x20(r1)
|
||||||
|
@ -10246,8 +10246,8 @@ lbl_80089BE0:
|
||||||
/* 80089CAC 00086C0C 38 21 00 B0 */ addi r1, r1, 0xb0
|
/* 80089CAC 00086C0C 38 21 00 B0 */ addi r1, r1, 0xb0
|
||||||
/* 80089CB0 00086C10 4E 80 00 20 */ blr
|
/* 80089CB0 00086C10 4E 80 00 20 */ blr
|
||||||
|
|
||||||
.global FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb
|
.global FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb
|
||||||
FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb:
|
FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb:
|
||||||
/* 80089CB4 00086C14 94 21 EA 10 */ stwu r1, -0x15f0(r1)
|
/* 80089CB4 00086C14 94 21 EA 10 */ stwu r1, -0x15f0(r1)
|
||||||
/* 80089CB8 00086C18 7C 08 02 A6 */ mflr r0
|
/* 80089CB8 00086C18 7C 08 02 A6 */ mflr r0
|
||||||
/* 80089CBC 00086C1C 90 01 15 F4 */ stw r0, 0x15f4(r1)
|
/* 80089CBC 00086C1C 90 01 15 F4 */ stw r0, 0x15f4(r1)
|
||||||
|
@ -12730,7 +12730,7 @@ Reset__11CBallCameraFRC12CTransform4fR13CStateManager:
|
||||||
/* 8008C124 00089084 90 01 00 40 */ stw r0, 0x40(r1)
|
/* 8008C124 00089084 90 01 00 40 */ stw r0, 0x40(r1)
|
||||||
/* 8008C128 00089088 C0 3E 01 90 */ lfs f1, 0x190(r30)
|
/* 8008C128 00089088 C0 3E 01 90 */ lfs f1, 0x190(r30)
|
||||||
/* 8008C12C 0008908C C0 5E 01 A0 */ lfs f2, 0x1a0(r30)
|
/* 8008C12C 0008908C C0 5E 01 A0 */ lfs f2, 0x1a0(r30)
|
||||||
/* 8008C130 00089090 4B FF DB 85 */ bl FindDesiredPosition__11CBallCameraFffRC9CVector3fR13CStateManagerb
|
/* 8008C130 00089090 4B FF DB 85 */ bl FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb
|
||||||
/* 8008C134 00089094 C0 41 00 44 */ lfs f2, 0x44(r1)
|
/* 8008C134 00089094 C0 41 00 44 */ lfs f2, 0x44(r1)
|
||||||
/* 8008C138 00089098 7F E3 FB 78 */ mr r3, r31
|
/* 8008C138 00089098 7F E3 FB 78 */ mr r3, r31
|
||||||
/* 8008C13C 0008909C C0 21 00 48 */ lfs f1, 0x48(r1)
|
/* 8008C13C 0008909C C0 21 00 48 */ lfs f1, 0x48(r1)
|
||||||
|
|
|
@ -15,11 +15,20 @@ public:
|
||||||
kI_Valid,
|
kI_Valid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
f32 GetTime() const { return x0_t; }
|
||||||
|
bool IsValid() const { return x20_valid; }
|
||||||
|
// GetPlane__14CRayCastResultCFv
|
||||||
|
// GetPoint__14CRayCastResultCFv
|
||||||
|
// GetMaterial__14CRayCastResultCFv
|
||||||
|
// Transform__14CRayCastResultFRC12CTransform4f
|
||||||
|
|
||||||
|
// MakeInvalid__14CRayCastResultFv
|
||||||
|
|
||||||
private:
|
private:
|
||||||
f32 x0_t;
|
f32 x0_t;
|
||||||
CVector3f x4_point;
|
CVector3f x4_point;
|
||||||
CPlane x10_plane;
|
CPlane x10_plane;
|
||||||
EInvalid x20_invalid;
|
bool x20_valid;
|
||||||
CMaterialList x28_material;
|
CMaterialList x28_material;
|
||||||
};
|
};
|
||||||
CHECK_SIZEOF(CRayCastResult, 0x30)
|
CHECK_SIZEOF(CRayCastResult, 0x30)
|
||||||
|
|
|
@ -20,13 +20,49 @@ public:
|
||||||
CAABox& operator=(const CAABox&);
|
CAABox& operator=(const CAABox&);
|
||||||
|
|
||||||
CVector3f ClosestPointAlongVector(const CVector3f& vec) const;
|
CVector3f ClosestPointAlongVector(const CVector3f& vec) const;
|
||||||
|
// FurthestPointAlongVector__6CAABoxCFRC9CVector3f global
|
||||||
|
const CVector3f& GetMinPoint() const { return min; }
|
||||||
|
const CVector3f& GetMaxPoint() const { return max; }
|
||||||
|
// GetCenterPoint__6CAABoxCFv global
|
||||||
|
// GetPoint__6CAABoxCFi global
|
||||||
|
// Include__6CAABoxFRC9CVector3f weak
|
||||||
|
// Include__6CAABoxFRC6CAABox weak
|
||||||
|
// AccumulateBounds__6CAABoxFRC9CVector3f global
|
||||||
|
// bool Invalid__6CAABoxCFv global
|
||||||
|
// PointInside__6CAABoxCFRC9CVector3f global
|
||||||
|
// InsidePlane__6CAABoxCFRC6CPlane global
|
||||||
|
// DoBoundsOverlap__6CAABoxCFRC6CAABox global
|
||||||
|
// GetVolume__6CAABoxCFv global
|
||||||
|
// GetBooleanIntersection__6CAABoxCFRC6CAABox global
|
||||||
|
// Inside__6CAABoxCFRC6CAABox global
|
||||||
|
// ClampToBox__6CAABoxCFRC9CVector3f global
|
||||||
|
// GetTri__6CAABoxCFQ26CAABox10EBoxFaceIdi global
|
||||||
|
// DistanceBetween__6CAABoxFRC6CAABoxRC6CAABox global
|
||||||
|
|
||||||
|
// GetPointA__6CAABoxCFv weak
|
||||||
|
// GetPointB__6CAABoxCFv weak
|
||||||
|
// GetPointC__6CAABoxCFv weak
|
||||||
|
// GetPointD__6CAABoxCFv weak
|
||||||
|
// GetPointE__6CAABoxCFv weak
|
||||||
|
// GetPointF__6CAABoxCFv weak
|
||||||
|
// GetPointG__6CAABoxCFv weak
|
||||||
|
// GetPointH__6CAABoxCFv weak
|
||||||
|
|
||||||
|
// GetWidth__6CAABoxCFv weak
|
||||||
|
// GetDepth__6CAABoxCFv weak
|
||||||
|
// GetHeight__6CAABoxCFv weak
|
||||||
|
// GetTri__6CAABoxCFii weak
|
||||||
|
// GetEdge__6CAABoxCFi weak
|
||||||
|
|
||||||
|
// GetTransformedAABox__6CAABoxCFRC12CTransform4f
|
||||||
|
|
||||||
static const CAABox& Identity() { return mskNullBox; }
|
static const CAABox& Identity() { return mskNullBox; }
|
||||||
static const CAABox& MakeMaxInvertedBox() { return mskInvertedBox; }
|
static const CAABox& MakeMaxInvertedBox() { return mskInvertedBox; }
|
||||||
|
// MakeNullBox__6CAABoxFv ??
|
||||||
|
|
||||||
private:
|
private:
|
||||||
f32 minX, minY, minZ;
|
CVector3f min;
|
||||||
f32 maxX, maxY, maxZ;
|
CVector3f max;
|
||||||
|
|
||||||
static CAABox mskInvertedBox;
|
static CAABox mskInvertedBox;
|
||||||
static CAABox mskNullBox;
|
static CAABox mskNullBox;
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
#include "math.h"
|
||||||
|
|
||||||
#define M_PIF 3.14159265358979323846f
|
#define M_PIF 3.14159265358979323846f
|
||||||
|
|
||||||
class CMath {
|
class CMath {
|
||||||
|
@ -14,9 +16,52 @@ public:
|
||||||
return x - v * y;
|
return x - v * y;
|
||||||
}
|
}
|
||||||
template < typename T >
|
template < typename T >
|
||||||
static const T& Clamp(const T& min, const T& val, const T& max);
|
static const T& Clamp(const T& min, const T& val, const T& max); // TODO: weak
|
||||||
// ClampRadians__5CMathFf
|
|
||||||
static f32 SqrtF(f32 v);
|
static f32 SqrtF(f32 v);
|
||||||
|
static inline f32 Limit(f32 v, f32 h) { return fabs(v) > h ? h * Sign(v) : v; }
|
||||||
|
static inline f32 Sign(f32 v) { return FastFSel(v, 1.f, -1.f); }
|
||||||
|
static inline f32 FastFSel(register f32 v, register f32 h, register f32 l) {
|
||||||
|
register f32 out;
|
||||||
|
asm {
|
||||||
|
fsel out, v, h, l
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
static inline f32 AbsF(f32 v) { return fabs(v); }
|
||||||
|
// WrapPi__5CMathFf weak
|
||||||
|
// WrapTwoPi__5CMathFf weak
|
||||||
|
// FastFmod__5CMathFfff weak
|
||||||
|
// Min<f>__5CMathFRCfRCf weak
|
||||||
|
// Max<f>__5CMathFRCfRCf weak
|
||||||
|
// InvSqrtF__5CMathFf global
|
||||||
|
// FastArcCosR__5CMathFf global
|
||||||
|
// SlowCosineR__5CMathFf global
|
||||||
|
// SlowSineR__5CMathFf global
|
||||||
|
// FastCosR__5CMathFf global
|
||||||
|
// GetBezierPoint__5CMathFRC9CVector3fRC9CVector3fRC9CVector3fRC9CVector3ff global
|
||||||
|
// ClampRadians__5CMathFf weak
|
||||||
|
// ModF__5CMathFff weak
|
||||||
|
// Deg2Rad__5CMathFf weak
|
||||||
|
// Deg2Rev__5CMathFf weak
|
||||||
|
// ArcCosineR__5CMathFf global
|
||||||
|
// FloorF__5CMathFf global
|
||||||
|
// BaryToWorld__5CMathFRC9CVector3fRC9CVector3fRC9CVector3fRC9CVector3f global
|
||||||
|
// GetCatmullRomSplinePoint__5CMathFRC9CVector3fRC9CVector3fRC9CVector3fRC9CVector3ff global
|
||||||
|
// FastSqrtF__5CMathFf weak
|
||||||
|
// SqrtD__5CMathFd global
|
||||||
|
// AbsD__5CMathFd weak
|
||||||
|
// IsEpsilon__5CMathFfff global
|
||||||
|
// FastMin__5CMathFff weak
|
||||||
|
// FastMax__5CMathFff weak
|
||||||
|
// PowF__5CMathFff global
|
||||||
|
// Rev2Deg__5CMathFf weak
|
||||||
|
// GetCatmullRomSplinePoint__5CMathFfffff global
|
||||||
|
// SlowTangentR__5CMathFf global
|
||||||
|
// Rad2Deg__5CMathFf weak
|
||||||
|
// Rad2Rev__5CMathFf weak
|
||||||
|
// CeilingF__5CMathFf global
|
||||||
|
// ArcTangentR__5CMathFf global
|
||||||
|
// Swap<f>__5CMathFRfRf weak
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,15 +47,16 @@ public:
|
||||||
// GetColumn__12CTransform4fCF5EDimZ
|
// GetColumn__12CTransform4fCF5EDimZ
|
||||||
// GetColumn__12CTransform4fCFi
|
// GetColumn__12CTransform4fCFi
|
||||||
// GetCStyleMatrix__12CTransform4fCFv
|
// GetCStyleMatrix__12CTransform4fCFv
|
||||||
// GetInverse__12CTransform4fCFv
|
CTransform4f GetInverse() const;
|
||||||
CTransform4f GetQuickInverse() const;
|
CTransform4f GetQuickInverse() const;
|
||||||
// GetRotation__12CTransform4fCFv
|
CTransform4f GetRotation() const;
|
||||||
inline const CVector3f& GetRow(EDimX dim) const { return m0; }
|
inline const CVector3f& GetRow(EDimX dim) const { return m0; }
|
||||||
inline const CVector3f& GetRow(EDimY dim) const { return m1; }
|
inline const CVector3f& GetRow(EDimY dim) const { return m1; }
|
||||||
inline const CVector3f& GetRow(EDimZ dim) const { return m2; }
|
inline const CVector3f& GetRow(EDimZ dim) const { return m2; }
|
||||||
// GetRow__12CTransform4fCFi
|
// GetRow__12CTransform4fCFi
|
||||||
// GetUp__12CTransform4fCFv
|
// GetUp__12CTransform4fCFv
|
||||||
// LookAt__12CTransform4fFRC9CVector3fRC9CVector3fRC9CVector3f
|
static CTransform4f LookAt(const CVector3f& pos, const CVector3f& lookPos,
|
||||||
|
const CVector3f& up = CVector3f::Up());
|
||||||
// MakeRotationsBasedOnY__12CTransform4fFRC13CUnitVector3f
|
// MakeRotationsBasedOnY__12CTransform4fFRC13CUnitVector3f
|
||||||
CTransform4f MultiplyIgnoreTranslation(const CTransform4f& other) const;
|
CTransform4f MultiplyIgnoreTranslation(const CTransform4f& other) const;
|
||||||
// Orthonormalize__12CTransform4fFv
|
// Orthonormalize__12CTransform4fFv
|
||||||
|
@ -91,7 +92,7 @@ public:
|
||||||
|
|
||||||
CTransform4f& operator*=(const CTransform4f& other);
|
CTransform4f& operator*=(const CTransform4f& other);
|
||||||
CTransform4f operator*(const CTransform4f& vec) const;
|
CTransform4f operator*(const CTransform4f& vec) const;
|
||||||
CTransform4f operator*(const CVector3f& vec) const;
|
CVector3f operator*(const CVector3f& vec) const;
|
||||||
|
|
||||||
static CTransform4f FromColumns(const CVector3f&, const CVector3f&, const CVector3f&,
|
static CTransform4f FromColumns(const CVector3f&, const CVector3f&, const CVector3f&,
|
||||||
const CVector3f&);
|
const CVector3f&);
|
||||||
|
|
|
@ -30,13 +30,15 @@ public:
|
||||||
|
|
||||||
// ByElementMultiply__9CVector3fFRC9CVector3fRC9CVector3f
|
// ByElementMultiply__9CVector3fFRC9CVector3fRC9CVector3f
|
||||||
// Slerp__9CVector3fFRC9CVector3fRC9CVector3fRC9CRelAngle
|
// Slerp__9CVector3fFRC9CVector3fRC9CVector3fRC9CRelAngle
|
||||||
// Normalize__9CVector3fFv
|
void Normalize();
|
||||||
// Magnitude__9CVector3fCFv
|
f32 Magnitude() const;
|
||||||
// AsNormalized__9CVector3fCFv
|
// AsNormalized__9CVector3fCFv
|
||||||
// CanBeNormalized__9CVector3fCFv
|
bool CanBeNormalized() const;
|
||||||
// GetAngleDiff__9CVector3fFRC9CVector3fRC9CVector3f
|
// GetAngleDiff__9CVector3fFRC9CVector3fRC9CVector3f
|
||||||
// IsEqu__9CVector3fCFRC9CVector3ff
|
// IsEqu__9CVector3fCFRC9CVector3ff
|
||||||
// Lerp__9CVector3fFRC9CVector3fRC9CVector3ff
|
// Lerp__9CVector3fFRC9CVector3fRC9CVector3ff
|
||||||
|
// MagSquared__9CVector3fCFv weak
|
||||||
|
// Cross__9CVector3fFRC9CVector3fRC9CVector3f weak
|
||||||
|
|
||||||
f32& operator[](EDimX dim) { return mX; }
|
f32& operator[](EDimX dim) { return mX; }
|
||||||
f32& operator[](EDimY dim) { return mY; }
|
f32& operator[](EDimY dim) { return mY; }
|
||||||
|
|
|
@ -34,6 +34,7 @@ class CWorld;
|
||||||
class CWorldTransManager;
|
class CWorldTransManager;
|
||||||
class CEntity;
|
class CEntity;
|
||||||
class CMazeState;
|
class CMazeState;
|
||||||
|
class CRayCastResult;
|
||||||
|
|
||||||
namespace SL {
|
namespace SL {
|
||||||
class CSortedListManager;
|
class CSortedListManager;
|
||||||
|
@ -53,6 +54,12 @@ public:
|
||||||
void FreeScriptObject(TUniqueId uid);
|
void FreeScriptObject(TUniqueId uid);
|
||||||
rstl::pair< TEditorId, TUniqueId > GenerateObject(const TEditorId& eid);
|
rstl::pair< TEditorId, TUniqueId > GenerateObject(const TEditorId& eid);
|
||||||
|
|
||||||
|
bool RayCollideWorld(const CVector3f& start, const CVector3f& end, const TEntityList& nearList,
|
||||||
|
const CMaterialFilter& filter, const CActor* damagee) const;
|
||||||
|
CRayCastResult RayWorldIntersection(TUniqueId& idOut, const CVector3f& pos, const CVector3f& dir,
|
||||||
|
f32 length, const CMaterialFilter& filter,
|
||||||
|
const TEntityList& list) const;
|
||||||
|
|
||||||
CEntity* ObjectById(TUniqueId uid);
|
CEntity* ObjectById(TUniqueId uid);
|
||||||
const CEntity* GetObjectById(TUniqueId uid) const;
|
const CEntity* GetObjectById(TUniqueId uid) const;
|
||||||
TUniqueId GetIdForScript(TEditorId eid) const;
|
TUniqueId GetIdForScript(TEditorId eid) const;
|
||||||
|
|
|
@ -39,27 +39,31 @@ public:
|
||||||
|
|
||||||
f32 GetRadius() const { return x4_radius; }
|
f32 GetRadius() const { return x4_radius; }
|
||||||
// TODO
|
// TODO
|
||||||
CVector3f GetRealPosition() const;
|
const CVector3f& GetRealPosition() const { return x2c_lastWorldPos; }
|
||||||
CVector3f GetDesiredPosition() const;
|
const CVector3f& GetDesiredPosition() const { return x14_localPos; }
|
||||||
CVector3f GetLookAtPosition() const;
|
const CVector3f& GetLookAtPosition() const { return x20_scaledWorldPos; }
|
||||||
CVector3f GetLineOfSight() const;
|
const CVector3f& GetLineOfSight() const;
|
||||||
CVector3f GetPosition() const;
|
const CVector3f& GetPosition() const { return x8_lastLocalPos; }
|
||||||
|
uint GetOcclusionCount() const { return x4c_occlusionCount; }
|
||||||
|
|
||||||
void SetRadius(f32 radius) { this->x4_radius = radius; }
|
void SetRadius(f32 radius) { this->x4_radius = radius; }
|
||||||
// TODO
|
// TODO
|
||||||
void SetPosition();
|
void SetPosition(CVector3f vec) { x8_lastLocalPos = vec; }
|
||||||
void SetRealPosition(CVector3f vec) { x2c_lastWorldPos = vec; }
|
void SetRealPosition(CVector3f vec) { x2c_lastWorldPos = vec; }
|
||||||
void SetDesiredPosition(CVector3f vec) { x14_localPos = vec; }
|
void SetDesiredPosition(CVector3f vec) { x14_localPos = vec; }
|
||||||
void SetLookAtPosition(CVector3f vec) { x20_scaledWorldPos = vec; }
|
void SetLookAtPosition(CVector3f vec) { x20_scaledWorldPos = vec; }
|
||||||
void SetLineOfSight();
|
void SetLineOfSight();
|
||||||
|
void SetOcclusionCount(uint val) { x4c_occlusionCount = val; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
f32 x4_radius;
|
f32 x4_radius;
|
||||||
CVector3f x8_lastLocalPos;
|
CVector3f x8_lastLocalPos; // position
|
||||||
CVector3f x14_localPos; // desired position
|
CVector3f x14_localPos; // desired position
|
||||||
CVector3f x20_scaledWorldPos; // look at position
|
CVector3f x20_scaledWorldPos; // look at position
|
||||||
CVector3f x2c_lastWorldPos; // real position
|
CVector3f x2c_lastWorldPos; // real position
|
||||||
CCameraSpring x38_spring;
|
CCameraSpring x38_spring;
|
||||||
|
|
||||||
|
public: // TODO
|
||||||
uint x4c_occlusionCount;
|
uint x4c_occlusionCount;
|
||||||
f32 x50_scale;
|
f32 x50_scale;
|
||||||
};
|
};
|
||||||
|
@ -115,6 +119,17 @@ public:
|
||||||
void TeleportCamera(const CTransform4f& xf, CStateManager& mgr);
|
void TeleportCamera(const CTransform4f& xf, CStateManager& mgr);
|
||||||
void ResetPosition(CStateManager& mgr);
|
void ResetPosition(CStateManager& mgr);
|
||||||
void ResetToTweaks(CStateManager& mgr);
|
void ResetToTweaks(CStateManager& mgr);
|
||||||
|
CVector3f FindDesiredPosition(f32 distance, f32 elevation, CVector3f dir, CStateManager& mgr,
|
||||||
|
bool fullTest);
|
||||||
|
void UpdateCollidersDistances(rstl::vector< CCameraCollider >& colliderList, f32 xMag, f32 zMag,
|
||||||
|
f32 angOffset);
|
||||||
|
void UpdateColliders(const CTransform4f& xf, rstl::vector< CCameraCollider >& colliderList,
|
||||||
|
int& idx, int count, float tolerance, const TEntityList& nearList, f32 dt,
|
||||||
|
CStateManager& mgr);
|
||||||
|
|
||||||
|
const CVector3f& GetLookAtPosition() const { return x1d8_lookPos; }
|
||||||
|
f32 GetDistance() const { return x190_curMinDistance; }
|
||||||
|
f32 GetElevation() const { return x1a0_elevation; }
|
||||||
|
|
||||||
void SetBehaviourType(EBallCameraBehaviour type) { x188_behaviour = type; }
|
void SetBehaviourType(EBallCameraBehaviour type) { x188_behaviour = type; }
|
||||||
void SetAllowChaseCamera(bool v) { x18c_25_chaseAllowed = v; }
|
void SetAllowChaseCamera(bool v) { x18c_25_chaseAllowed = v; }
|
||||||
|
|
|
@ -23,6 +23,7 @@ class CStateManager;
|
||||||
class CCameraManager {
|
class CCameraManager {
|
||||||
public:
|
public:
|
||||||
CGameCamera* GetCurrentCamera(CStateManager& mgr) const;
|
CGameCamera* GetCurrentCamera(CStateManager& mgr) const;
|
||||||
|
void SetPlayerCamera(CStateManager& mgr, TUniqueId newCamId);
|
||||||
|
|
||||||
static f32 DefaultThirdPersonFov();
|
static f32 DefaultThirdPersonFov();
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
virtual void ProcessInput(const CFinalInput&, CStateManager& mgr) = 0;
|
virtual void ProcessInput(const CFinalInput&, CStateManager& mgr) = 0;
|
||||||
virtual void Reset(const CTransform4f&, CStateManager& mgr) = 0;
|
virtual void Reset(const CTransform4f&, CStateManager& mgr) = 0;
|
||||||
|
|
||||||
|
TUniqueId GetWatchedObject() const { return xe8_watchedObject; }
|
||||||
f32 GetFov() const { return x15c_currentFov; }
|
f32 GetFov() const { return x15c_currentFov; }
|
||||||
void SetFov(f32 fov) { x15c_currentFov = fov; }
|
void SetFov(f32 fov) { x15c_currentFov = fov; }
|
||||||
void SetFovInterpolation(f32 start, f32 fov, f32 time, f32 delayTime);
|
void SetFovInterpolation(f32 start, f32 fov, f32 time, f32 delayTime);
|
||||||
|
|
|
@ -149,7 +149,10 @@ public:
|
||||||
virtual bool IsTransparent();
|
virtual bool IsTransparent();
|
||||||
|
|
||||||
CVector3f GetBallPosition() const;
|
CVector3f GetBallPosition() const;
|
||||||
|
CTransform4f CreateTransformFromMovementDirection() const;
|
||||||
EPlayerOrbitState GetOrbitState() const { return x304_orbitState; }
|
EPlayerOrbitState GetOrbitState() const { return x304_orbitState; }
|
||||||
|
const CVector3f& GetMovementDirection() const { return x50c_moveDir; }
|
||||||
|
// GetMovementDirection2D__7CPlayerCFv ??
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CVisorSteam {
|
struct CVisorSteam {
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _MATH_INLINE
|
||||||
|
#define _MATH_INLINE static inline
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
|
|
||||||
/* Metrowerks */
|
/* Metrowerks */
|
||||||
|
@ -67,8 +71,8 @@ double sin(double x);
|
||||||
double cos(double x);
|
double cos(double x);
|
||||||
double atan(double x);
|
double atan(double x);
|
||||||
|
|
||||||
float sinf(float x);
|
_MATH_INLINE float sinf(float x) { return (float)sin((double)x); }
|
||||||
float cosf(float x);
|
_MATH_INLINE float cosf(float x) { return (float)cos((double)x); }
|
||||||
float tanf(float x);
|
float tanf(float x);
|
||||||
float acosf(float x);
|
float acosf(float x);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include "Kyoto/Math/CAABox.hpp"
|
||||||
|
|
||||||
|
#include "Kyoto/Math/CMath.hpp"
|
||||||
|
|
||||||
|
CVector3f CAABox::ClosestPointAlongVector(const CVector3f& vec) const {
|
||||||
|
return CVector3f(CMath::FastFSel(vec.GetX(), min.GetX(), max.GetX()),
|
||||||
|
CMath::FastFSel(vec.GetY(), min.GetY(), max.GetY()),
|
||||||
|
CMath::FastFSel(vec.GetZ(), min.GetZ(), max.GetZ()));
|
||||||
|
}
|
|
@ -2,10 +2,13 @@
|
||||||
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
|
#include "Collision/CRayCastResult.hpp"
|
||||||
|
|
||||||
#include "MetroidPrime/CCollisionActor.hpp"
|
#include "MetroidPrime/CCollisionActor.hpp"
|
||||||
#include "MetroidPrime/Cameras/CCameraManager.hpp"
|
#include "MetroidPrime/Cameras/CCameraManager.hpp"
|
||||||
#include "MetroidPrime/Player/CPlayer.hpp"
|
#include "MetroidPrime/Player/CPlayer.hpp"
|
||||||
#include "MetroidPrime/Tweaks/CTweakBall.hpp"
|
#include "MetroidPrime/Tweaks/CTweakBall.hpp"
|
||||||
|
#include "MetroidPrime/Tweaks/CTweakPlayer.hpp"
|
||||||
|
|
||||||
static CMaterialList kLineOfSightIncludeList = CMaterialList(kMT_Solid);
|
static CMaterialList kLineOfSightIncludeList = CMaterialList(kMT_Solid);
|
||||||
static CMaterialList kLineOfSightExcludeList =
|
static CMaterialList kLineOfSightExcludeList =
|
||||||
|
@ -98,7 +101,6 @@ CBallCamera::CBallCamera(TUniqueId uid, TUniqueId watchedId, const CTransform4f&
|
||||||
, x36c_splineState(kBSS_Invalid)
|
, x36c_splineState(kBSS_Invalid)
|
||||||
, x370_24_reevalSplineEnd(false)
|
, x370_24_reevalSplineEnd(false)
|
||||||
, x374_splineCtrl(0.f)
|
, x374_splineCtrl(0.f)
|
||||||
// , x378_splineCtrlRange()
|
|
||||||
, x37c_camSpline(false)
|
, x37c_camSpline(false)
|
||||||
, x3c8_collisionExcludeList(kMT_NoStepLogic)
|
, x3c8_collisionExcludeList(kMT_NoStepLogic)
|
||||||
, x3d0_24_camBehindFloorOrWall(false)
|
, x3d0_24_camBehindFloorOrWall(false)
|
||||||
|
@ -141,6 +143,7 @@ CBallCamera::CBallCamera(TUniqueId uid, TUniqueId watchedId, const CTransform4f&
|
||||||
SetupColliders(x284_largeColliders, 7.f, 7.f, 0.1f, 12, 2.f, 0.5f, -M_PIF / 2.f);
|
SetupColliders(x284_largeColliders, 7.f, 7.f, 0.1f, 12, 2.f, 0.5f, -M_PIF / 2.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO non-matching inline shennangians
|
||||||
CBallCamera::~CBallCamera() {}
|
CBallCamera::~CBallCamera() {}
|
||||||
|
|
||||||
void CBallCamera::TeleportColliders(rstl::vector< CCameraCollider >& colliderList, CVector3f pos) {
|
void CBallCamera::TeleportColliders(rstl::vector< CCameraCollider >& colliderList, CVector3f pos) {
|
||||||
|
@ -161,9 +164,9 @@ void CBallCamera::TeleportCamera(const CVector3f& pos, CStateManager& mgr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO non-matching
|
|
||||||
void CBallCamera::ResetPosition(CStateManager& mgr) {
|
void CBallCamera::ResetPosition(CStateManager& mgr) {
|
||||||
x1d8_lookPos = mgr.GetPlayer()->GetBallPosition();
|
CVector3f pos = mgr.GetPlayer()->GetBallPosition();
|
||||||
|
x1d8_lookPos = pos;
|
||||||
x1d8_lookPos.SetZ(x1d8_lookPos.GetZ() + x1b4_lookAtOffset.GetZ());
|
x1d8_lookPos.SetZ(x1d8_lookPos.GetZ() + x1b4_lookAtOffset.GetZ());
|
||||||
x1c0_lookPosAhead = x1d8_lookPos;
|
x1c0_lookPosAhead = x1d8_lookPos;
|
||||||
x1cc_fixedLookPos = x1d8_lookPos;
|
x1cc_fixedLookPos = x1d8_lookPos;
|
||||||
|
@ -207,6 +210,7 @@ void CBallCamera::ResetToTweaks(CStateManager& mgr) {
|
||||||
x18e_26_ = false;
|
x18e_26_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO non-matching
|
||||||
void CBallCamera::SetupColliders(rstl::vector< CCameraCollider >& out, f32 xMag, f32 zMag,
|
void CBallCamera::SetupColliders(rstl::vector< CCameraCollider >& out, f32 xMag, f32 zMag,
|
||||||
f32 radius, int count, f32 k, f32 max, f32 startAngle) {
|
f32 radius, int count, f32 k, f32 max, f32 startAngle) {
|
||||||
out.reserve(count);
|
out.reserve(count);
|
||||||
|
@ -221,3 +225,132 @@ void CBallCamera::SetupColliders(rstl::vector< CCameraCollider >& out, f32 xMag,
|
||||||
theta += 2.f * M_PIF / f32(count);
|
theta += 2.f * M_PIF / f32(count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBallCamera::Render(const CStateManager& mgr) const {}
|
||||||
|
|
||||||
|
void CBallCamera::Reset(const CTransform4f& xf, CStateManager& mgr) {
|
||||||
|
x214_ballCameraSpring.Reset();
|
||||||
|
x228_ballCameraCentroidSpring.Reset();
|
||||||
|
x23c_ballCameraLookAtSpring.Reset();
|
||||||
|
x250_ballCameraCentroidDistanceSpring.Reset();
|
||||||
|
x41c_ballCameraChaseSpring.Reset();
|
||||||
|
x448_ballCameraBoostSpring.Reset();
|
||||||
|
|
||||||
|
CVector3f desiredPos =
|
||||||
|
FindDesiredPosition(GetDistance(), GetElevation(), xf.GetForward(), mgr, false);
|
||||||
|
|
||||||
|
if (const CPlayer* player = TCastToConstPtr< CPlayer >(mgr.GetObjectById(GetWatchedObject()))) {
|
||||||
|
ResetPosition(mgr);
|
||||||
|
x310_idealLookVec = x1b4_lookAtOffset;
|
||||||
|
x31c_predictedLookPos = GetLookAtPosition();
|
||||||
|
CVector3f dist = GetLookAtPosition() - desiredPos;
|
||||||
|
dist.SetZ(0.f);
|
||||||
|
if (dist.CanBeNormalized()) {
|
||||||
|
TeleportCamera(CTransform4f::LookAt(desiredPos, GetLookAtPosition()), mgr);
|
||||||
|
} else {
|
||||||
|
CTransform4f camXf = player->CreateTransformFromMovementDirection();
|
||||||
|
camXf.SetTranslation(desiredPos);
|
||||||
|
TeleportCamera(camXf, mgr);
|
||||||
|
mgr.CameraManager()->SetPlayerCamera(mgr, GetUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
x2e8_ballVelFlat = 0.f;
|
||||||
|
x2ec_maxBallVel = 0.f;
|
||||||
|
x190_curMinDistance = x194_targetMinDistance;
|
||||||
|
x2fc_ballDeltaFlat = CVector3f::Zero();
|
||||||
|
x2f0_ballDelta = CVector3f::Zero();
|
||||||
|
x18d_28_obtuseDirection = false;
|
||||||
|
x308_speedFactor = 0.f;
|
||||||
|
x2dc_prevBallPos = player->GetBallPosition();
|
||||||
|
x294_dampedPos = GetTranslation();
|
||||||
|
x2a0_smallCentroid = CVector3f::Zero();
|
||||||
|
x2ac_mediumCentroid = CVector3f::Zero();
|
||||||
|
x2b8_largeCentroid = CVector3f::Zero();
|
||||||
|
x2c4_smallCollidersObsCount = 0;
|
||||||
|
x2c8_mediumCollidersObsCount = 0;
|
||||||
|
x2cc_largeCollidersObsCount = 0;
|
||||||
|
x2d0_smallColliderIt = 0;
|
||||||
|
x2d4_mediumColliderIt = 0;
|
||||||
|
x2d8_largeColliderIt = 0;
|
||||||
|
x32c_colliderMag = 1.f;
|
||||||
|
x18d_25_avoidGeometryFull = true;
|
||||||
|
x18d_27_forceProcessing = true;
|
||||||
|
Think(0.1f, mgr);
|
||||||
|
x18d_25_avoidGeometryFull = false;
|
||||||
|
x18d_27_forceProcessing = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBallCamera::UpdateCollidersDistances(rstl::vector< CCameraCollider >& colliderList, f32 xMag,
|
||||||
|
f32 zMag, f32 angOffset) {
|
||||||
|
f32 theta = angOffset;
|
||||||
|
for (int i = 0; i < colliderList.size(); ++i) {
|
||||||
|
f32 z = cosf(theta) * zMag;
|
||||||
|
if (theta > M_PIF / 2.f) {
|
||||||
|
z *= 0.25f;
|
||||||
|
}
|
||||||
|
f32 x = CMath::Limit(sinf(theta), 1.f) * xMag;
|
||||||
|
CVector3f pos(x, 0.f, z);
|
||||||
|
colliderList[i].SetDesiredPosition(pos);
|
||||||
|
theta += 2.f * M_PIF / colliderList.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO non-matching
|
||||||
|
void CBallCamera::UpdateColliders(const CTransform4f& xf,
|
||||||
|
rstl::vector< CCameraCollider >& colliderList, int& idx,
|
||||||
|
int count, float tolerance, const TEntityList& nearList, f32 dt,
|
||||||
|
CStateManager& mgr) {
|
||||||
|
if (idx < colliderList.size()) {
|
||||||
|
const CPlayer& player = *mgr.GetPlayer();
|
||||||
|
x310_idealLookVec = CVector3f(0.f, gpTweakBall->GetBallCameraOffset().GetY(),
|
||||||
|
gpTweakPlayer->GetPlayerBallHalfExtent());
|
||||||
|
x310_idealLookVec.SetY(x310_idealLookVec.GetY() * x308_speedFactor);
|
||||||
|
x31c_predictedLookPos = player.GetMovementDirection() * x310_idealLookVec.GetY();
|
||||||
|
x31c_predictedLookPos.SetZ(x310_idealLookVec.GetZ());
|
||||||
|
x31c_predictedLookPos += player.GetTranslation();
|
||||||
|
CTransform4f predictedLookXf = CTransform4f::LookAt(xf.GetTranslation(), x31c_predictedLookPos);
|
||||||
|
CVector3f predictedLookPos = predictedLookXf.GetTranslation();
|
||||||
|
for (int i = 0; i < count; ++i) {
|
||||||
|
CVector3f localPos = colliderList[idx].GetDesiredPosition();
|
||||||
|
CVector3f worldPos = predictedLookXf.Rotate(localPos) + predictedLookXf.GetTranslation();
|
||||||
|
CVector3f dist = colliderList[idx].GetRealPosition() - worldPos;
|
||||||
|
if (dist.Magnitude() < 0.1f) {
|
||||||
|
localPos = colliderList[idx].GetPosition();
|
||||||
|
worldPos = colliderList[idx].GetRealPosition();
|
||||||
|
}
|
||||||
|
CVector3f centerToCollider = worldPos - predictedLookPos;
|
||||||
|
f32 mag = centerToCollider.Magnitude();
|
||||||
|
if (centerToCollider.CanBeNormalized()) {
|
||||||
|
centerToCollider.Normalize();
|
||||||
|
TUniqueId intersectId = kInvalidUniqueId;
|
||||||
|
const CRayCastResult& result = mgr.RayWorldIntersection(
|
||||||
|
intersectId, predictedLookXf.GetTranslation(), centerToCollider,
|
||||||
|
mag + colliderList[idx].GetRadius(), kLineOfSightFilter, nearList);
|
||||||
|
f32 t = result.GetTime();
|
||||||
|
if (result.IsValid()) {
|
||||||
|
worldPos = predictedLookXf.GetTranslation() +
|
||||||
|
centerToCollider * (t - colliderList[idx].GetRadius());
|
||||||
|
CVector3f centerToPoint = worldPos - predictedLookXf.GetTranslation();
|
||||||
|
localPos = predictedLookXf.GetRotation().GetInverse() * centerToPoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
colliderList[idx].SetRealPosition(worldPos);
|
||||||
|
colliderList[idx].SetPosition(localPos);
|
||||||
|
CVector3f scaledWorldColliderPos = centerToCollider * mag * (1.f / tolerance);
|
||||||
|
scaledWorldColliderPos *= x308_speedFactor;
|
||||||
|
scaledWorldColliderPos += x31c_predictedLookPos;
|
||||||
|
colliderList[idx].SetLookAtPosition(scaledWorldColliderPos);
|
||||||
|
if (mgr.RayCollideWorld(worldPos, scaledWorldColliderPos, nearList, kLineOfSightFilter,
|
||||||
|
nullptr)) {
|
||||||
|
colliderList[idx].SetOcclusionCount(0);
|
||||||
|
} else {
|
||||||
|
colliderList[idx].SetOcclusionCount(colliderList[idx].GetOcclusionCount() + 1);
|
||||||
|
}
|
||||||
|
idx += 1;
|
||||||
|
if (idx == colliderList.size()) {
|
||||||
|
idx = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
|
#define _MATH_INLINE
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
float cosf(float x) { return (float)cos((double)x); }
|
|
||||||
|
|
Loading…
Reference in New Issue