1
0
forked from mirrors/0ad

Fixes uninitialized water textures.

Fixes #8052
This commit is contained in:
Vladislav Belov
2025-10-05 13:32:09 +02:00
parent e1d5e92c2a
commit 199f4cb666
3 changed files with 20 additions and 0 deletions
+16
View File
@@ -564,6 +564,12 @@ void CSceneRenderer::RenderReflections(
m->terrainRenderer.ScissorWater(CULL_DEFAULT, m_ViewCamera);
if (reflectionScissor.IsEmpty())
{
if (!wm.m_ReflectionFramebufferInitialized)
{
wm.m_ReflectionFramebufferInitialized = true;
deviceCommandContext->BeginFramebufferPass(wm.m_ReflectionFramebuffer.get());
deviceCommandContext->EndFramebufferPass();
}
m_ViewCamera = normalCamera;
return;
}
@@ -619,6 +625,8 @@ void CSceneRenderer::RenderReflections(
deviceCommandContext->SetScissors(0, nullptr);
deviceCommandContext->EndFramebufferPass();
wm.m_ReflectionFramebufferInitialized = true;
// Reset old camera
m_ViewCamera = normalCamera;
}
@@ -641,6 +649,12 @@ void CSceneRenderer::RenderRefractions(
m->terrainRenderer.ScissorWater(CULL_DEFAULT, m_ViewCamera);
if (refractionScissor.IsEmpty())
{
if (!wm.m_RefractionFramebufferInitialized)
{
wm.m_RefractionFramebufferInitialized = true;
deviceCommandContext->BeginFramebufferPass(wm.m_ReflectionFramebuffer.get());
deviceCommandContext->EndFramebufferPass();
}
m_ViewCamera = normalCamera;
return;
}
@@ -697,6 +711,8 @@ void CSceneRenderer::RenderRefractions(
deviceCommandContext->SetScissors(0, nullptr);
deviceCommandContext->EndFramebufferPass();
wm.m_RefractionFramebufferInitialized = true;
// Reset old camera
m_ViewCamera = normalCamera;
}
+2
View File
@@ -300,6 +300,7 @@ void WaterManager::RecreateOrLoadTexturesIfNeeded()
g_RenderingOptions.SetWaterReflection(false);
UpdateQuality();
}
m_ReflectionFramebufferInitialized = false;
}
// Create refraction textures.
@@ -342,6 +343,7 @@ void WaterManager::RecreateOrLoadTexturesIfNeeded()
g_RenderingOptions.SetWaterRefraction(false);
UpdateQuality();
}
m_RefractionFramebufferInitialized = false;
}
const float scale{g_Renderer.GetPostprocManager().IsEnabled()
+2
View File
@@ -113,7 +113,9 @@ public:
// framebuffer objects
std::unique_ptr<Renderer::Backend::IFramebuffer> m_RefractionFramebuffer;
bool m_RefractionFramebufferInitialized{false};
std::unique_ptr<Renderer::Backend::IFramebuffer> m_ReflectionFramebuffer;
bool m_ReflectionFramebufferInitialized{false};
std::unique_ptr<Renderer::Backend::IFramebuffer> m_FancyEffectsFramebuffer;
std::unique_ptr<Renderer::Backend::IFramebuffer> m_FancyEffectsOccludersFramebuffer;