fix(render,sim): preserve MechPaint albedo/COLOR_0, monotonic tracer VFX IDs, dither fade, and GLB COLOR_0 check

This commit is contained in:
Meta Vens 2026-12-05 00:26:13 +01:00
commit d81865091d
8 changed files with 201 additions and 56 deletions

View file

@ -96,6 +96,7 @@ public partial class ArenaRenderer : Node3D
private MultiMeshInstance3D _vfxRingMmi = null!;
private readonly List<TransientVfx> _transientVfx = new(256);
private long _lastVfxHitId;
private int _lastSpawnedTracerId;
private uint _vfxRng = 0x51F15A3Du;
private readonly Dictionary<int, ActorVisual> _contenderVisuals = new();
@ -126,6 +127,8 @@ public partial class ArenaRenderer : Node3D
: null;
internal int ActiveDropVisualCount => _dropVisuals.Count;
internal int LastSpawnedTracerId => _lastSpawnedTracerId;
internal int TransientVfxCount => _transientVfx.Count;
internal bool TryGetChassisDropVisual(int dropId, out VehicleVisualInstance? visual, out float baseY)
{
@ -431,6 +434,7 @@ public partial class ArenaRenderer : Node3D
_debris.ClearAll();
_transientVfx.Clear();
_lastVfxHitId = 0;
_lastSpawnedTracerId = 0;
_contenderVisuals.Clear();
_spectatorVisuals.Clear();
foreach (var kv in _dropVisuals)
@ -984,6 +988,12 @@ public partial class ArenaRenderer : Node3D
for (int i = 0; i < tracers.Count; i++)
{
var t = tracers[i];
bool isNewShot = t.Id > _lastSpawnedTracerId;
if (isNewShot)
{
_lastSpawnedTracerId = t.Id;
}
Vector3 start = new(t.StartX, t.StartY, t.StartZ);
Vector3 end = new(t.EndX, t.EndY, t.EndZ);
Vector3 delta = end - start;
@ -1007,7 +1017,7 @@ public partial class ArenaRenderer : Node3D
? new Color(2.8f, 1.35f, 0.35f, 0.94f)
: new Color(2.6f, 2.35f, 1.15f, 0.92f);
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(isPd ? 0.09f : 0.06f, isPd ? 0.09f : 0.06f, dist), col);
if (t.Ttl > 0.068f)
if (isNewShot)
{
EmitMuzzleFlash(start, 0.32f, new Color(2.8f, 2.0f, 0.7f, 0.95f));
}
@ -1019,7 +1029,7 @@ public partial class ArenaRenderer : Node3D
// Thick dual-tone amber-orange heavy bolt (outer jacket + bright core)
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(0.20f, 0.20f, dist), new Color(2.5f, 0.85f, 0.14f, 0.72f));
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(0.08f, 0.08f, dist), new Color(3.6f, 2.7f, 1.3f, 0.98f));
if (t.Ttl > 0.078f)
if (isNewShot)
{
EmitMuzzleFlash(start, 0.68f, new Color(3.2f, 1.65f, 0.35f, 0.98f));
}
@ -1031,7 +1041,7 @@ public partial class ArenaRenderer : Node3D
bool isRecoilless = string.Equals(t.WeaponId, "recoilless", StringComparison.Ordinal);
float w = isRecoilless ? 0.22f : 0.12f;
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(w, w, dist), new Color(3.2f, 1.25f, 0.25f, 0.96f));
if (t.Ttl > 0.085f)
if (isNewShot)
{
EmitMuzzleFlash(start, isRecoilless ? 1.15f : 0.58f, new Color(3.4f, 1.55f, 0.35f, 0.98f));
int puffs = isRecoilless ? 4 : 2;
@ -1070,7 +1080,7 @@ public partial class ArenaRenderer : Node3D
: new Color(2.4f, 3.4f, 3.8f, 0.98f);
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(outerW, outerW, dist), outerCol);
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(coreW, coreW, dist), coreCol);
if (t.Ttl > 0.095f)
if (isNewShot)
{
EmitMuzzleFlash(start, isLance ? 0.85f : 0.52f, outerCol with { A = 0.95f });
}