From 2b0bdca1a100efbcf3ab70b1cf23b650019592c5 Mon Sep 17 00:00:00 2001 From: LHoG <1476261+lhog@users.noreply.github.com> Date: Wed, 11 Dec 2024 01:20:39 +0100 Subject: [PATCH] Fix accelerate to infinity bug --- rts/System/Transform.cpp | 5 +++++ rts/System/float4.h | 15 --------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/rts/System/Transform.cpp b/rts/System/Transform.cpp index 7aa7d6d868..8452ca6c52 100644 --- a/rts/System/Transform.cpp +++ b/rts/System/Transform.cpp @@ -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); diff --git a/rts/System/float4.h b/rts/System/float4.h index cf54d9ac32..9df4e4c659 100644 --- a/rts/System/float4.h +++ b/rts/System/float4.h @@ -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}; } @@ -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); } @@ -124,8 +112,5 @@ struct float4 : public float3 operator const float* () const { return reinterpret_cast(&x); } operator float* () { return reinterpret_cast< float*>(&x); } }; -inline float4 operator*(float f, const float4& v) { - return v * f; -} #endif /* FLOAT4_H */