More lazy rendering stuff

This commit is contained in:
Georg Hagen
2024-07-01 21:54:35 +02:00
parent 142c683c7f
commit 9452d061b2
4 changed files with 35 additions and 17 deletions

View File

@@ -7,6 +7,7 @@
#include "MapCameraController.hpp"
#include "Input/InputManager.hpp"
#include "Scene/Camera.hpp"
#include "Base/FrameMetadata.hpp"
namespace OpenVulkano
{
@@ -22,7 +23,9 @@ namespace OpenVulkano
{
if (!GetCamera()) return;
auto input = Input::InputManager::GetInstance();
Math::Vector3f_SIMD vec = m_dirUp * input->GetAxis(m_actionUp) + m_dirSide * input->GetAxis(m_actionSide);
float up = input->GetAxis(m_actionUp);
float side = input->GetAxis(m_actionSide);
Math::Vector3f_SIMD vec = m_dirUp * up + m_dirSide * side;
vec /= GetCamera()->GetZoom();
vec /= GetCamera()->GetContentScaleFactor();
@@ -35,7 +38,11 @@ namespace OpenVulkano
GetCamera()->UpdateProjectionMatrix();
}
GetCamera()->SetMatrix(Math::Utils::translate(vec) * GetCamera()->GetMatrix());
if (zoom != 0 || up != 0 || side != 0)
{
GetCamera()->SetMatrix(Math::Utils::translate(vec) * GetCamera()->GetMatrix());
CURRENT_FRAME.needsRedraw = true;
}
}
void MapCameraController::SetDefaultKeybindings()