mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 10:52:22 +01:00
it kinda work
This commit is contained in:
64
Project Reboot 3.0/GenericPlatformMath.h
Normal file
64
Project Reboot 3.0/GenericPlatformMath.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
|
||||
#include "inc.h"
|
||||
|
||||
class FPlatformMath
|
||||
{
|
||||
public:
|
||||
static constexpr FORCEINLINE int32 TruncToInt(float F)
|
||||
{
|
||||
return (int32)F;
|
||||
}
|
||||
|
||||
static constexpr FORCEINLINE float TruncToFloat(float F)
|
||||
{
|
||||
return (float)TruncToInt(F);
|
||||
}
|
||||
|
||||
static FORCEINLINE int32 FloorToInt(float F)
|
||||
{
|
||||
return TruncToInt(floorf(F));
|
||||
}
|
||||
|
||||
template< class T, class U >
|
||||
static FORCEINLINE T Lerp(const T& A, const T& B, const U& Alpha)
|
||||
{
|
||||
return (T)(A + Alpha * (B - A));
|
||||
}
|
||||
|
||||
template< class T >
|
||||
static constexpr FORCEINLINE T Max(const T A, const T B)
|
||||
{
|
||||
return (A >= B) ? A : B;
|
||||
}
|
||||
|
||||
static FORCEINLINE float FloorToFloat(float F)
|
||||
{
|
||||
return floorf(F);
|
||||
}
|
||||
|
||||
static FORCEINLINE double FloorToDouble(double F)
|
||||
{
|
||||
return floor(F);
|
||||
}
|
||||
|
||||
static FORCEINLINE int32 RoundToInt(float F)
|
||||
{
|
||||
return FloorToInt(F + 0.5f);
|
||||
}
|
||||
|
||||
static FORCEINLINE float Fractional(float Value)
|
||||
{
|
||||
return Value - TruncToFloat(Value);
|
||||
}
|
||||
|
||||
static FORCEINLINE double TruncToDouble(double F)
|
||||
{
|
||||
return trunc(F);
|
||||
}
|
||||
|
||||
static FORCEINLINE double Fractional(double Value)
|
||||
{
|
||||
return Value - TruncToDouble(Value);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user