Fix menu effects ignoring annotations
This commit is contained in:
@@ -380,6 +380,8 @@ namespace OpenRA.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApplyPostProcessing(PostProcessPassType.AfterAnnotations);
|
||||||
|
|
||||||
Game.Renderer.Flush();
|
Game.Renderer.Flush();
|
||||||
|
|
||||||
preparedRenderables.Clear();
|
preparedRenderables.Clear();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace OpenRA
|
|||||||
readonly IVertexBuffer<Vertex> tempVertexBuffer;
|
readonly IVertexBuffer<Vertex> tempVertexBuffer;
|
||||||
readonly IIndexBuffer quadIndexBuffer;
|
readonly IIndexBuffer quadIndexBuffer;
|
||||||
readonly Stack<Rectangle> scissorState = [];
|
readonly Stack<Rectangle> scissorState = [];
|
||||||
readonly ITexture worldBufferSnapshot;
|
readonly ITexture bufferSnapshot;
|
||||||
|
|
||||||
IFrameBuffer screenBuffer;
|
IFrameBuffer screenBuffer;
|
||||||
Sprite screenSprite;
|
Sprite screenSprite;
|
||||||
@@ -61,12 +61,13 @@ namespace OpenRA
|
|||||||
public int WorldDownscaleFactor { get; private set; } = 1;
|
public int WorldDownscaleFactor { get; private set; } = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copies and returns the currently rendered world state as a temporary texture.
|
/// Copies and returns the currently rendered state as a temporary texture.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ITexture WorldBufferSnapshot()
|
public ITexture GetRenderBufferSnapshot()
|
||||||
{
|
{
|
||||||
worldBufferSnapshot.SetDataFromReadBuffer(new Rectangle(int2.Zero, worldSheet.Size));
|
var size = renderType == RenderType.World ? worldSheet.Size : Window.SurfaceSize.NextPowerOf2();
|
||||||
return worldBufferSnapshot;
|
bufferSnapshot.SetDataFromReadBuffer(new Rectangle(int2.Zero, size));
|
||||||
|
return bufferSnapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
SheetBuilder fontSheetBuilder;
|
SheetBuilder fontSheetBuilder;
|
||||||
@@ -107,7 +108,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
tempVertexBuffer = Context.CreateEmptyVertexBuffer<Vertex>(TempVertexBufferSize);
|
tempVertexBuffer = Context.CreateEmptyVertexBuffer<Vertex>(TempVertexBufferSize);
|
||||||
quadIndexBuffer = Context.CreateIndexBuffer(Util.CreateQuadIndices(TempIndexBufferSize / 6));
|
quadIndexBuffer = Context.CreateIndexBuffer(Util.CreateQuadIndices(TempIndexBufferSize / 6));
|
||||||
worldBufferSnapshot = Context.CreateTexture();
|
bufferSnapshot = Context.CreateTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Size GetResolution(GraphicSettings graphicsSettings)
|
static Size GetResolution(GraphicSettings graphicsSettings)
|
||||||
@@ -543,7 +544,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
worldBuffer?.Dispose();
|
worldBuffer?.Dispose();
|
||||||
screenBuffer.Dispose();
|
screenBuffer.Dispose();
|
||||||
worldBufferSnapshot.Dispose();
|
bufferSnapshot.Dispose();
|
||||||
tempVertexBuffer.Dispose();
|
tempVertexBuffer.Dispose();
|
||||||
quadIndexBuffer.Dispose();
|
quadIndexBuffer.Dispose();
|
||||||
fontSheetBuilder?.Dispose();
|
fontSheetBuilder?.Dispose();
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ namespace OpenRA.Traits
|
|||||||
bool SpatiallyPartitionable { get; }
|
bool SpatiallyPartitionable { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PostProcessPassType { AfterShroud, AfterWorld, AfterActors }
|
public enum PostProcessPassType { AfterShroud, AfterWorld, AfterActors, AfterAnnotations }
|
||||||
|
|
||||||
[RequireExplicitImplementation]
|
[RequireExplicitImplementation]
|
||||||
public interface IRenderPostProcessPass
|
public interface IRenderPostProcessPass
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
shader.SetVec("Scroll", scroll.X, scroll.Y);
|
shader.SetVec("Scroll", scroll.X, scroll.Y);
|
||||||
shader.SetVec("p1", width, height);
|
shader.SetVec("p1", width, height);
|
||||||
shader.SetVec("p2", -1, -1);
|
shader.SetVec("p2", -1, -1);
|
||||||
shader.SetTexture("WorldTexture", Game.Renderer.WorldBufferSnapshot());
|
shader.SetTexture("SourceTexture", Game.Renderer.GetRenderBufferSnapshot());
|
||||||
shader.SetTexture("VortexTexture", vortexSheet.GetTexture());
|
shader.SetTexture("VortexTexture", vortexSheet.GetTexture());
|
||||||
shader.PrepareRender();
|
shader.PrepareRender();
|
||||||
foreach (var (pos, frame) in vortices)
|
foreach (var (pos, frame) in vortices)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
long endTime;
|
long endTime;
|
||||||
|
|
||||||
public MenuPostProcessEffect(MenuPostProcessEffectInfo info)
|
public MenuPostProcessEffect(MenuPostProcessEffectInfo info)
|
||||||
: base("menufade", PostProcessPassType.AfterShroud)
|
: base("menufade", PostProcessPassType.AfterAnnotations)
|
||||||
{
|
{
|
||||||
Info = info;
|
Info = info;
|
||||||
to = info.GameStartEffect;
|
to = info.GameStartEffect;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
bool IRenderPostProcessPass.Enabled => Enabled;
|
bool IRenderPostProcessPass.Enabled => Enabled;
|
||||||
void IRenderPostProcessPass.Draw(WorldRenderer wr)
|
void IRenderPostProcessPass.Draw(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
shader.SetTexture("WorldTexture", Game.Renderer.WorldBufferSnapshot());
|
shader.SetTexture("SourceTexture", Game.Renderer.GetRenderBufferSnapshot());
|
||||||
PrepareRender(wr, shader);
|
PrepareRender(wr, shader);
|
||||||
shader.PrepareRender();
|
shader.PrepareRender();
|
||||||
renderer.DrawBatch(buffer, shader, 0, 6, PrimitiveType.TriangleList);
|
renderer.DrawBatch(buffer, shader, 0, 6, PrimitiveType.TriangleList);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
shader.SetVec("Scroll", scroll.X, scroll.Y);
|
shader.SetVec("Scroll", scroll.X, scroll.Y);
|
||||||
shader.SetVec("p1", width, height);
|
shader.SetVec("p1", width, height);
|
||||||
shader.SetVec("p2", -1, -1);
|
shader.SetVec("p2", -1, -1);
|
||||||
shader.SetTexture("WorldTexture", Game.Renderer.WorldBufferSnapshot());
|
shader.SetTexture("SourceTexture", Game.Renderer.GetRenderBufferSnapshot());
|
||||||
shader.PrepareRender();
|
shader.PrepareRender();
|
||||||
foreach (var pos in positions)
|
foreach (var pos in positions)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ precision mediump float;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uniform float Blend;
|
uniform float Blend;
|
||||||
uniform sampler2D WorldTexture;
|
uniform sampler2D SourceTexture;
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 c = texelFetch(WorldTexture, ivec2(gl_FragCoord.xy), 0);
|
vec4 c = texelFetch(SourceTexture, ivec2(gl_FragCoord.xy), 0);
|
||||||
float lum = 0.5 * (min(c.r, min(c.g, c.b)) + max(c.r, max(c.g, c.b)));
|
float lum = 0.5 * (min(c.r, min(c.g, c.b)) + max(c.r, max(c.g, c.b)));
|
||||||
fragColor = mix(c, vec4(lum, lum, lum, c.a), Blend);
|
fragColor = mix(c, vec4(lum, lum, lum, c.a), Blend);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ precision mediump float;
|
|||||||
|
|
||||||
uniform float Blend;
|
uniform float Blend;
|
||||||
uniform vec3 Color;
|
uniform vec3 Color;
|
||||||
uniform sampler2D WorldTexture;
|
uniform sampler2D SourceTexture;
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 c = texelFetch(WorldTexture, ivec2(gl_FragCoord.xy), 0);
|
vec4 c = texelFetch(SourceTexture, ivec2(gl_FragCoord.xy), 0);
|
||||||
fragColor = mix(c, vec4(Color, c.a), Blend);
|
fragColor = mix(c, vec4(Color, c.a), Blend);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ precision mediump float;
|
|||||||
uniform float From;
|
uniform float From;
|
||||||
uniform float To;
|
uniform float To;
|
||||||
uniform float Blend;
|
uniform float Blend;
|
||||||
uniform sampler2D WorldTexture;
|
uniform sampler2D SourceTexture;
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
vec4 ColorForEffect(float effect, vec4 c)
|
vec4 ColorForEffect(float effect, vec4 c)
|
||||||
@@ -27,6 +27,6 @@ vec4 ColorForEffect(float effect, vec4 c)
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 c = texelFetch(WorldTexture, ivec2(gl_FragCoord.xy), 0);
|
vec4 c = texelFetch(SourceTexture, ivec2(gl_FragCoord.xy), 0);
|
||||||
fragColor = mix(ColorForEffect(To, c), ColorForEffect(From, c), Blend);
|
fragColor = mix(ColorForEffect(To, c), ColorForEffect(From, c), Blend);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
precision mediump float;
|
precision mediump float;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uniform sampler2D WorldTexture;
|
uniform sampler2D SourceTexture;
|
||||||
uniform float Scale;
|
uniform float Scale;
|
||||||
|
|
||||||
in vec2 vTexCoord;
|
in vec2 vTexCoord;
|
||||||
@@ -14,5 +14,5 @@ void main()
|
|||||||
if (dot(vTexCoord, vTexCoord) >= 1.0)
|
if (dot(vTexCoord, vTexCoord) >= 1.0)
|
||||||
discard;
|
discard;
|
||||||
|
|
||||||
fragColor = texelFetch(WorldTexture, ivec2(gl_FragCoord.xy + Scale * vTexCoord), 0);
|
fragColor = texelFetch(SourceTexture, ivec2(gl_FragCoord.xy + Scale * vTexCoord), 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ precision mediump float;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uniform sampler2D VortexTexture;
|
uniform sampler2D VortexTexture;
|
||||||
uniform sampler2D WorldTexture;
|
uniform sampler2D SourceTexture;
|
||||||
|
|
||||||
in vec2 vTexCoord;
|
in vec2 vTexCoord;
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
@@ -18,5 +18,5 @@ void main()
|
|||||||
if (vtx.r > 0.055)
|
if (vtx.r > 0.055)
|
||||||
discard;
|
discard;
|
||||||
|
|
||||||
fragColor = texelFetch(WorldTexture, ivec2(gl_FragCoord.xy + delta), 0) * vec4(frac, frac, frac, 1);
|
fragColor = texelFetch(SourceTexture, ivec2(gl_FragCoord.xy + delta), 0) * vec4(frac, frac, frac, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ precision mediump float;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uniform vec3 Tint;
|
uniform vec3 Tint;
|
||||||
uniform sampler2D WorldTexture;
|
uniform sampler2D SourceTexture;
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 c = texelFetch(WorldTexture, ivec2(gl_FragCoord.xy), 0);
|
vec4 c = texelFetch(SourceTexture, ivec2(gl_FragCoord.xy), 0);
|
||||||
fragColor = vec4(Tint, c.a) * c;
|
fragColor = vec4(Tint, c.a) * c;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user