From aa3c00a784725a737cede2795b58d1ed4ec5de59 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Fri, 7 Apr 2023 12:58:11 +0200 Subject: [PATCH] Fix animation update Fixes #1022 --- examples/texture3d/texture3d.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/examples/texture3d/texture3d.cpp b/examples/texture3d/texture3d.cpp index c38c287c..47ca5df6 100644 --- a/examples/texture3d/texture3d.cpp +++ b/examples/texture3d/texture3d.cpp @@ -731,19 +731,14 @@ public: updateUniformBuffers(); } - void updateUniformBuffers(bool viewchanged = true) + void updateUniformBuffers() { - if (viewchanged) - { - 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) - uboVS.depth = uboVS.depth - 1.0f; + uboVS.projection = camera.matrices.perspective; + uboVS.modelView = camera.matrices.view; + uboVS.viewPos = camera.viewPos; + uboVS.depth += frameTimer * 0.15f; + 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); - } - - virtual void viewChanged() - { - updateUniformBuffers(true); + if (!paused) { + updateUniformBuffers(); + } } virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)