Fix animation update

Fixes #1022
This commit is contained in:
Sascha Willems 2023-04-07 12:58:11 +02:00
parent 0ab683e827
commit aa3c00a784

View file

@ -731,18 +731,13 @@ public:
updateUniformBuffers(); updateUniformBuffers();
} }
void updateUniformBuffers(bool viewchanged = true) void updateUniformBuffers()
{
if (viewchanged)
{ {
uboVS.projection = camera.matrices.perspective; uboVS.projection = camera.matrices.perspective;
uboVS.modelView = camera.matrices.view; uboVS.modelView = camera.matrices.view;
uboVS.viewPos = camera.viewPos; uboVS.viewPos = camera.viewPos;
}
else
{
uboVS.depth += frameTimer * 0.15f; uboVS.depth += frameTimer * 0.15f;
if (uboVS.depth > 1.0f) if (uboVS.depth > 1.0f) {
uboVS.depth = uboVS.depth - 1.0f; uboVS.depth = uboVS.depth - 1.0f;
} }
memcpy(uniformBufferVS.mapped, &uboVS, sizeof(uboVS)); memcpy(uniformBufferVS.mapped, &uboVS, sizeof(uboVS));
@ -768,13 +763,9 @@ public:
if (!prepared) if (!prepared)
return; return;
draw(); draw();
if (!paused || camera.updated) if (!paused) {
updateUniformBuffers(camera.updated); updateUniformBuffers();
} }
virtual void viewChanged()
{
updateUniformBuffers(true);
} }
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay) virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)