OpenBarnyard
 
Loading...
Searching...
No Matches
AGUI2Transform.h
Go to the documentation of this file.
1#pragma once
2#include <Math/TVector2.h>
3
5{
6public:
11
12public:
13 // constructors/destructor
14 constexpr AGUI2Transform()
15 {
17 }
18
20
21 ~AGUI2Transform() = default;
22
23 void Rotate( TFLOAT a_fAngle );
24 void PreMultiply( const AGUI2Transform& a_rTransform );
25 void Scale( TFLOAT a_fScaleX, TFLOAT a_fScaleY );
26 void Transform( Toshi::TVector2& a_rOutVec, const Toshi::TVector2& a_rTransformVec ) const;
27 void GetInverse( AGUI2Transform& a_rInverse ) const;
28
29 // Sets scale preserving translation
30 void SetScale( TFLOAT a_fScaleX, TFLOAT a_fScaleY );
31
32 // Sets scale and resets translation
33 void SetFromScale( TFLOAT a_fScaleX, TFLOAT a_fScaleY );
34
35 constexpr void Set( const Toshi::TVector2& a_rcMatComp1, const Toshi::TVector2& a_rcMatComp2, const Toshi::TVector2& a_rcTranslation )
36 {
37 m_aMatrixRows[ 0 ] = a_rcMatComp1;
38 m_aMatrixRows[ 1 ] = a_rcMatComp2;
39 m_vecTranslation = a_rcTranslation;
40 }
41
42 constexpr void SetIdentity()
43 {
44 m_aMatrixRows[ 0 ] = Toshi::TVector2( 1.0f, 0.0f );
45 m_aMatrixRows[ 1 ] = Toshi::TVector2( 0.0f, 1.0f );
46 m_vecTranslation = Toshi::TVector2::VEC_ZERO;
47 }
48
49 constexpr void SetZero()
50 {
51 m_aMatrixRows[ 0 ] = Toshi::TVector2::VEC_ZERO;
52 m_aMatrixRows[ 1 ] = Toshi::TVector2::VEC_ZERO;
53 m_vecTranslation = Toshi::TVector2::VEC_ZERO;
54 }
55
56 constexpr void SetTranslation( TFLOAT a_fX, TFLOAT a_fY )
57 {
58 m_vecTranslation.x = a_fX;
59 m_vecTranslation.y = a_fY;
60 }
61
62 constexpr void SetTranslation( const Toshi::TVector2& a_rcTranslation )
63 {
64 m_vecTranslation = a_rcTranslation;
65 }
66
67 constexpr const Toshi::TVector2& GetTranslation() const { return m_vecTranslation; }
68
69public:
70 static void Multiply( AGUI2Transform& a_rOutTransform, const AGUI2Transform& a_rA, const AGUI2Transform& a_rB );
71
72public:
73 Toshi::TVector2 m_aMatrixRows[ 2 ];
74 Toshi::TVector2 m_vecTranslation;
75};
float TFLOAT
Definition Typedefs.h:4
constexpr const Toshi::TVector2 & GetTranslation() const
void PreMultiply(const AGUI2Transform &a_rTransform)
void Transform(Toshi::TVector2 &a_rOutVec, const Toshi::TVector2 &a_rTransformVec) const
constexpr AGUI2Transform(TUninitialised)
void Rotate(TFLOAT a_fAngle)
Toshi::TVector2 m_vecTranslation
Toshi::TVector2 m_aMatrixRows[2]
void SetFromScale(TFLOAT a_fScaleX, TFLOAT a_fScaleY)
constexpr void Set(const Toshi::TVector2 &a_rcMatComp1, const Toshi::TVector2 &a_rcMatComp2, const Toshi::TVector2 &a_rcTranslation)
static void Multiply(AGUI2Transform &a_rOutTransform, const AGUI2Transform &a_rA, const AGUI2Transform &a_rB)
constexpr void SetTranslation(TFLOAT a_fX, TFLOAT a_fY)
constexpr void SetTranslation(const Toshi::TVector2 &a_rcTranslation)
constexpr AGUI2Transform()
constexpr void SetIdentity()
void SetScale(TFLOAT a_fScaleX, TFLOAT a_fScaleY)
void Scale(TFLOAT a_fScaleX, TFLOAT a_fScaleY)
void GetInverse(AGUI2Transform &a_rInverse) const
~AGUI2Transform()=default
constexpr void SetZero()