Skip to content

Commit

Permalink
Fix accelerate to infinity bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lhog committed Dec 11, 2024
1 parent 2b9197d commit 2b0bdca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
5 changes: 5 additions & 0 deletions rts/System/Transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ void Transform::FromMatrix(const CMatrix44f& mat)
CMatrix44f Transform::ToMatrix() const
{
// TODO check the sequence
#if 0
CMatrix44f m = r.ToRotMatrix();
m.Translate(t);
m.Scale(s);
#else
CMatrix44f m; m.FromTQS(t, r, s);
return m;
#endif
#ifdef _DEBUG
//auto [t_, r_, s_] = CQuaternion::DecomposeIntoTRS(m);

Expand Down
15 changes: 0 additions & 15 deletions rts/System/float4.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ struct float4 : public float3
constexpr float4(const float* f): float3(f[0], f[1], f[2]), w(f[3]) {}
constexpr float4(const float x, const float y, const float z, const float w = 0.0f): float3(x, y, z), w(w) {}

constexpr float4 operator-() const { return float4(-x, -y, -z, -w); }

float4 operator * (const float4& f) const { return {x * f.x, y * f.y, z * f.z, w * f.w}; }
float4 operator + (const float4& f) const { return {x + f.x, y + f.y, z + f.z, w + f.w}; }
float4 operator - (const float4& f) const { return {x - f.x, y - f.y, z - f.z, w - f.w}; }
Expand Down Expand Up @@ -105,16 +103,6 @@ struct float4 : public float3
return (x * f.x) + (y * f.y) + (z * f.z) + (w * f.w);
}

float SqLength() const {
return float3::SqLength() + w * w;
}

float Length() const {
return math::sqrt(SqLength());
}

bool Normalized() const { return math::fabs(1.0f - dot4(*this)) <= cmp_eps(); }

std::string str() const {
return std::format("float4({:.3f}, {:.3f}, {:.3f}, {:.3f})", x, y, z, w);
}
Expand All @@ -124,8 +112,5 @@ struct float4 : public float3
operator const float* () const { return reinterpret_cast<const float*>(&x); }
operator float* () { return reinterpret_cast< float*>(&x); }
};
inline float4 operator*(float f, const float4& v) {
return v * f;
}

#endif /* FLOAT4_H */

0 comments on commit 2b0bdca

Please sign in to comment.