Skip to content

Commit

Permalink
Better CVector3f::Cross; link CVector3f/CModVectorElement
Browse files Browse the repository at this point in the history
Thanks @1superchip for the help
  • Loading branch information
encounter committed Sep 28, 2024
1 parent 3a933dc commit 539b269
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion config/GM8E01_00/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26512,7 +26512,7 @@ lbl_805AE630 = .sdata2:0x805AE630; // type:object size:0x4 data:float
lbl_805AE634 = .sdata2:0x805AE634; // type:object size:0x4 data:float
lbl_805AE638 = .sdata2:0x805AE638; // type:object size:0x4 data:float
lbl_805AE63C = .sdata2:0x805AE63C; // type:object size:0x4 data:float
lbl_805AE640 = .sdata2:0x805AE640; // type:object size:0x8 data:float
lbl_805AE640 = .sdata2:0x805AE640; // type:object size:0x4 data:float
lbl_805AE648 = .sdata2:0x805AE648; // type:object size:0x4 data:float
lbl_805AE64C = .sdata2:0x805AE64C; // type:object size:0x4 data:float
lbl_805AE650 = .sdata2:0x805AE650; // type:object size:0x4 data:float
Expand Down
4 changes: 2 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ def Rel(lib_name, objects):
Object(Matching, "Kyoto/Math/CVector2f.cpp"),
Object(Matching, "Kyoto/Math/CVector2i.cpp"),
Object(Matching, "Kyoto/Math/CVector3d.cpp"),
Object(NonMatching, "Kyoto/Math/CVector3f.cpp"),
Object(Matching, "Kyoto/Math/CVector3f.cpp"),
Object(Matching, "Kyoto/Math/CVector3i.cpp"),
Object(NonMatching, "Kyoto/Math/RMathUtils.cpp"),
Object(Matching, "Kyoto/CCrc32.cpp"),
Expand All @@ -931,7 +931,7 @@ def Rel(lib_name, objects):
Object(Matching, "Kyoto/Particles/CColorElement.cpp"),
Object(NonMatching, "Kyoto/Particles/CElementGen.cpp"),
Object(Matching, "Kyoto/Particles/CIntElement.cpp"),
Object(NonMatching, "Kyoto/Particles/CModVectorElement.cpp"),
Object(Matching, "Kyoto/Particles/CModVectorElement.cpp"),
Object(NonMatching, "Kyoto/Particles/CParticleDataFactory.cpp"),
Object(Matching, "Kyoto/Particles/CParticleGen.cpp"),
Object(Matching, "Kyoto/Particles/CParticleGlobals.cpp"),
Expand Down
18 changes: 9 additions & 9 deletions include/Kyoto/Math/CVector3f.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class CVector3f {
CVector3f(CInputStream& in);
void PutTo(COutputStream& out) const;

float GetX() const { return mX; }
float GetY() const { return mY; }
float GetZ() const { return mZ; }
const float GetX() const { return mX; }
const float GetY() const { return mY; }
const float GetZ() const { return mZ; }

void SetX(float x) { mX = x; }
void SetY(float y) { mY = y; }
Expand Down Expand Up @@ -55,12 +55,12 @@ class CVector3f {
}
inline float MagSquared() const { return GetX() * GetX() + GetY() * GetY() + GetZ() * GetZ(); }
static CVector3f Cross(const CVector3f& lhs, const CVector3f& rhs) {
const float lX = lhs.mX;
const float lY = lhs.mY;
const float lZ = lhs.mZ;
const float rX = rhs.mX;
const float rY = rhs.mY;
const float rZ = rhs.mZ;
const float lX = lhs.GetX();
const float lY = lhs.GetY();
const float lZ = lhs.GetZ();
const float rX = rhs.GetX();
const float rY = rhs.GetY();
const float rZ = rhs.GetZ();
float z = lX * rY - rX * lY;
float y = lZ * rX - rZ * lX;
float x = lY * rZ - rY * lZ;
Expand Down
2 changes: 1 addition & 1 deletion src/Kyoto/Math/CVector3f.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bool CVector3f::IsNotInf() const {
return true;
}

bool CVector3f::IsMagnitudeSafe() const { return IsNotInf() && MagSquared() >= 9.999999e-29f; }
bool CVector3f::IsMagnitudeSafe() const { return IsNotInf() && MagSquared() >= 9.9999995e-29f; }

bool CVector3f::CanBeNormalized() const {
int x = __HI(mX);
Expand Down
5 changes: 2 additions & 3 deletions src/Kyoto/Particles/CModVectorElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,10 @@ bool CMVESwirl::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
xc_filterGain->GetValue(frame, c);
x10_tangentialVelocity->GetValue(frame, d);

// CVector3f cross = ;
pVel = c * (
pVel = (
b * CVector3f::Dot(b, pVel) +
d * CVector3f::Cross(b, posToHelix)
) + (1.f - c) * pVel;
) * c + (1.f - c) * pVel;
return false;
}

Expand Down

0 comments on commit 539b269

Please sign in to comment.