Overhaul depth preview rendering:

* Replace Jet color map with grayscale
* Added Shift + \ hotkey to toggle preview
* Added Shift + [, Shift + ] hotkeys to change contrast
* Added Shift + ;, Shift + ' hotkeys to change offset
This commit is contained in:
Paul Chote
2021-07-25 00:28:29 +01:00
committed by reaperrr
parent 91c5f2cabe
commit 962d6496bd
9 changed files with 342 additions and 31 deletions

View File

@@ -226,9 +226,10 @@ namespace OpenRA.Graphics
shader.SetVec("DepthTextureScale", 128 * depthScale / height);
}
public void SetDepthPreviewEnabled(bool enabled)
public void SetDepthPreview(bool enabled, float contrast, float offset)
{
shader.SetBool("EnableDepthPreview", enabled);
shader.SetVec("DepthPreviewParams", contrast, offset);
}
public void SetAntialiasingPixelsPerTexel(float pxPerTx)

View File

@@ -45,8 +45,6 @@ namespace OpenRA.Graphics
readonly List<IRenderable> renderablesBuffer = new List<IRenderable>();
bool lastDepthPreviewEnabled;
internal WorldRenderer(ModData modData, World world)
{
World = world;
@@ -256,11 +254,7 @@ namespace OpenRA.Graphics
if (World.WorldActor.Disposed)
return;
if (debugVis.Value != null && lastDepthPreviewEnabled != debugVis.Value.DepthBuffer)
{
lastDepthPreviewEnabled = debugVis.Value.DepthBuffer;
Game.Renderer.WorldSpriteRenderer.SetDepthPreviewEnabled(lastDepthPreviewEnabled);
}
debugVis.Value?.UpdateDepthBuffer();
var bounds = Viewport.GetScissorBounds(World.Type != WorldType.Editor);
Game.Renderer.EnableScissor(bounds);