1
0
forked from 0ad/0ad

Splits debug display of frustums for an easier debugging of a culling and shadows

This was SVN commit r23395.
This commit is contained in:
Vladislav Belov 2020-01-14 23:51:29 +00:00
parent dc56447328
commit 49415f8716
7 changed files with 36 additions and 6 deletions

View File

@ -275,3 +275,21 @@ DeveloperOverlayCheckboxes.prototype.DisplayCameraFrustum = class
return Engine.Renderer_GetDisplayFrustumEnabled();
}
};
DeveloperOverlayCheckboxes.prototype.DisplayShadowsFrustum = class
{
label()
{
return translate("Display shadows frustum");
}
onPress(checked)
{
Engine.Renderer_SetDisplayShadowsFrustumEnabled(checked);
}
checked()
{
return Engine.Renderer_GetDisplayShadowsFrustumEnabled();
}
};

View File

@ -1424,11 +1424,12 @@ void CRenderer::RenderSubmissions(const CBoundingBoxAligned& waterScissor)
// render debug lines
if (g_RenderingOptions.GetDisplayFrustum())
{
DisplayFrustum();
if (g_RenderingOptions.GetDisplayShadowsFrustum())
{
m->shadow.RenderDebugBounds();
m->shadow.RenderDebugTexture();
ogl_WarnIfError();
}
m->silhouetteRenderer.RenderDebugOverlays(m_ViewCamera);
@ -1499,6 +1500,8 @@ void CRenderer::DisplayFrustum()
glEnable(GL_CULL_FACE);
glDepthMask(1);
#endif
ogl_WarnIfError();
}
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2020 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -77,6 +77,7 @@ SRenderingOptions::SRenderingOptions()
m_PostProc = false;
m_ShowSky = false;
m_DisplayFrustum = false;
m_DisplayShadowsFrustum = false;
m_RenderActors = true;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2020 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -98,6 +98,7 @@ OPTION_CUSTOM_SETTER(NAME, TYPE); OPTION_GETTER(NAME, TYPE); OPTION_DEF(NAME, TY
OPTION(ShowSky, bool);
OPTION(PostProc, bool);
OPTION(DisplayFrustum, bool);
OPTION(DisplayShadowsFrustum, bool);
OPTION(RenderActors, bool);

View File

@ -800,6 +800,8 @@ void ShadowMap::RenderDebugBounds()
glEnable(GL_CULL_FACE);
glDepthMask(1);
ogl_WarnIfError();
}
void ShadowMap::RenderDebugTexture()
@ -844,4 +846,6 @@ void ShadowMap::RenderDebugTexture()
glEnable(GL_DEPTH_TEST);
glDepthMask(1);
ogl_WarnIfError();
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2020 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -52,6 +52,7 @@ IMPLEMENT_BOOLEAN_SCRIPT_SETTING(ShowSky);
IMPLEMENT_BOOLEAN_SCRIPT_SETTING(SmoothLOS);
IMPLEMENT_BOOLEAN_SCRIPT_SETTING(PostProc);
IMPLEMENT_BOOLEAN_SCRIPT_SETTING(DisplayFrustum);
IMPLEMENT_BOOLEAN_SCRIPT_SETTING(DisplayShadowsFrustum);
#undef IMPLEMENT_BOOLEAN_SCRIPT_SETTING
@ -101,6 +102,7 @@ void JSI_Renderer::RegisterScriptFunctions(const ScriptInterface& scriptInterfac
REGISTER_BOOLEAN_SCRIPT_SETTING(SmoothLOS);
REGISTER_BOOLEAN_SCRIPT_SETTING(PostProc);
REGISTER_BOOLEAN_SCRIPT_SETTING(DisplayFrustum);
REGISTER_BOOLEAN_SCRIPT_SETTING(DisplayShadowsFrustum);
}
#undef REGISTER_BOOLEAN_SCRIPT_SETTING

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2020 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -47,6 +47,7 @@ namespace JSI_Renderer
DECLARE_BOOLEAN_SCRIPT_SETTING(SmoothLOS);
DECLARE_BOOLEAN_SCRIPT_SETTING(PostProc);
DECLARE_BOOLEAN_SCRIPT_SETTING(DisplayFrustum);
DECLARE_BOOLEAN_SCRIPT_SETTING(DisplayShadowsFrustum);
void RegisterScriptFunctions(const ScriptInterface& scriptInterface);
}