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:
@@ -176,6 +176,7 @@ namespace GladiatorIdle.Gfx
|
||||
for (int k = 0; k < clip.Data.Length; k++) clip.Data[k] = r.ReadSingle();
|
||||
Clips.Add(clip);
|
||||
}
|
||||
NormalizeRoots(Path.GetFileNameWithoutExtension(path));
|
||||
if (v2 && r.ReadInt32() is int texLen && texLen > 0)
|
||||
{
|
||||
// PNG ohne Grafikkarte entpacken (auch im Hintergrund), Stufen gegen Flimmern klein/weit weg
|
||||
@@ -205,6 +206,36 @@ namespace GladiatorIdle.Gfx
|
||||
|
||||
public Clip? Find(string name) => Clips.Find(c => c.Name == name);
|
||||
|
||||
/// Bewegungen, die mit einer anderen Figur geladen wurden, haben die Hüfte (Wurzel-Knochen) in
|
||||
/// anderer Höhe oder anderem Maßstab – die Figur schwebt oder versinkt. Je Clip die Wurzel-Bewegung
|
||||
/// gemeinsam skalieren, sodass ihre Höhe zu den übrigen Clips der Figur passt.
|
||||
void NormalizeRoots(string name)
|
||||
{
|
||||
int nb = _names.Length;
|
||||
for (int bone = 0; bone < nb; bone++)
|
||||
{
|
||||
if (_parent[bone] >= 0 || Clips.Count < 3) continue;
|
||||
// Bezug: Mittelwert der Hüfthöhe im ersten Bild über alle Clips (die meisten passen zusammen)
|
||||
var ys = Clips.Select(c => MathF.Abs(c.Data[bone * 10 + 1])).Where(y => y > 1e-4f).OrderBy(y => y).ToArray();
|
||||
if (ys.Length == 0) continue;
|
||||
float median = ys[ys.Length / 2];
|
||||
// Ausreißer (Faktor > 2): gemeinsamen Faktor nehmen, damit echte Unterschiede (Ducken) bleiben
|
||||
var odd = Clips.Where(c => { float y = MathF.Abs(c.Data[bone * 10 + 1]); return y > 1e-4f && (y > median * 2 || y < median / 2); }).ToList();
|
||||
if (odd.Count == 0) continue;
|
||||
var ratios = odd.Select(c => median / MathF.Abs(c.Data[bone * 10 + 1])).OrderBy(k => k).ToArray();
|
||||
float k = ratios[ratios.Length / 2];
|
||||
foreach (var clip in odd)
|
||||
{
|
||||
for (int f = 0; f < clip.Frames; f++)
|
||||
{
|
||||
int o = (f * nb + bone) * 10;
|
||||
clip.Data[o] *= k; clip.Data[o + 1] *= k; clip.Data[o + 2] *= k;
|
||||
}
|
||||
if (DevShot.Active) DevShot.Log($"root {name}/{clip.Name}: hips scaled x{k:0.###} (median {median:0.###})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Teamfarbe (Index in Appearance.Colors), -1 = Originalfarben.
|
||||
/// Hautton dunkler (0 = unverändert, 1 = dunkle Haut, −1 = helle, blasse Haut): für Aussehen-Vorlagen mit dunkler Haut, solange
|
||||
/// sie das Modell einer anderen Vorlage nutzen. Haut erkannt an Farbton (Orange/Rosa), mittlerer
|
||||
|
||||
@@ -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