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