Nebula
Loading...
Searching...
No Matches
freecamerautil.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
11#include "math/mat4.h"
12#include "math/vec2.h"
13#include "math/polar.h"
14
15//------------------------------------------------------------------------------
16namespace RenderUtil
17{
19{
20public:
23
27 void Reset();
29 void Update(float deltaTime);
31 const Math::mat4& GetTransform() const;
32
35
37 void SetRotateButton(bool state);
39 void SetAccelerateButton(bool state);
41 void SetMouseMovement(Math::vec2 movement);
43 void SetRotationSpeed(float speed);
45 void SetMovementSpeed(float speed);
46
48 void SetForwardsKey(bool state);
50 void SetBackwardsKey(bool state);
52 void SetLeftStrafeKey(bool state);
54 void SetRightStrafeKey(bool state);
56 void SetUpKey(bool state);
58 void SetDownKey(bool state);
59
60private:
64
69
71 float moveSpeed;
72
75
80 bool upKey;
81 bool downKey;
82};
83
84
85//------------------------------------------------------------------------------
88inline const Math::mat4&
90{
91 return this->cameraTransform;
92}
93
94//------------------------------------------------------------------------------
97inline void
102
103//------------------------------------------------------------------------------
106inline void
111
112//------------------------------------------------------------------------------
115inline void
120
121//------------------------------------------------------------------------------
124inline void
126{
127 this->mouseMovement = movement;
128}
129
130//------------------------------------------------------------------------------
133inline void
135{
136 this->rotationSpeed = speed;
137}
138
139//------------------------------------------------------------------------------
142inline void
144{
145 this->moveSpeed = speed;
146}
147
148//------------------------------------------------------------------------------
151inline void
156
157//------------------------------------------------------------------------------
160inline void
165
166//------------------------------------------------------------------------------
169inline void
174
175//------------------------------------------------------------------------------
178inline void
183
184//------------------------------------------------------------------------------
187inline void
189{
190 this->upKey = state;
191}
192
193//------------------------------------------------------------------------------
196inline void
198{
199 this->downKey = state;
200}
201
202} // namespace RenderUtil
203//------------------------------------------------------------------------------
A polar coordinate inline class, consisting of 2 angles theta (latitude) and rho (longitude).
Definition polar.h:28
Implements a free camera.
Definition freecamerautil.h:19
bool upKey
Definition freecamerautil.h:80
bool forwardsKey
Definition freecamerautil.h:76
void SetUpKey(bool state)
sets the up movement key
Definition freecamerautil.h:188
Math::point targetPosition
Definition freecamerautil.h:67
bool downKey
Definition freecamerautil.h:81
void SetRightStrafeKey(bool state)
sets the right strafe key
Definition freecamerautil.h:179
Math::polar viewAngles
Definition freecamerautil.h:65
FreeCameraUtil()
constructor
Definition freecamerautil.cc:14
void SetForwardsKey(bool state)
sets the forward movement key
Definition freecamerautil.h:152
float moveSpeed
Definition freecamerautil.h:71
void SetRotationSpeed(float speed)
sets the rotation speed
Definition freecamerautil.h:134
bool rotateButton
Definition freecamerautil.h:73
void SetRotateButton(bool state)
sets the state of the rotate button
Definition freecamerautil.h:107
Math::mat4 cameraTransform
Definition freecamerautil.h:68
Math::point position
Definition freecamerautil.h:66
void SetTargetPosition(Math::vec3 const &point)
sets the target position of the camera
Definition freecamerautil.h:98
bool accelerateButton
Definition freecamerautil.h:74
bool rightStrafeKey
Definition freecamerautil.h:79
void SetDownKey(bool state)
sets the down movement key
Definition freecamerautil.h:197
bool backwardsKey
Definition freecamerautil.h:77
Math::point defaultEyePos
Definition freecamerautil.h:61
void Setup(const Math::point &defaultEyePos, const Math::vector &defaultEyeVec)
sets up free camera
Definition freecamerautil.cc:37
float rotationSpeed
Definition freecamerautil.h:70
void SetAccelerateButton(bool state)
sets the state of the accelerate button
Definition freecamerautil.h:116
void SetLeftStrafeKey(bool state)
sets the left strafe key
Definition freecamerautil.h:170
Math::vec2 mouseMovement
Definition freecamerautil.h:63
Math::vector defaultEyeVec
Definition freecamerautil.h:62
void SetMouseMovement(Math::vec2 movement)
sets the mouse movement
Definition freecamerautil.h:125
bool leftStrafeKey
Definition freecamerautil.h:78
void SetMovementSpeed(float speed)
sets the movement speed
Definition freecamerautil.h:143
void Reset()
resets free camera to default values
Definition freecamerautil.cc:51
const Math::mat4 & GetTransform() const
gets camera transform
Definition freecamerautil.h:89
void SetBackwardsKey(bool state)
sets the backward movement key
Definition freecamerautil.h:161
Helpers to create geometry.
Definition drawfullscreenquad.cc:10
@ Update
Definition resourceloader.h:53
Vulkan::GraphicsDeviceState state
A 4x4 single point precision float matrix.
Definition mat4.h:49
Represents a 3D point in space.
Definition point.h:22
A 2-component float vector class.
Definition vec2.h:21
A 3D vector.
Definition vec3.h:40
A vector is a 3D direction in space.
Definition vector.h:22