23 TFLOAT fCosRoll = cos( a_fRoll * 0.5f );
24 TFLOAT fSinRoll = sin( a_fRoll * 0.5f );
25 TFLOAT fCosPitch = cos( a_fPitch * 0.5f );
26 TFLOAT fSinPitch = sin( a_fPitch * 0.5f );
27 TFLOAT fCosYaw = cos( a_fYaw * 0.5f );
28 TFLOAT fSinYaw = sin( a_fYaw * 0.5f );
30 TFLOAT fX = fCosYaw * fCosPitch * fSinRoll - fSinYaw * fSinPitch * fCosRoll;
31 TFLOAT fY = fCosPitch * fSinRoll * fSinYaw + fSinPitch * fCosRoll * fCosYaw;
32 TFLOAT fZ = fCosRoll * fCosPitch * fSinYaw - fCosYaw * fSinPitch * fSinRoll;
33 TFLOAT fW = fSinYaw * fSinPitch * fSinRoll + fCosYaw * fCosPitch * fCosRoll;
35 Set( fX, fY, fZ, fW );
45 Set( a_rVec3.
x * fVal, a_rVec3.
y * fVal, a_rVec3.
z * fVal, fVal2 );
71 if ( dotProduct < 0.0f )
96 param_1.
Set( quat3.
x, quat3.
y, quat3.
z );
106 *
this *=
TQuaternion( param_1.
x * fVal, param_1.
y * fVal, param_1.
z * fVal, fVal2 );
120 TFLOAT fX = ( (
x * a_Quat.
w + a_Quat.
z *
y ) - a_Quat.
y *
z ) + a_Quat.
x *
w;
121 TFLOAT fY = a_Quat.
x *
z + (
y * a_Quat.
w - a_Quat.
z *
x ) + a_Quat.
y *
w;
122 TFLOAT fZ =
w * a_Quat.
z + ( a_Quat.
y *
x - a_Quat.
x *
y ) +
z * a_Quat.
w;
123 TFLOAT fW = ( -( a_Quat.
y *
y + a_Quat.
x *
x ) - a_Quat.
z *
z ) + a_Quat.
w *
w;
124 Set( fX, fY, fZ, fW );
140 a_rOut.
x = vec.
x + a_rStart.
x;
141 a_rOut.
y = vec.
y + a_rStart.
y;
142 a_rOut.
z = vec.
z + a_rStart.
z;
143 a_rOut.
w = vec.
w + a_rStart.
w;
153 a_rOut.
x = vec.
x - a_rStart.
x;
154 a_rOut.
y = vec.
y - a_rStart.
y;
155 a_rOut.
z = vec.
z - a_rStart.
z;
156 a_rOut.
w = vec.
w - a_rStart.
w;
165 if ( a_fProgress == 0.0f )
171 if ( a_fProgress == 1.0f )
178 TBOOL bNegativeDot = fDot < 0.0f;
183 TFLOAT fProg1 = a_fProgress;
186 if ( 1.0f - fDot <= 0.001f )
188 fProg2 = 1.0f - a_fProgress;
195 fProg1 =
TMath::Sin( fAcos * a_fProgress ) * ( 1.0f / fSin );
196 fProg2 =
TMath::Sin( ( 1.0f - a_fProgress ) * fAcos ) * ( 1.0f / fSin );
201 a_rOut.
x = a_rStart.
x * fProg2 - a_rEnd.
x * fProg1;
202 a_rOut.
y = a_rStart.
y * fProg2 - a_rEnd.
y * fProg1;
203 a_rOut.
z = a_rStart.
z * fProg2 - a_rEnd.
z * fProg1;
204 a_rOut.
w = a_rStart.
w * fProg2 - a_rEnd.
w * fProg1;
208 a_rOut.
x = a_rStart.
x * fProg2 + a_rEnd.
x * fProg1;
209 a_rOut.
y = a_rStart.
y * fProg2 + a_rEnd.
y * fProg1;
210 a_rOut.
z = a_rStart.
z * fProg2 + a_rEnd.
z * fProg1;
211 a_rOut.
w = a_rStart.
w * fProg2 + a_rEnd.
w * fProg1;
4x4 matrix implementation for the Toshi engine
Quaternion implementation for the Toshi engine.
#define TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_END
TFORCEINLINE void SinCos(TFLOAT fVal, TFLOAT &a_rSin, TFLOAT &a_rCos)
TFORCEINLINE TFLOAT Abs(TFLOAT fVal)
constexpr TFLOAT TFLOAT_EPSILON
TFORCEINLINE TFLOAT Sin(TFLOAT fVal)
TFORCEINLINE TFLOAT ACos(TFLOAT fVal)
void GetEulerXYZ(TVector3 &a_rOutVec) const
TMatrix44 & SetFromQuaternion(const TQuaternion &a_rQuaternion)
void GetEulerXYZ(TVector3 &outVec) const
void Set(TFLOAT a_fX, TFLOAT a_fY, TFLOAT a_fZ, TFLOAT a_fW)
static const TQuaternion IDENTITY
void SetVectorDirection(const TVector3 &a_rVec3, const TVector3 &a_rVec3_2)
void SetRotation(const TVector3 &a_rVec3, TFLOAT a_fVal)
static void RotateVector(TVector3 ¶m_1, const TQuaternion ¶m_2, const TVector3 param_3)
void RotateAroundAxis(const TVector3 ¶m_1, TFLOAT param_2)
static void Nlerp(TQuaternion &a_rOut, const TQuaternion &a_rStart, const TQuaternion &a_rEnd, float a_fProgress)
void SetFromEulerYX(const TFLOAT *fVal)
static void Slerp(TQuaternion &a_rOut, const TQuaternion &a_rStart, const TQuaternion &a_rEnd, float a_fProgress)
void SetFromEulerRollPitchYaw(TFLOAT a_fRoll, TFLOAT a_fPitch, TFLOAT a_fYaw)
TQuaternion & operator*=(const TQuaternion &a_rQuat)
const TVector4 & AsVector4() const
constexpr void Divide(const TVector3 &vec)
void CrossProduct(const TVector3 &, const TVector3 &)
void RotateX(TFLOAT a_fRotation)
constexpr void Set(const TVector3 &vec)
void RotateY(TFLOAT a_fRotation)
static constexpr TFLOAT DotProduct(const TVector3 &vec1, const TVector3 &vec2)
constexpr void Add4(const TVector4 &vec)
TFLOAT constexpr DotProduct4(const TVector4 &vec) const
constexpr void Substract4(const TVector4 &vec)
constexpr void Multiply4(const TVector4 &vec)