Add a visualisation mode for depth sprites.
For now this displays the raw sprites. It will eventually be repurposed for rendering the proper depth data.
This commit is contained in:
@@ -119,5 +119,10 @@ namespace OpenRA.Graphics
|
|||||||
shader.SetVec("r1", zoom * 2f / screen.Width, -zoom * 2f / screen.Height);
|
shader.SetVec("r1", zoom * 2f / screen.Width, -zoom * 2f / screen.Height);
|
||||||
shader.SetVec("r2", -1, 1);
|
shader.SetVec("r2", -1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetDepthPreviewEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
shader.SetBool("EnableDepthPreview", enabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,9 @@ namespace OpenRA.Graphics
|
|||||||
if (World.WorldActor.Disposed)
|
if (World.WorldActor.Disposed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (devTrait.Value != null)
|
||||||
|
Game.Renderer.WorldSpriteRenderer.SetDepthPreviewEnabled(devTrait.Value.ShowDepthPreview);
|
||||||
|
|
||||||
RefreshPalette();
|
RefreshPalette();
|
||||||
|
|
||||||
if (World.Type == WorldType.Shellmap && !Game.Settings.Game.ShowShellmap)
|
if (World.Type == WorldType.Shellmap && !Game.Settings.Game.ShowShellmap)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace OpenRA.Traits
|
|||||||
public bool BuildAnywhere;
|
public bool BuildAnywhere;
|
||||||
public bool ShowCombatGeometry;
|
public bool ShowCombatGeometry;
|
||||||
public bool ShowDebugGeometry;
|
public bool ShowDebugGeometry;
|
||||||
|
public bool ShowDepthPreview;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
public object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
||||||
}
|
}
|
||||||
@@ -41,6 +42,8 @@ namespace OpenRA.Traits
|
|||||||
// Client side only
|
// Client side only
|
||||||
public bool ShowCombatGeometry;
|
public bool ShowCombatGeometry;
|
||||||
public bool ShowDebugGeometry;
|
public bool ShowDebugGeometry;
|
||||||
|
public bool ShowDepthPreview;
|
||||||
|
|
||||||
public bool EnableAll;
|
public bool EnableAll;
|
||||||
|
|
||||||
public DeveloperMode(DeveloperModeInfo info)
|
public DeveloperMode(DeveloperModeInfo info)
|
||||||
@@ -54,6 +57,7 @@ namespace OpenRA.Traits
|
|||||||
BuildAnywhere = info.BuildAnywhere;
|
BuildAnywhere = info.BuildAnywhere;
|
||||||
ShowCombatGeometry = info.ShowCombatGeometry;
|
ShowCombatGeometry = info.ShowCombatGeometry;
|
||||||
ShowDebugGeometry = info.ShowDebugGeometry;
|
ShowDebugGeometry = info.ShowDebugGeometry;
|
||||||
|
ShowDepthPreview = info.ShowDepthPreview;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -81,6 +81,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
showTerrainGeometryCheckbox.OnClick = () => terrainGeometryTrait.Enabled ^= true;
|
showTerrainGeometryCheckbox.OnClick = () => terrainGeometryTrait.Enabled ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var showDepthPreviewCheckbox = widget.GetOrNull<CheckboxWidget>("SHOW_DEPTH_PREVIEW");
|
||||||
|
if (showDepthPreviewCheckbox != null)
|
||||||
|
{
|
||||||
|
showDepthPreviewCheckbox.IsChecked = () => devTrait.ShowDepthPreview;
|
||||||
|
showDepthPreviewCheckbox.OnClick = () => devTrait.ShowDepthPreview ^= true;
|
||||||
|
}
|
||||||
|
|
||||||
var allTechCheckbox = widget.GetOrNull<CheckboxWidget>("ENABLE_TECH");
|
var allTechCheckbox = widget.GetOrNull<CheckboxWidget>("ENABLE_TECH");
|
||||||
if (allTechCheckbox != null)
|
if (allTechCheckbox != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
uniform sampler2D DiffuseTexture, Palette;
|
uniform sampler2D DiffuseTexture, Palette;
|
||||||
|
|
||||||
|
uniform bool EnableDepthPreview;
|
||||||
|
|
||||||
varying vec4 TexCoord;
|
varying vec4 TexCoord;
|
||||||
varying vec4 ChannelMask;
|
varying vec4 ChannelMask;
|
||||||
varying vec4 DepthMask;
|
varying vec4 DepthMask;
|
||||||
@@ -8,5 +10,17 @@ void main()
|
|||||||
{
|
{
|
||||||
vec4 x = texture2D(DiffuseTexture, TexCoord.st);
|
vec4 x = texture2D(DiffuseTexture, TexCoord.st);
|
||||||
vec2 p = vec2(dot(x, ChannelMask), TexCoord.p);
|
vec2 p = vec2(dot(x, ChannelMask), TexCoord.p);
|
||||||
gl_FragColor = texture2D(Palette, p);
|
vec4 c = texture2D(Palette, p);
|
||||||
|
|
||||||
|
// Discard any transparent fragments (both color and depth)
|
||||||
|
if (c.a == 0.0)
|
||||||
|
discard;
|
||||||
|
|
||||||
|
if (EnableDepthPreview && length(DepthMask) > 0.0)
|
||||||
|
{
|
||||||
|
float depth = dot(x, DepthMask);
|
||||||
|
gl_FragColor = vec4(depth, depth, depth, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gl_FragColor = c;
|
||||||
}
|
}
|
||||||
|
|||||||
130
mods/ts/chrome/ingame-debug.yaml
Normal file
130
mods/ts/chrome/ingame-debug.yaml
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
Container@DEBUG_PANEL:
|
||||||
|
Logic: DebugMenuLogic
|
||||||
|
Y: 10
|
||||||
|
Width: PARENT_RIGHT
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Children:
|
||||||
|
Label@LABLE_TITLE:
|
||||||
|
Y: 25
|
||||||
|
Font: Bold
|
||||||
|
Text: Debug Options
|
||||||
|
Align: Center
|
||||||
|
Width: PARENT_RIGHT
|
||||||
|
Checkbox@INSTANT_BUILD:
|
||||||
|
X: 45
|
||||||
|
Y: 45
|
||||||
|
Width: 200
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Instant Build Speed
|
||||||
|
Checkbox@ENABLE_TECH:
|
||||||
|
X: 45
|
||||||
|
Y: 75
|
||||||
|
Width: 200
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Build Everything
|
||||||
|
Checkbox@BUILD_ANYWHERE:
|
||||||
|
X: 45
|
||||||
|
Y: 105
|
||||||
|
Width: 200
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Build Anywhere
|
||||||
|
Checkbox@UNLIMITED_POWER:
|
||||||
|
X: 290
|
||||||
|
Y: 45
|
||||||
|
Width: 200
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Unlimited Power
|
||||||
|
Checkbox@INSTANT_CHARGE:
|
||||||
|
X: 290
|
||||||
|
Y: 75
|
||||||
|
Width: 200
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Instant Charge Time
|
||||||
|
Checkbox@DISABLE_VISIBILITY_CHECKS:
|
||||||
|
X: 290
|
||||||
|
Y: 105
|
||||||
|
Height: 20
|
||||||
|
Width: 200
|
||||||
|
Font: Regular
|
||||||
|
Text: Disable visibility checks
|
||||||
|
Button@GIVE_CASH:
|
||||||
|
X: 90
|
||||||
|
Y: 150
|
||||||
|
Width: 140
|
||||||
|
Height: 30
|
||||||
|
Font: Bold
|
||||||
|
Text: Give $20,000
|
||||||
|
Button@GROW_RESOURCES:
|
||||||
|
X: 271
|
||||||
|
Y: 150
|
||||||
|
Width: 140
|
||||||
|
Height: 30
|
||||||
|
Font: Bold
|
||||||
|
Text: Grow Resources
|
||||||
|
Button@GIVE_EXPLORATION:
|
||||||
|
X: 90
|
||||||
|
Y: 200
|
||||||
|
Width: 140
|
||||||
|
Height: 30
|
||||||
|
Font: Bold
|
||||||
|
Text: Clear Shroud
|
||||||
|
Button@RESET_EXPLORATION:
|
||||||
|
X: 271
|
||||||
|
Y: 200
|
||||||
|
Width: 140
|
||||||
|
Height: 30
|
||||||
|
Font: Bold
|
||||||
|
Text: Reset Shroud
|
||||||
|
Label@VISUALIZATIONS_TITLE:
|
||||||
|
Y: 255
|
||||||
|
Font: Bold
|
||||||
|
Text: Visualizations
|
||||||
|
Align: Center
|
||||||
|
Width: PARENT_RIGHT
|
||||||
|
Checkbox@SHOW_UNIT_PATHS:
|
||||||
|
X: 45
|
||||||
|
Y: 275
|
||||||
|
Width: 200
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Show Unit Paths
|
||||||
|
Checkbox@SHOW_ASTAR:
|
||||||
|
X: 45
|
||||||
|
Y: 305
|
||||||
|
Height: 20
|
||||||
|
Width: 200
|
||||||
|
Font: Regular
|
||||||
|
Text: Show A* Cost
|
||||||
|
Checkbox@SHOW_DEPTH_PREVIEW:
|
||||||
|
X: 45
|
||||||
|
Y: 335
|
||||||
|
Height: 20
|
||||||
|
Width: 200
|
||||||
|
Font: Regular
|
||||||
|
Text: Show Depth Data
|
||||||
|
Checkbox@SHOW_COMBATOVERLAY:
|
||||||
|
X: 290
|
||||||
|
Y: 275
|
||||||
|
Height: 20
|
||||||
|
Width: 200
|
||||||
|
Font: Regular
|
||||||
|
Text: Show Combat Geometry
|
||||||
|
Checkbox@SHOW_GEOMETRY:
|
||||||
|
X: 290
|
||||||
|
Y: 305
|
||||||
|
Height: 20
|
||||||
|
Width: 200
|
||||||
|
Font: Regular
|
||||||
|
Text: Show Render Geometry
|
||||||
|
Checkbox@SHOW_TERRAIN_OVERLAY:
|
||||||
|
X: 290
|
||||||
|
Y: 335
|
||||||
|
Height: 20
|
||||||
|
Width: 200
|
||||||
|
Font: Regular
|
||||||
|
Text: Show Terrain Geometry
|
||||||
@@ -145,7 +145,7 @@ ChromeLayout:
|
|||||||
./mods/ts/chrome/ingame-observerstats.yaml
|
./mods/ts/chrome/ingame-observerstats.yaml
|
||||||
./mods/ts/chrome/ingame-player.yaml
|
./mods/ts/chrome/ingame-player.yaml
|
||||||
./mods/ra/chrome/ingame-perf.yaml
|
./mods/ra/chrome/ingame-perf.yaml
|
||||||
./mods/ra/chrome/ingame-debug.yaml
|
./mods/ts/chrome/ingame-debug.yaml
|
||||||
./mods/ra/chrome/mainmenu.yaml
|
./mods/ra/chrome/mainmenu.yaml
|
||||||
./mods/ra/chrome/settings.yaml
|
./mods/ra/chrome/settings.yaml
|
||||||
./mods/ra/chrome/credits.yaml
|
./mods/ra/chrome/credits.yaml
|
||||||
|
|||||||
Reference in New Issue
Block a user