This commit is contained in:
nashmuhandes 2024-07-31 00:45:38 +08:00
commit a6fc168f0b
3 changed files with 43 additions and 0 deletions

View file

@ -1019,6 +1019,45 @@ struct TVector4
}
};
inline void ZeroSubnormalsF(double& num)
{
if (fabs(num) < FLT_MIN) num = 0;
}
inline void ZeroSubnormals(double& num)
{
if (fabs(num) < DBL_MIN) num = 0;
}
inline void ZeroSubnormals(float& num)
{
if (fabsf(num) < FLT_MIN) num = 0;
}
template<typename T>
inline void ZeroSubnormals(TVector2<T>& vec)
{
ZeroSubnormals(vec.X);
ZeroSubnormals(vec.Y);
}
template<typename T>
inline void ZeroSubnormals(TVector3<T>& vec)
{
ZeroSubnormals(vec.X);
ZeroSubnormals(vec.Y);
ZeroSubnormals(vec.Z);
}
template<typename T>
inline void ZeroSubnormals(TVector4<T>& vec)
{
ZeroSubnormals(vec.X);
ZeroSubnormals(vec.Y);
ZeroSubnormals(vec.Z);
ZeroSubnormals(vec.W);
}
template<class vec_t>
struct TMatrix3x3
{

View file

@ -924,6 +924,7 @@ class CommandDrawString : public SBarInfoCommand
break;
default:
str = GStrings.localize(label.GetChars());
RealignString();
break;
}
}

View file

@ -774,6 +774,9 @@ public:
void Set(DVector3 &off, int f = -1)
{
ZeroSubnormalsF(off.X);
ZeroSubnormalsF(off.Y);
ZeroSubnormalsF(off.Z);
Offset = off;
if (f > -1)