5#include "Misc/FrameNumber.h"
6#include "Misc/AssertionMacros.h"
7#include "Templates/EnableIf.h"
8#include "Containers/UnrealString.h"
11
12
13
14
21
22
26
27
32
33
37
38
42
43
49
50
57
58
65
66
70
71
75
76
80
81
82
86
87
88
139 LHS.FrameNumber = LHS.FrameNumber + RHS.FrameNumber + FFrameNumber(FMath::FloorToInt(NewSubFrame));
140 LHS.SubFrame = FMath::Frac(NewSubFrame);
149 const FFrameNumber NewFrameNumber = A.FrameNumber + B.FrameNumber + FFrameNumber(FMath::FloorToInt(NewSubFrame));
151 return FFrameTime(NewFrameNumber, FMath::Frac(NewSubFrame));
160 const float FlooredSubFrame = FMath::FloorToFloat(NewSubFrame);
161 LHS.FrameNumber = LHS.FrameNumber - RHS.FrameNumber + FFrameNumber(FMath::TruncToInt(FlooredSubFrame));
162 LHS
.SubFrame = NewSubFrame - FlooredSubFrame;
173 const float FlooredSubFrame = FMath::FloorToFloat(NewSubFrame);
174 const FFrameNumber NewFrameNumber = A.FrameNumber - B.FrameNumber + FFrameNumber(FMath::TruncToInt(FlooredSubFrame));
176 return FFrameTime(NewFrameNumber
, NewSubFrame - FlooredSubFrame
);
182 check(B.FrameNumber.Value != 0 || B.GetSubFrame() != 0.f);
230template<
typename T,
typename>
232 : FrameNumber(InFrameNumber), SubFrame(0.f)
247 checkSlow(InSubFrame >= 0.f && InSubFrame < 1.f);
283 int32 NewFrame =
static_cast<int32>(FMath::Clamp(FMath::FloorToDouble(InDecimalFrame), (
double)TNumericLimits<int32>::Min(), (
double)TNumericLimits<int32>::Max()));
286 double Fraction = InDecimalFrame - FMath::FloorToDouble(InDecimalFrame);
#define FORCEINLINE_DEBUGGABLE
FString LexToString(const FFrameTime InTime)
friend FFrameNumber operator-(FFrameNumber A)
friend bool operator<(FFrameNumber A, FFrameNumber B)
friend bool operator>(FFrameNumber A, FFrameNumber B)
friend bool operator==(FFrameNumber A, FFrameNumber B)
friend bool operator!=(FFrameNumber A, FFrameNumber B)
friend FFrameNumber operator%(FFrameNumber A, FFrameNumber B)
friend FORCEINLINE_DEBUGGABLE bool operator<=(FFrameTime A, FFrameTime B)
friend FORCEINLINE_DEBUGGABLE bool operator>=(FFrameTime A, FFrameTime B)
friend FORCEINLINE FFrameTime operator*(float Scalar, FFrameTime A)
friend FORCEINLINE_DEBUGGABLE FFrameTime operator%(FFrameTime A, FFrameTime B)
friend FORCEINLINE_DEBUGGABLE bool operator==(FFrameTime A, FFrameTime B)
FFrameTime(FFrameNumber InFrameNumber, float InSubFrame)
friend FORCEINLINE_DEBUGGABLE FFrameTime operator+(FFrameTime A, FFrameTime B)
friend FORCEINLINE_DEBUGGABLE bool operator!=(FFrameTime A, FFrameTime B)
friend FORCEINLINE FFrameTime operator*(FFrameTime A, float Scalar)
friend FORCEINLINE_DEBUGGABLE bool operator<(FFrameTime A, FFrameTime B)
friend FORCEINLINE_DEBUGGABLE FFrameTime & operator+=(FFrameTime &LHS, FFrameTime RHS)
friend FORCEINLINE_DEBUGGABLE bool operator>(FFrameTime A, FFrameTime B)
FFrameNumber RoundToFrame() const
FORCEINLINE FFrameNumber GetFrame() const
friend FORCEINLINE FFrameTime operator/(FFrameTime A, float Scalar)
FORCEINLINE float GetSubFrame() const
FFrameTime(FFrameNumber InFrameNumber)
friend FORCEINLINE_DEBUGGABLE FFrameTime & operator-=(FFrameTime &LHS, FFrameTime RHS)
FFrameTime & operator=(FFrameNumber InFrameNumber)
FFrameNumber CeilToFrame() const
FFrameNumber FloorToFrame() const
FFrameTime(T InFrameNumber)
friend FORCEINLINE_DEBUGGABLE FFrameTime operator-(FFrameTime A)
static const float MaxSubframe
static FFrameTime FromDecimal(double InDecimalFrame)
friend FORCEINLINE_DEBUGGABLE FFrameTime operator-(FFrameTime A, FFrameTime B)
static UE_NODISCARD constexpr FORCEINLINE float Clamp(const float X, const float Min, const float Max)