Public updated property for camera class

This commit is contained in:
saschawillems 2018-04-08 12:27:45 +02:00
parent 2d3babb45a
commit f5ba1e8939
2 changed files with 6 additions and 1 deletions

View file

@ -37,6 +37,8 @@ private:
{ {
matrices.view = transM * rotM; matrices.view = transM * rotM;
} }
updated = true;
}; };
public: public:
enum CameraType { lookat, firstperson }; enum CameraType { lookat, firstperson };
@ -48,6 +50,8 @@ public:
float rotationSpeed = 1.0f; float rotationSpeed = 1.0f;
float movementSpeed = 1.0f; float movementSpeed = 1.0f;
bool updated = false;
struct struct
{ {
glm::mat4 perspective; glm::mat4 perspective;
@ -120,6 +124,7 @@ public:
void update(float deltaTime) void update(float deltaTime)
{ {
updated = false;
if (type == CameraType::firstperson) if (type == CameraType::firstperson)
{ {
if (moving()) if (moving())

View file

@ -59,7 +59,7 @@ private:
float fpsTimer = 0.0f; float fpsTimer = 0.0f;
// Get window title with example name, device, et. // Get window title with example name, device, et.
std::string getWindowTitle(); std::string getWindowTitle();
/** brief Indicates that the view (position, rotation) has changed and */ /** brief Indicates that the view (position, rotation) has changed and buffers containing camera matrices need to be updated */
bool viewUpdated = false; bool viewUpdated = false;
// Destination dimensions for resizing the window // Destination dimensions for resizing the window
uint32_t destWidth; uint32_t destWidth;