Index: source/graphics/LOSTexture.h =================================================================== --- source/graphics/LOSTexture.h +++ source/graphics/LOSTexture.h @@ -98,6 +98,7 @@ m_Texture, m_SmoothTextures[2]; uint32_t m_WhichTexture = 0; + double m_LastTextureRecomputeTime = 0.0; // We update textures once a frame, so we change a Framebuffer once a frame. // That allows us to use two ping-pong FBOs instead of checking completeness Index: source/graphics/LOSTexture.cpp =================================================================== --- source/graphics/LOSTexture.cpp +++ source/graphics/LOSTexture.cpp @@ -22,6 +22,8 @@ #include "graphics/ShaderManager.h" #include "lib/bits.h" #include "lib/config2.h" +#include "lib/timer.h" +#include "maths/MathUtil.h" #include "ps/CLogger.h" #include "ps/CStrInternStatic.h" #include "ps/Game.h" @@ -132,6 +134,8 @@ if (m_Dirty) { RecomputeTexture(deviceCommandContext); + m_LastTextureRecomputeTime = timer_Time(); + m_WhichTexture = 1u - m_WhichTexture; m_Dirty = false; } @@ -150,11 +154,11 @@ deviceCommandContext->SetTexture( shader->GetBindingSlot(str_losTex1), m_Texture.get()); deviceCommandContext->SetTexture( - shader->GetBindingSlot(str_losTex2), m_SmoothTextures[m_WhichTexture].get()); + shader->GetBindingSlot(str_losTex2), m_SmoothTextures[1u - m_WhichTexture].get()); - deviceCommandContext->SetUniform( - shader->GetBindingSlot(str_delta), - static_cast(g_Renderer.GetTimeManager().GetFrameDelta() * 4.0f)); + const float delta = Clamp( + (timer_Time() - m_LastTextureRecomputeTime) * 2.0f, 0.0f, 1.0f); + deviceCommandContext->SetUniform(shader->GetBindingSlot(str_delta), delta); const SViewPort oldVp = g_Renderer.GetViewport(); const SViewPort vp = @@ -208,8 +212,6 @@ deviceCommandContext->SetFramebuffer( deviceCommandContext->GetDevice()->GetCurrentBackbuffer()); - - m_WhichTexture = 1u - m_WhichTexture; }