fix(render,sim): preserve MechPaint albedo/COLOR_0, monotonic tracer VFX IDs, dither fade, and GLB COLOR_0 check
This commit is contained in:
parent
2529ba62d2
commit
d81865091d
8 changed files with 201 additions and 56 deletions
|
|
@ -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 });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -479,8 +479,8 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
}
|
||||
|
||||
// C: Build single-node BakedStaticMesh + decimated BakedLodFarMesh (>130m) per template
|
||||
ArrayMesh bakedStaticMesh = BuildBakedStaticMesh(sceneRoot, coarseMaterials: false, bakeVertexColor: false);
|
||||
ArrayMesh bakedCoarseStatic = BuildBakedStaticMesh(sceneRoot, coarseMaterials: true, bakeVertexColor: false);
|
||||
ArrayMesh bakedStaticMesh = BuildBakedStaticMesh(sceneRoot, coarseMaterials: false);
|
||||
ArrayMesh bakedCoarseStatic = BuildBakedStaticMesh(sceneRoot, coarseMaterials: true);
|
||||
ArrayMesh bakedLodFarMesh = DecimateMeshGrid(bakedCoarseStatic, cellSize: 0.45f, targetMinY: minY);
|
||||
|
||||
ArrayMesh singleSurfaceStatic = CollapseToSingleSurfaceMechPaintMesh(bakedStaticMesh);
|
||||
|
|
@ -547,7 +547,7 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
ComputeSceneMeshBounds(sceneRoot, out Vector3 bMin, out Vector3 bMax);
|
||||
var partCentroids = CollectGearPartCentroids(sceneRoot);
|
||||
MergeGearSubMeshes(sceneRoot, gearId);
|
||||
ArrayMesh bakedDropMesh = BuildBakedStaticMesh(sceneRoot, coarseMaterials: false, bakeVertexColor: false);
|
||||
ArrayMesh bakedDropMesh = BuildBakedStaticMesh(sceneRoot, coarseMaterials: false);
|
||||
ArrayMesh singleSurfaceMesh = CollapseToSingleSurfaceMechPaintMesh(bakedDropMesh);
|
||||
Vector3 localFwd = new Vector3(0f, 0f, 1f);
|
||||
|
||||
|
|
@ -929,7 +929,7 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
PruneEmptyNonProtectedNodes(sceneRoot, sceneRoot, keptNodes);
|
||||
}
|
||||
|
||||
private static ArrayMesh BuildBakedStaticMesh(Node3D sceneRoot, bool coarseMaterials = false, bool bakeVertexColor = true)
|
||||
private static ArrayMesh BuildBakedStaticMesh(Node3D sceneRoot, bool coarseMaterials = false)
|
||||
{
|
||||
var allMeshes = new List<MeshInstance3D>();
|
||||
CollectAllMeshInstances(sceneRoot, allMeshes);
|
||||
|
|
@ -944,7 +944,7 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
return BuildMergedArrayMesh(items, coarseMaterials, bakeVertexColor) ?? new ArrayMesh();
|
||||
return BuildMergedArrayMesh(items, coarseMaterials) ?? new ArrayMesh();
|
||||
}
|
||||
|
||||
private static Dictionary<string, Vector3> CollectGearPartCentroids(Node3D sceneRoot)
|
||||
|
|
@ -1430,9 +1430,7 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
private static bool TryGetMaterialValueKey(
|
||||
Material mat,
|
||||
bool coarse,
|
||||
bool bakeVertexColor,
|
||||
out StandardMatKey key,
|
||||
out Color vertexTint)
|
||||
out StandardMatKey key)
|
||||
{
|
||||
if (mat is StandardMaterial3D sm &&
|
||||
sm.AlbedoTexture is null &&
|
||||
|
|
@ -1445,16 +1443,14 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
int paintTag = (mName.Contains("olive") || mName.Contains("khaki")) ? 1
|
||||
: (mName.Contains("signal") || mName.Contains("orange")) ? 2
|
||||
: 0;
|
||||
bool useVCol = bakeVertexColor && paintTag == 0;
|
||||
vertexTint = useVCol ? sm.AlbedoColor : Colors.White;
|
||||
float colorScale = coarse ? 2f : 32f;
|
||||
float pbrScale = coarse ? 0f : 4f;
|
||||
key = new StandardMatKey(
|
||||
paintTag,
|
||||
useVCol ? 0 : (int)MathF.Round(sm.AlbedoColor.R * colorScale),
|
||||
useVCol ? 0 : (int)MathF.Round(sm.AlbedoColor.G * colorScale),
|
||||
useVCol ? 0 : (int)MathF.Round(sm.AlbedoColor.B * colorScale),
|
||||
useVCol ? 10 : (int)MathF.Round(sm.AlbedoColor.A * 10f),
|
||||
(int)MathF.Round(sm.AlbedoColor.R * colorScale),
|
||||
(int)MathF.Round(sm.AlbedoColor.G * colorScale),
|
||||
(int)MathF.Round(sm.AlbedoColor.B * colorScale),
|
||||
(int)MathF.Round(sm.AlbedoColor.A * 10f),
|
||||
(int)MathF.Round(sm.Metallic * pbrScale),
|
||||
(int)MathF.Round(sm.Roughness * pbrScale),
|
||||
sm.EmissionEnabled,
|
||||
|
|
@ -1467,21 +1463,18 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
return true;
|
||||
}
|
||||
key = default;
|
||||
vertexTint = Colors.White;
|
||||
return false;
|
||||
}
|
||||
|
||||
private sealed class MaterialSurfaceBucket
|
||||
{
|
||||
public required Material? Material;
|
||||
public bool UsesVertexColor;
|
||||
public readonly List<(Mesh Mesh, int SurfaceIdx, Transform3D RelXf, Color VertexTint)> Sources = new();
|
||||
public readonly List<(Mesh Mesh, int SurfaceIdx, Transform3D RelXf)> Sources = new();
|
||||
}
|
||||
|
||||
private static ArrayMesh? BuildMergedArrayMesh(
|
||||
List<(MeshInstance3D Mi, Transform3D RelXf)> items,
|
||||
bool coarseMaterials = false,
|
||||
bool bakeVertexColor = true)
|
||||
bool coarseMaterials = false)
|
||||
{
|
||||
if (items.Count == 0)
|
||||
{
|
||||
|
|
@ -1490,7 +1483,7 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
|
||||
var buckets = new List<MaterialSurfaceBucket>();
|
||||
var bucketByMatId = new Dictionary<ulong, MaterialSurfaceBucket>();
|
||||
var bucketByMatVal = new Dictionary<(StandardMatKey Key, bool UseVCol), MaterialSurfaceBucket>();
|
||||
var bucketByMatVal = new Dictionary<StandardMatKey, MaterialSurfaceBucket>();
|
||||
MaterialSurfaceBucket? nullMatBucket = null;
|
||||
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
|
|
@ -1510,7 +1503,6 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
}
|
||||
Material? mat = mi.MaterialOverride ?? mi.GetActiveMaterial(s);
|
||||
MaterialSurfaceBucket bucket;
|
||||
Color vTint = Colors.White;
|
||||
if (mat is null)
|
||||
{
|
||||
nullMatBucket ??= new MaterialSurfaceBucket { Material = null };
|
||||
|
|
@ -1520,21 +1512,12 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
}
|
||||
bucket = nullMatBucket;
|
||||
}
|
||||
else if (TryGetMaterialValueKey(mat, coarseMaterials, bakeVertexColor, out var matKey, out vTint))
|
||||
else if (TryGetMaterialValueKey(mat, coarseMaterials, out var matKey))
|
||||
{
|
||||
bool useVCol = bakeVertexColor && matKey.PaintTag == 0;
|
||||
if (!bucketByMatVal.TryGetValue((matKey, useVCol), out bucket!))
|
||||
if (!bucketByMatVal.TryGetValue(matKey, out bucket!))
|
||||
{
|
||||
Material bucketMat = mat;
|
||||
if (useVCol && mat is StandardMaterial3D sm)
|
||||
{
|
||||
var vcMat = (StandardMaterial3D)sm.Duplicate();
|
||||
vcMat.AlbedoColor = Colors.White;
|
||||
vcMat.VertexColorUseAsAlbedo = true;
|
||||
bucketMat = vcMat;
|
||||
}
|
||||
bucket = new MaterialSurfaceBucket { Material = bucketMat, UsesVertexColor = useVCol };
|
||||
bucketByMatVal[(matKey, useVCol)] = bucket;
|
||||
bucket = new MaterialSurfaceBucket { Material = mat };
|
||||
bucketByMatVal[matKey] = bucket;
|
||||
buckets.Add(bucket);
|
||||
}
|
||||
}
|
||||
|
|
@ -1548,7 +1531,7 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
buckets.Add(bucket);
|
||||
}
|
||||
}
|
||||
bucket.Sources.Add((mesh, s, relXf, vTint));
|
||||
bucket.Sources.Add((mesh, s, relXf));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1565,14 +1548,14 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
bool anyTangent = false;
|
||||
bool anyUv = false;
|
||||
bool anyUv2 = false;
|
||||
bool anyColor = bucket.UsesVertexColor;
|
||||
bool anyColor = false;
|
||||
int totalVerts = 0;
|
||||
int totalIndices = 0;
|
||||
|
||||
var cachedArrays = new List<(Godot.Collections.Array Arrays, Transform3D RelXf, Color VTint, int VertCount, int IndexCount)>(bucket.Sources.Count);
|
||||
var cachedArrays = new List<(Godot.Collections.Array Arrays, Transform3D RelXf, int VertCount, int IndexCount)>(bucket.Sources.Count);
|
||||
for (int s = 0; s < bucket.Sources.Count; s++)
|
||||
{
|
||||
var (mesh, surfIdx, relXf, vTint) = bucket.Sources[s];
|
||||
var (mesh, surfIdx, relXf) = bucket.Sources[s];
|
||||
var arr = mesh.SurfaceGetArrays(surfIdx);
|
||||
if (arr.Count <= (int)Mesh.ArrayType.Vertex ||
|
||||
arr[(int)Mesh.ArrayType.Vertex].VariantType != Variant.Type.PackedVector3Array)
|
||||
|
|
@ -1599,7 +1582,7 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
|
||||
totalVerts += verts.Length;
|
||||
totalIndices += idxCount;
|
||||
cachedArrays.Add((arr, relXf, vTint, verts.Length, idxCount));
|
||||
cachedArrays.Add((arr, relXf, verts.Length, idxCount));
|
||||
}
|
||||
|
||||
if (totalVerts == 0 || totalIndices == 0)
|
||||
|
|
@ -1619,7 +1602,7 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
int iOffset = 0;
|
||||
for (int c = 0; c < cachedArrays.Count; c++)
|
||||
{
|
||||
var (arr, relXf, vTint, vCount, idxCount) = cachedArrays[c];
|
||||
var (arr, relXf, vCount, idxCount) = cachedArrays[c];
|
||||
Vector3[] srcVerts = arr[(int)Mesh.ArrayType.Vertex].AsVector3Array();
|
||||
bool flipWinding = relXf.Basis.Determinant() < 0f;
|
||||
Basis normBasis = relXf.Basis.Inverse().Transposed();
|
||||
|
|
@ -1695,19 +1678,11 @@ public sealed class VehicleAssetCache : IDisposable
|
|||
if (arr.Count > (int)Mesh.ArrayType.Color && arr[(int)Mesh.ArrayType.Color].VariantType == Variant.Type.PackedColorArray)
|
||||
{
|
||||
Color[] srcC = arr[(int)Mesh.ArrayType.Color].AsColorArray();
|
||||
if (bucket.UsesVertexColor)
|
||||
{
|
||||
for (int v = 0; v < vCount; v++) outColors[vOffset + v] = srcC[v] * vTint;
|
||||
}
|
||||
else
|
||||
{
|
||||
Array.Copy(srcC, 0, outColors, vOffset, vCount);
|
||||
}
|
||||
Array.Copy(srcC, 0, outColors, vOffset, vCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
Color fill = bucket.UsesVertexColor ? vTint : Colors.White;
|
||||
for (int v = 0; v < vCount; v++) outColors[vOffset + v] = fill;
|
||||
for (int v = 0; v < vCount; v++) outColors[vOffset + v] = Colors.White;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,6 +165,13 @@ void resolve_role_accent(int role, out vec3 col, out float met, out float rgh, o
|
|||
}
|
||||
|
||||
void fragment() {
|
||||
if (v_alpha < 0.99) {
|
||||
float dither = fract(sin(dot(floor(FRAGCOORD.xy), vec2(12.9898, 78.233))) * 43758.5453);
|
||||
if (v_alpha < dither) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
vec3 mat_base_col = base_color.rgb;
|
||||
float mat_rough = roughness;
|
||||
float mat_metal = metallic;
|
||||
|
|
|
|||
|
|
@ -1102,6 +1102,107 @@ public partial class Smoke : Node
|
|||
Check(_main.Hud.ActiveHitArcCount >= 1, "Expected CrosshairOverlay to accept incoming hit arc");
|
||||
}
|
||||
|
||||
// 11. Finding 1: Merged MultiMeshPartPool meshes preserve real non-white material albedos and intact COLOR_0.R AO
|
||||
{
|
||||
foreach (string vid in new[] { "paladin", "jackal" })
|
||||
{
|
||||
var tpl = cache.Vehicles[vid];
|
||||
var meshesToCheck = new List<ArrayMesh> { tpl.SingleSurfaceStaticMesh };
|
||||
for (int i = 0; i < tpl.StaticRigidParts.Count; i++) meshesToCheck.Add(tpl.StaticRigidParts[i].Mesh);
|
||||
for (int i = 0; i < tpl.DetachableRigidParts.Count; i++) meshesToCheck.Add(tpl.DetachableRigidParts[i].Mesh);
|
||||
|
||||
float minAo = 1f;
|
||||
float maxAo = 0f;
|
||||
int whiteNeutralVerts = 0;
|
||||
int darkNeutralVerts = 0;
|
||||
int armorBandVerts = 0;
|
||||
int totalVerts = 0;
|
||||
|
||||
for (int m = 0; m < meshesToCheck.Count; m++)
|
||||
{
|
||||
ArrayMesh am = meshesToCheck[m];
|
||||
for (int s = 0; s < am.GetSurfaceCount(); s++)
|
||||
{
|
||||
var arr = am.SurfaceGetArrays(s);
|
||||
if (arr.Count <= (int)Mesh.ArrayType.Color ||
|
||||
arr[(int)Mesh.ArrayType.Color].VariantType != Variant.Type.PackedColorArray ||
|
||||
arr[(int)Mesh.ArrayType.TexUV].VariantType != Variant.Type.PackedVector2Array ||
|
||||
arr[(int)Mesh.ArrayType.TexUV2].VariantType != Variant.Type.PackedVector2Array)
|
||||
{
|
||||
Check(false, $"Merged MultiMesh '{vid}' missing Color/UV/UV2 arrays");
|
||||
continue;
|
||||
}
|
||||
|
||||
Color[] cols = arr[(int)Mesh.ArrayType.Color].AsColorArray();
|
||||
Vector2[] uv0 = arr[(int)Mesh.ArrayType.TexUV].AsVector2Array();
|
||||
Vector2[] uv1 = arr[(int)Mesh.ArrayType.TexUV2].AsVector2Array();
|
||||
for (int v = 0; v < cols.Length; v++)
|
||||
{
|
||||
totalVerts++;
|
||||
float ao = cols[v].R;
|
||||
if (ao < minAo) minAo = ao;
|
||||
if (ao > maxAo) maxAo = ao;
|
||||
|
||||
int band = (int)MathF.Floor((uv1[v].Y + 0.5f) * 0.5f);
|
||||
float r = uv0[v].X;
|
||||
float g = uv0[v].Y;
|
||||
float b = uv1[v].X;
|
||||
if (band < 3)
|
||||
{
|
||||
if (r > 0.95f && g > 0.95f && b > 0.95f) whiteNeutralVerts++;
|
||||
if (MathF.Max(r, MathF.Max(g, b)) < 0.15f) darkNeutralVerts++;
|
||||
}
|
||||
else if (band == 3)
|
||||
{
|
||||
armorBandVerts++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GD.Print($"SMOKE INFO: MechPaint '{vid}' verts={totalVerts} COLOR_0.R=[{minAo:F4}, {maxAo:F4}] whiteNeutral={whiteNeutralVerts} darkNeutral={darkNeutralVerts} armorBand={armorBandVerts}");
|
||||
Check(totalVerts > 0 && minAo >= 0.03f && maxAo > 0.90f,
|
||||
$"Expected '{vid}' COLOR_0.R AO intact (min >= 0.03, max > 0.90), got [{minAo:F4}, {maxAo:F4}]");
|
||||
Check(whiteNeutralVerts == 0,
|
||||
$"Expected zero white-washed band 0..2 vertices on '{vid}', got {whiteNeutralVerts}");
|
||||
Check(darkNeutralVerts > 0 && armorBandVerts > 0,
|
||||
$"Expected both dark non-white rubber/gunmetal ({darkNeutralVerts}) and olive armor ({armorBandVerts}) vertices on '{vid}'");
|
||||
}
|
||||
Check(VehicleVisualInstance.PerfMaterialDupCount == 0,
|
||||
$"Expected zero StandardMaterial3D duplicates, got {VehicleVisualInstance.PerfMaterialDupCount}");
|
||||
}
|
||||
|
||||
// 12. Finding 2: Monotonic TracerEvent.Id spawns muzzle flash + recoilless smoke puffs ONCE regardless of TTL or FPS
|
||||
{
|
||||
var tracers = _main.Session.State.Tracers;
|
||||
tracers.Clear();
|
||||
_main.Arena.Sync(_main.Session, 1.69f, 0f);
|
||||
int vfxBefore = _main.Arena.TransientVfxCount;
|
||||
|
||||
int tracerId = _main.Session.State.AllocateTracerId();
|
||||
Vector3 pPos = new(_main.Session.State.Player.X, _main.Session.State.Player.Y, _main.Session.State.Player.Z);
|
||||
tracers.Add(new TracerEvent(
|
||||
pPos.X, pPos.Y + 1f, pPos.Z,
|
||||
pPos.X + 20f, pPos.Y + 1f, pPos.Z,
|
||||
0xFFEEDDAAu,
|
||||
0.03f, // Low TTL (< old 0.085f threshold) simulating <=30 FPS decay
|
||||
WeaponVisualClass.Explosive,
|
||||
"recoilless",
|
||||
tracerId));
|
||||
|
||||
_main.Arena.Sync(_main.Session, 1.70f, 0f);
|
||||
int vfxAfterFirst = _main.Arena.TransientVfxCount;
|
||||
Check(vfxAfterFirst == vfxBefore + 5 && _main.Arena.LastSpawnedTracerId == tracerId,
|
||||
$"Expected recoilless tracer #{tracerId} with Ttl=0.03 to spawn 1 muzzle + 4 smoke puffs (+5 VFX), got +{vfxAfterFirst - vfxBefore} (lastId={_main.Arena.LastSpawnedTracerId})");
|
||||
|
||||
// Re-sync with dt=0 (simulating >=60/120 FPS seeing the same TracerEvent again): must NOT re-emit
|
||||
_main.Arena.Sync(_main.Session, 1.71f, 0f);
|
||||
_main.Arena.Sync(_main.Session, 1.72f, 0f);
|
||||
Check(_main.Arena.TransientVfxCount == vfxAfterFirst,
|
||||
$"Expected same TracerEvent #{tracerId} across repeated render frames to spawn VFX once, got {vfxAfterFirst} -> {_main.Arena.TransientVfxCount}");
|
||||
tracers.Clear();
|
||||
}
|
||||
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue