Skip to content
Snippets Groups Projects
Verified Commit 6f3bdf7b authored by Josch Morgenstern's avatar Josch Morgenstern
Browse files

[#54] Add handling of NONE controller

parent ac9d3514
No related branches found
No related tags found
1 merge request!53Resolve "Kamera - Kamerafahrt mit Interpolation"
......@@ -110,6 +110,15 @@ namespace vkcv::camera {
*/
CameraController& getActiveController();
/**
* @brief Returns 'true' if the camera has a controller.
*
* @param cameraIndex
* @return true
* @return false
*/
bool CameraManager::cameraHasController(uint32_t cameraIndex);
public:
/**
......@@ -184,7 +193,7 @@ namespace vkcv::camera {
* @throws std::runtime_error If @p cameraIndex is not a valid camera index.
*/
ControllerType getControllerType(uint32_t cameraIndex);
/**
* @brief Updates all stored camera controllers in respect to @p deltaTime.
* @param[in] deltaTime The time that has passed since last update.
......
......@@ -184,9 +184,13 @@ namespace vkcv::camera {
}
}
bool CameraManager::cameraHasController(uint32_t cameraIndex) {
return (m_cameraControllerTypes[cameraIndex] != ControllerType::NONE);
}
void CameraManager::update(double deltaTime) {
m_frameTime = deltaTime;
if (glfwGetWindowAttrib(m_window.getWindow(), GLFW_FOCUSED) == GLFW_TRUE) {
if ((glfwGetWindowAttrib(m_window.getWindow(), GLFW_FOCUSED) == GLFW_TRUE) && cameraHasController(getActiveCameraIndex())) {
getActiveController().updateCamera(deltaTime, getActiveCamera());
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment