OpenBarnyard
 
Loading...
Searching...
No Matches
ACamera.cpp
Go to the documentation of this file.
1#include "pch.h"
2#include "ACamera.h"
3
4//-----------------------------------------------------------------------------
5// Enables memory debugging.
6// Note: Should be the last include!
7//-----------------------------------------------------------------------------
9
11
13
14TFLOAT ACamera::sm_fCurrentFOV = Toshi::TMath::DegToRad( 60.0f );
15const Toshi::TVector4 ACamera::sm_vWorldUp = { 0.0f, -1.0f, 0.0f, 1.0f };
16const Toshi::TVector4 ACamera::sm_vInitialLookDirection = { 0.0f, 0.0f, 1.0f, 1.0f };
17
19{
20 m_Matrix = TMatrix44::IDENTITY;
21 m_fFOV = sm_fCurrentFOV;
22 m_fProjectionCentreX = 0.5f;
23 m_fProjectionCentreY = 0.5f;
24}
25
29
30// $Barnyard: FUNCTION 00420490
32{
33 TVector4 vOrientation = m_Matrix.AsBasisVector4( Toshi::BASISVECTOR_FORWARD );
34 vOrientation.w = 1.0f;
35
36 return vOrientation;
37}
38
39void ACamera::LookAtPoint( const Toshi::TVector4& a_rPoint )
40{
41 TVector4 vDirection = a_rPoint - m_Matrix.GetTranslation3();
42 vDirection.Normalise();
43
44 LookAtDirection( vDirection );
45}
46
47void ACamera::LookAtDirection( const Toshi::TVector4& a_rDirection )
48{
49 TASSERT( a_rDirection.isNormalised() );
50 m_Matrix.LookAtDirection( a_rDirection, sm_vWorldUp );
51}
52
53const Toshi::TMatrix44& ACamera::GetMatrix() const
54{
55 return m_Matrix;
56}
57
58Toshi::TMatrix44& ACamera::GetMatrix()
59{
60 return m_Matrix;
61}
#define TASSERT(X,...)
Definition Defines.h:138
#define TOSHI_NAMESPACE_USING
Definition Defines.h:46
#define TDEFINE_CLASS(...)
Definition TObject.h:120
float TFLOAT
Definition Typedefs.h:4
static constinit TMatrix44 IDENTITY
Definition TMatrix44.h:357
TFLOAT w
Definition TVector4.h:367
void Normalise()
Definition TVector4.cpp:36
ACamera()
Definition ACamera.cpp:18
static const Toshi::TVector4 sm_vInitialLookDirection
Definition ACamera.h:16
static const Toshi::TVector4 sm_vWorldUp
Definition ACamera.h:15
static TFLOAT sm_fCurrentFOV
Definition ACamera.h:9
void LookAtDirection(const Toshi::TVector4 &a_rDirection)
Definition ACamera.cpp:47
Toshi::TVector4 GetOrientation() const
Definition ACamera.cpp:31
~ACamera()
Definition ACamera.cpp:26
Toshi::TMatrix44 & GetMatrix()
Definition ACamera.cpp:58
void LookAtPoint(const Toshi::TVector4 &a_rPoint)
Definition ACamera.cpp:39