1template<
typename T, glm::precision P>
2FPSCamera<T, P>::FPSCamera(T fovy, T aspect, T nnear, T nfar) :
mWorld(),
mMovementSpeed(1),
mMouseSensitivity(1),
mFov(fovy),
mAspect(aspect),
mNear(nnear),
mFar(nfar),
mProjection(),
mProjectionInverse(),
mMousePosition(glm::tvec2<T, P>(0.0f))
7template<
typename T, glm::precision P>
12template<
typename T, glm::precision P>
19 mProjection = glm::perspective(fovy, aspect, nnear, nfar);
23template<
typename T, glm::precision P>
29template<
typename T, glm::precision P>
35template<
typename T, glm::precision P>
41template<
typename T, glm::precision P>
48template<
typename T, glm::precision P>
56 mouse_diff.y = -mouse_diff.y;
59 mWorld.PreRotateX(mouse_diff.y);
60 mWorld.RotateY(-mouse_diff.x);
64 T move = 0.0f, strafe = 0.0f, levitate = 0.0f;
73 auto const deltaTime_s = std::chrono::duration<T>(deltaTime);
74 auto const movementChange = movementModifier * (
mWorld.GetFront() * move +
mWorld.GetRight() * strafe +
mWorld.GetUp() * levitate);
77 mWorld.Translate(movementSpeed * deltaTime_s.count());
81template<
typename T, glm::precision P>
87template<
typename T, glm::precision P>
90 return mWorld.GetMatrixInverse();
93template<
typename T, glm::precision P>
99template<
typename T, glm::precision P>
105template<
typename T, glm::precision P>
111template<
typename T, glm::precision P>
117template<
typename T, glm::precision P>
120 glm::tvec4<T, P> vv = glm::tvec4<T, P>(
GetClipToView(xyw),
static_cast<T
>(1));
121 glm::tvec3<T, P> wv =
mWorld.GetMatrix() * vv;
125template<
typename T, glm::precision P>
void Update(std::chrono::microseconds deltaTime, InputHandler &ih, bool ignoreKeyEvents=false, bool ignoreMouseEvents=false)
Definition FPSCamera.inl:49
glm::tmat4x4< T, P > GetClipToViewMatrix()
Definition FPSCamera.inl:106
glm::tvec2< T, P > mMouseSensitivity
Definition FPSCamera.h:41
glm::tmat4x4< T, P > GetWorldToViewMatrix()
Definition FPSCamera.inl:88
T GetAspect()
Definition FPSCamera.inl:42
~FPSCamera()
Definition FPSCamera.inl:8
glm::tmat4x4< T, P > GetViewToClipMatrix()
Definition FPSCamera.inl:112
glm::tmat4x4< T, P > GetViewToWorldMatrix()
Definition FPSCamera.inl:82
TRSTransform< T, P > mWorld
Definition FPSCamera.h:39
glm::tvec3< T, P > mMovementSpeed
Definition FPSCamera.h:40
void SetProjection(T fovy, T aspect, T nnear, T nfar)
Definition FPSCamera.inl:13
T mNear
Definition FPSCamera.h:44
glm::tmat4x4< T, P > mProjectionInverse
Definition FPSCamera.h:46
T mFov
Definition FPSCamera.h:44
T GetFov()
Definition FPSCamera.inl:30
glm::tmat4x4< T, P > GetWorldToClipMatrix()
Definition FPSCamera.inl:100
glm::tvec3< T, P > GetClipToWorld(glm::tvec3< T, P > xyw)
Definition FPSCamera.inl:118
void SetAspect(T a)
Definition FPSCamera.inl:36
glm::tmat4x4< T, P > GetClipToWorldMatrix()
Definition FPSCamera.inl:94
glm::tvec2< T, P > mMousePosition
Definition FPSCamera.h:47
FPSCamera(T fovy, T aspect, T nnear, T nfar)
Definition FPSCamera.inl:2
void SetFov(T fovy)
Definition FPSCamera.inl:24
T mAspect
Definition FPSCamera.h:44
glm::tmat4x4< T, P > mProjection
Definition FPSCamera.h:45
T mFar
Definition FPSCamera.h:44
glm::tvec3< T, P > GetClipToView(glm::tvec3< T, P > xyw)
Definition FPSCamera.inl:126