6#include "HAL/UnrealMemory.h"
7#include "Math/UnrealMathUtility.h"
9#include "Math/Vector2D.h"
10#include "Containers/EnumAsByte.h"
11#include "Math/Vector.h"
13#include "Math/TwoVectors.h"
21
34
43
44
45
46
47
48
49
72
73
77
78
79
80
81
82
86
87
88
89
90
91
92
93
97
98
99
100
111
112
113
114
115
116
117
127
128
139
140
149
156 FMemory::Memset( &ArriveTangent, 0,
sizeof(T) );
157 FMemory::Memset( &LeaveTangent, 0,
sizeof(T) );
159 InterpMode = CIM_Linear;
167 , ArriveTangent(InArriveTangent)
168 , LeaveTangent(InLeaveTangent)
169 , InterpMode(InInterpMode)
176 FMemory::Memset(&OutVal, 0,
sizeof(T));
177 FMemory::Memset(&ArriveTangent, 0,
sizeof(T));
178 FMemory::Memset(&LeaveTangent, 0,
sizeof(T));
179 InterpMode = CIM_Linear;
185 return ((InterpMode == CIM_CurveAuto) || (InterpMode == CIM_CurveAutoClamped) || (InterpMode == CIM_CurveUser) || (InterpMode == CIM_CurveBreak));
189
190
191float ClampFloatTangent(
float PrevPointVal,
float PrevTime,
float CurPointVal,
float CurTime,
float NextPointVal,
float NextTime );
195template<
class T,
class U >
196inline void AutoCalcTangent(
const T& PrevP,
const T& P,
const T& NextP,
const U& Tension, T& OutTan )
198 OutTan = (1.f - Tension) * ( (P - PrevP) + (NextP - P) );
203
204
206inline void AutoCalcTangent(
const FQuat& PrevP,
const FQuat& P,
const FQuat& NextP,
const U& Tension, FQuat& OutTan )
208 FQuat::CalcTangents(PrevP, P, NextP, Tension, OutTan);
215 float CurTime,
const T& CurPoint,
216 float NextTime,
const T& NextPoint,
223 AutoCalcTangent( PrevPoint, CurPoint, NextPoint, Tension, OutTangent );
227 OutTangent /= PrevToNextTimeDiff;
232
233
234
237 float CurTime,
const T& CurPoint,
238 float NextTime,
const T& NextPoint,
247 float* PrevPointVal = (
float* )&PrevPoint;
248 float* CurPointVal = (
float* )&CurPoint;
249 float* NextPointVal = (
float* )&NextPoint;
250 float* OutTangentVal = (
float* )&OutTangent;
251 for( int32 CurValPos = 0; CurValPos <
sizeof( T ); CurValPos +=
sizeof(
float ) )
254 const float ClampedTangent =
256 *PrevPointVal, PrevTime,
257 *CurPointVal, CurTime,
258 *NextPointVal, NextTime );
261 *OutTangentVal = ( 1.0f - Tension ) * ClampedTangent;
274 AutoCalcTangent( PrevPoint, CurPoint, NextPoint, Tension, OutTangent );
278 OutTangent /= PrevToNextTimeDiff;
285 float CurTime,
const float& CurPoint,
286 float NextTime,
const float& NextPoint,
291 ComputeClampableFloatVectorCurveTangent(
295 Tension, bWantClamping, OutTangent );
301 float CurTime,
const FVector& CurPoint,
302 float NextTime,
const FVector& NextPoint,
305 FVector& OutTangent )
307 ComputeClampableFloatVectorCurveTangent(
311 Tension, bWantClamping, OutTangent );
317 float CurTime,
const FVector2D& CurPoint,
318 float NextTime,
const FVector2D& NextPoint,
321 FVector2D& OutTangent )
323 ComputeClampableFloatVectorCurveTangent(
327 Tension, bWantClamping, OutTangent );
333 float CurTime,
const FTwoVectors& CurPoint,
334 float NextTime,
const FTwoVectors& NextPoint,
337 FTwoVectors& OutTangent )
339 ComputeClampableFloatVectorCurveTangent(
343 Tension, bWantClamping, OutTangent );
347
348
349
350
351
352
353
358
359
360
361
362
363
364
369
370
371
372
373
374
375
380
381
382
383
384
385
386
391
392
393
394
395
396
397
401template<
class T,
class U >
409 CurveFloatFindIntervalBounds(Start, End, CurrentMin, CurrentMax);
416 CurveVector2DFindIntervalBounds(Start, End, CurrentMin, CurrentMax);
423 CurveVectorFindIntervalBounds(Start, End, CurrentMin, CurrentMax);
430 CurveTwoVectorsFindIntervalBounds(Start, End, CurrentMin, CurrentMax);
437 CurveLinearColorFindIntervalBounds(Start, End, CurrentMin, CurrentMax);
void CurveFindIntervalBounds(const FInterpCurvePoint< FTwoVectors > &Start, const FInterpCurvePoint< FTwoVectors > &End, FTwoVectors &CurrentMin, FTwoVectors &CurrentMax, const U &Dummy)
void ComputeClampableFloatVectorCurveTangent(float PrevTime, const T &PrevPoint, float CurTime, const T &CurPoint, float NextTime, const T &NextPoint, float Tension, bool bWantClamping, T &OutTangent)
void CurveFindIntervalBounds(const FInterpCurvePoint< FVector > &Start, const FInterpCurvePoint< FVector > &End, FVector &CurrentMin, FVector &CurrentMax, const U &Dummy)
void ComputeCurveTangent(float PrevTime, const T &PrevPoint, float CurTime, const T &CurPoint, float NextTime, const T &NextPoint, float Tension, bool bWantClamping, T &OutTangent)
void CurveFindIntervalBounds(const FInterpCurvePoint< FVector2D > &Start, const FInterpCurvePoint< FVector2D > &End, FVector2D &CurrentMin, FVector2D &CurrentMax, const U &Dummy)
FInterpCurvePoint< float > FInterpCurvePointFloat
void CurveFindIntervalBounds(const FInterpCurvePoint< float > &Start, const FInterpCurvePoint< float > &End, float &CurrentMin, float &CurrentMax, const U &Dummy)
void ComputeCurveTangent(float PrevTime, const FVector &PrevPoint, float CurTime, const FVector &CurPoint, float NextTime, const FVector &NextPoint, float Tension, bool bWantClamping, FVector &OutTangent)
void CurveTwoVectorsFindIntervalBounds(const FInterpCurvePoint< FTwoVectors > &Start, const FInterpCurvePoint< FTwoVectors > &End, FTwoVectors &CurrentMin, FTwoVectors &CurrentMax)
void ComputeCurveTangent(float PrevTime, const FVector2D &PrevPoint, float CurTime, const FVector2D &CurPoint, float NextTime, const FVector2D &NextPoint, float Tension, bool bWantClamping, FVector2D &OutTangent)
void AutoCalcTangent(const T &PrevP, const T &P, const T &NextP, const U &Tension, T &OutTan)
float ClampFloatTangent(float PrevPointVal, float PrevTime, float CurPointVal, float CurTime, float NextPointVal, float NextTime)
void CurveVector2DFindIntervalBounds(const FInterpCurvePoint< FVector2D > &Start, const FInterpCurvePoint< FVector2D > &End, FVector2D &CurrentMin, FVector2D &CurrentMax)
FInterpCurvePoint< FVector2D > FInterpCurvePointVector2D
void AutoCalcTangent(const FQuat &PrevP, const FQuat &P, const FQuat &NextP, const U &Tension, FQuat &OutTan)
FInterpCurvePoint< FTwoVectors > FInterpCurvePointTwoVectors
FInterpCurvePoint< FQuat > FInterpCurvePointQuat
void CurveLinearColorFindIntervalBounds(const FInterpCurvePoint< FLinearColor > &Start, const FInterpCurvePoint< FLinearColor > &End, FLinearColor &CurrentMin, FLinearColor &CurrentMax)
void CurveFindIntervalBounds(const FInterpCurvePoint< FLinearColor > &Start, const FInterpCurvePoint< FLinearColor > &End, FLinearColor &CurrentMin, FLinearColor &CurrentMax, const U &Dummy)
void CurveFindIntervalBounds(const FInterpCurvePoint< T > &Start, const FInterpCurvePoint< T > &End, T &CurrentMin, T &CurrentMax, const U &Dummy)
void ComputeCurveTangent(float PrevTime, const float &PrevPoint, float CurTime, const float &CurPoint, float NextTime, const float &NextPoint, float Tension, bool bWantClamping, float &OutTangent)
FInterpCurvePoint< FLinearColor > FInterpCurvePointLinearColor
FInterpCurvePoint< FVector > FInterpCurvePointVector
void CurveFloatFindIntervalBounds(const FInterpCurvePoint< float > &Start, const FInterpCurvePoint< float > &End, float &CurrentMin, float &CurrentMax)
void ComputeCurveTangent(float PrevTime, const FTwoVectors &PrevPoint, float CurTime, const FTwoVectors &CurPoint, float NextTime, const FTwoVectors &NextPoint, float Tension, bool bWantClamping, FTwoVectors &OutTangent)
void CurveVectorFindIntervalBounds(const FInterpCurvePoint< FVector > &Start, const FInterpCurvePoint< FVector > &End, FVector &CurrentMin, FVector &CurrentMax)
#define UE_KINDA_SMALL_NUMBER
FInterpCurvePoint(const float In, const T &Out, const T &InArriveTangent, const T &InLeaveTangent, const EInterpCurveMode InInterpMode)
friend bool operator==(const FInterpCurvePoint &Point1, const FInterpCurvePoint &Point2)
FORCEINLINE bool IsCurveKey() const
FInterpCurvePoint(const float In, const T &Out)
TEnumAsByte< EInterpCurveMode > InterpMode
FORCEINLINE FInterpCurvePoint(EForceInit)
friend bool operator!=(const FInterpCurvePoint &Point1, const FInterpCurvePoint &Point2)