Oath speech in the deep warrior voice, cinematic camera, crowd calls your name
Stand von main 730ac6a2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,8 +22,8 @@ namespace GladiatorIdle.Gfx
|
||||
AlphaBlendFunction = BlendFunction.Add, AlphaSourceBlend = Blend.Zero, AlphaDestinationBlend = Blend.One,
|
||||
};
|
||||
|
||||
static RenderTarget2D Make(GraphicsDevice gd, int w, int h, int msaa, DepthFormat depth) =>
|
||||
new(gd, Math.Max(1, w), Math.Max(1, h), false, SurfaceFormat.Color, depth, msaa, RenderTargetUsage.PreserveContents);
|
||||
static RenderTarget2D Make(GraphicsDevice gd, int w, int h, int msaa, DepthFormat depth, RenderTargetUsage use) =>
|
||||
new(gd, Math.Max(1, w), Math.Max(1, h), false, SurfaceFormat.Color, depth, msaa, use);
|
||||
|
||||
/// Zeichnen in die Zwischenfläche beginnen (Größe wie der Bildschirm).
|
||||
public void Begin(GraphicsDevice gd, int w, int h, bool antiAlias)
|
||||
@@ -32,10 +32,11 @@ namespace GladiatorIdle.Gfx
|
||||
if (_scene == null || _scene.Width != w || _scene.Height != h || _msaa != msaa)
|
||||
{
|
||||
_scene?.Dispose(); _a?.Dispose(); _b?.Dispose(); _c?.Dispose();
|
||||
_scene = Make(gd, w, h, msaa, DepthFormat.Depth24Stencil8);
|
||||
_a = Make(gd, w / 4, h / 4, 0, DepthFormat.None);
|
||||
_b = Make(gd, w / 8, h / 8, 0, DepthFormat.None);
|
||||
_c = Make(gd, w / 16, h / 16, 0, DepthFormat.None);
|
||||
// die Szene behält ihren Inhalt (Zielwechsel während des Zeichnens), die Stufen nicht
|
||||
_scene = Make(gd, w, h, msaa, DepthFormat.Depth24Stencil8, RenderTargetUsage.PreserveContents);
|
||||
_a = Make(gd, w / 4, h / 4, 0, DepthFormat.None, RenderTargetUsage.DiscardContents);
|
||||
_b = Make(gd, w / 8, h / 8, 0, DepthFormat.None, RenderTargetUsage.DiscardContents);
|
||||
_c = Make(gd, w / 16, h / 16, 0, DepthFormat.None, RenderTargetUsage.DiscardContents);
|
||||
_msaa = msaa;
|
||||
}
|
||||
gd.SetRenderTarget(_scene);
|
||||
@@ -48,9 +49,13 @@ namespace GladiatorIdle.Gfx
|
||||
if (bloom > 0)
|
||||
{
|
||||
// ¼: verkleinern, dann Schwelle abziehen (nur Helles bleibt)
|
||||
Blit(gd, sb, _scene, _a!, BlendState.Opaque, Color.White);
|
||||
sb.Begin(SpriteSortMode.Immediate, Subtract);
|
||||
sb.Draw(Assets.Pixel, new Rectangle(0, 0, _a!.Width, _a.Height), new Color(threshold, threshold, threshold, 0f));
|
||||
// ¼ und Schwelle in einem Durchgang (ein Zielwechsel)
|
||||
gd.SetRenderTarget(_a);
|
||||
sb.Begin(SpriteSortMode.Deferred, BlendState.Opaque, SamplerState.LinearClamp);
|
||||
sb.Draw(_scene, new Rectangle(0, 0, _a!.Width, _a.Height), Color.White);
|
||||
sb.End();
|
||||
sb.Begin(SpriteSortMode.Deferred, Subtract);
|
||||
sb.Draw(Assets.Pixel, new Rectangle(0, 0, _a.Width, _a.Height), new Color(threshold, threshold, threshold, 0f));
|
||||
sb.End();
|
||||
// ⅛ und 1/16: weiter verkleinern = weicher
|
||||
Blit(gd, sb, _a, _b!, BlendState.Opaque, Color.White);
|
||||
@@ -58,7 +63,7 @@ namespace GladiatorIdle.Gfx
|
||||
}
|
||||
gd.SetRenderTarget(output);
|
||||
int w = output?.Width ?? gd.PresentationParameters.BackBufferWidth, h = output?.Height ?? gd.PresentationParameters.BackBufferHeight;
|
||||
sb.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.PointClamp);
|
||||
sb.Begin(SpriteSortMode.Deferred, BlendState.Opaque, SamplerState.PointClamp);
|
||||
sb.Draw(_scene, new Rectangle(0, 0, w, h), Color.White);
|
||||
sb.End();
|
||||
if (bloom > 0)
|
||||
@@ -75,8 +80,7 @@ namespace GladiatorIdle.Gfx
|
||||
static void Blit(GraphicsDevice gd, SpriteBatch sb, Texture2D from, RenderTarget2D to, BlendState blend, Color c)
|
||||
{
|
||||
gd.SetRenderTarget(to);
|
||||
gd.Clear(Color.Black);
|
||||
sb.Begin(SpriteSortMode.Immediate, blend, SamplerState.LinearClamp);
|
||||
sb.Begin(SpriteSortMode.Deferred, blend, SamplerState.LinearClamp);
|
||||
sb.Draw(from, new Rectangle(0, 0, to.Width, to.Height), c);
|
||||
sb.End();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user