Cut 7b: 16 modular Brokkr weapon parts, mfg paint bands 10..14, ClientOrdnanceMirror, audio & tooltips
This commit is contained in:
parent
6f6bfe3c46
commit
6447155efb
27 changed files with 2420 additions and 74 deletions
|
|
@ -35,6 +35,9 @@ public partial class ArenaRenderer : Node3D
|
|||
{
|
||||
public VehicleVisualInstance? ChassisVisual;
|
||||
public ArrayMesh? GearMesh;
|
||||
public VehicleVisualInstance.ModularWeaponPartBinding[]? ModularParts;
|
||||
public float ManufacturerRoleIndex;
|
||||
public Color DropBeaconColor;
|
||||
public Vector3 GearScale;
|
||||
public float GearYOffset;
|
||||
public bool IsModule;
|
||||
|
|
@ -95,6 +98,9 @@ public partial class ArenaRenderer : Node3D
|
|||
private MultiMesh _vfxRingMm = null!;
|
||||
private MultiMeshInstance3D _vfxRingMmi = null!;
|
||||
private readonly List<TransientVfx> _transientVfx = new(128);
|
||||
private readonly ClientOrdnanceMirror _ordnanceMirror = new();
|
||||
private readonly List<(Transform3D Xf, Color Col)> _mirrorSpheres = new(64);
|
||||
private readonly List<(Transform3D Xf, Color Col)> _mirrorRings = new(128);
|
||||
private int _activeBeamCount;
|
||||
|
||||
// Continuous emitter rate limiters (keyed by (IsContender, EntityId))
|
||||
|
|
@ -122,6 +128,7 @@ public partial class ArenaRenderer : Node3D
|
|||
public ParticlePool Particles => _particles;
|
||||
internal MultiMeshPartPool PartPool => _partPool;
|
||||
internal PomDecalPool PomDecals => _pomDecals;
|
||||
internal ClientOrdnanceMirror OrdnanceMirror => _ordnanceMirror;
|
||||
|
||||
public VehicleVisualInstance? GetContenderVisual(int contenderId) =>
|
||||
_contenderVisuals.TryGetValue(contenderId, out var vis) ? vis.Visual : null;
|
||||
|
|
@ -348,6 +355,19 @@ public partial class ArenaRenderer : Node3D
|
|||
SyncSpectators(session, elapsedSeconds, dt, alpha, hasCam, camPos);
|
||||
SyncGroundDrops(state, elapsedSeconds, hasCam, camPos);
|
||||
SyncOrbitalPods(session, alpha, hasCam, camPos);
|
||||
_mirrorSpheres.Clear();
|
||||
_mirrorRings.Clear();
|
||||
_ordnanceMirror.StepAndSubmit(
|
||||
dt,
|
||||
session,
|
||||
_assetCache,
|
||||
_partPool,
|
||||
_particles,
|
||||
state.Terrain,
|
||||
hasCam,
|
||||
camPos,
|
||||
(xf, col) => _mirrorRings.Add((xf, col)),
|
||||
(xf, col) => _mirrorSpheres.Add((xf, col)));
|
||||
_debris.Step(dt, state.Terrain);
|
||||
_debris.SubmitToPool(_partPool);
|
||||
_partPool.EndFrame();
|
||||
|
|
@ -372,6 +392,26 @@ public partial class ArenaRenderer : Node3D
|
|||
var state = session.ViewState;
|
||||
_pomDecals.ConsumeEvents(session, events, stepDt, ResolveEntityVisual);
|
||||
_particles.ConsumeEvents(session, events, camPos, hasCam, sampleGroundTint);
|
||||
_ordnanceMirror.ConsumeEvents(
|
||||
events,
|
||||
_assetCache,
|
||||
_debris,
|
||||
_particles,
|
||||
hasCam,
|
||||
camPos,
|
||||
spec => AddTransient(new TransientVfx
|
||||
{
|
||||
Shape = spec.IsSphere ? VfxShape.Sphere : VfxShape.Ring,
|
||||
Position = spec.Position,
|
||||
Velocity = spec.Velocity,
|
||||
BaseRotation = spec.Rotation,
|
||||
StartScale = spec.StartScale,
|
||||
EndScale = spec.EndScale,
|
||||
ColorStart = spec.ColorStart,
|
||||
ColorEnd = spec.ColorEnd,
|
||||
Age = 0f,
|
||||
Lifetime = spec.Lifetime
|
||||
}));
|
||||
|
||||
for (int i = 0; i < footsteps.Count; i++)
|
||||
{
|
||||
|
|
@ -474,6 +514,9 @@ public partial class ArenaRenderer : Node3D
|
|||
_debris.ClearAll();
|
||||
_particles.ClearAll();
|
||||
_transientVfx.Clear();
|
||||
_ordnanceMirror.Clear();
|
||||
_mirrorSpheres.Clear();
|
||||
_mirrorRings.Clear();
|
||||
_tireDustNextTime.Clear();
|
||||
_thermalVentNextTime.Clear();
|
||||
_damageSmokeNextTime.Clear();
|
||||
|
|
@ -901,19 +944,48 @@ public partial class ArenaRenderer : Node3D
|
|||
float baseY = state.Terrain.SampleHeight(d.X, d.Z);
|
||||
if (d.Module is { } mod)
|
||||
{
|
||||
VehicleVisualInstance.ResolveDropGearVisual(_assetCache, mod, out ArrayMesh gMesh, out Vector3 gScale, out float gYOff);
|
||||
entry = new DropVisualEntry
|
||||
if (mod.Procedural is { } proc)
|
||||
{
|
||||
IsModule = true,
|
||||
IsImperial = mod.IsImperial,
|
||||
GearMesh = gMesh,
|
||||
GearScale = gScale * 1.45f,
|
||||
GearYOffset = gYOff * 1.45f + 0.35f,
|
||||
BaseY = baseY,
|
||||
TileX = tx,
|
||||
TileZ = tz,
|
||||
TileVersion = state.Terrain.TileVersions[tx, tz]
|
||||
};
|
||||
VehicleVisualInstance.BuildModularWeaponAssembly(
|
||||
_assetCache,
|
||||
proc.Assembly,
|
||||
out var modParts,
|
||||
out _,
|
||||
out _,
|
||||
out float minY);
|
||||
float sc = proc.Assembly.VisualScale * 1.45f;
|
||||
entry = new DropVisualEntry
|
||||
{
|
||||
IsModule = true,
|
||||
IsImperial = mod.IsImperial,
|
||||
ModularParts = modParts,
|
||||
ManufacturerRoleIndex = 10f + (float)proc.Manufacturer,
|
||||
DropBeaconColor = ResolveManufacturerBeaconColor(proc.Manufacturer),
|
||||
GearScale = Vector3.One * sc,
|
||||
GearYOffset = -minY * sc + 0.35f,
|
||||
BaseY = baseY,
|
||||
TileX = tx,
|
||||
TileZ = tz,
|
||||
TileVersion = state.Terrain.TileVersions[tx, tz]
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
VehicleVisualInstance.ResolveDropGearVisual(_assetCache, mod, out ArrayMesh gMesh, out Vector3 gScale, out float gYOff);
|
||||
entry = new DropVisualEntry
|
||||
{
|
||||
IsModule = true,
|
||||
IsImperial = mod.IsImperial,
|
||||
GearMesh = gMesh,
|
||||
DropBeaconColor = mod.IsImperial ? TouristGold * 2.2f : OlivePaint * 1.5f,
|
||||
GearScale = gScale * 1.45f,
|
||||
GearYOffset = gYOff * 1.45f + 0.35f,
|
||||
BaseY = baseY,
|
||||
TileX = tx,
|
||||
TileZ = tz,
|
||||
TileVersion = state.Terrain.TileVersions[tx, tz]
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -962,20 +1034,27 @@ public partial class ArenaRenderer : Node3D
|
|||
float bob = MathF.Sin(elapsedSeconds * 2.5f + d.Id) * 0.12f;
|
||||
float yaw = elapsedSeconds * 0.9f + d.Id;
|
||||
|
||||
if (entry.GearMesh is not null)
|
||||
var gearXf = new Transform3D(
|
||||
new Basis(Vector3.Up, yaw) * Basis.FromScale(entry.GearScale),
|
||||
new Vector3(d.X, entry.BaseY + bob + entry.GearYOffset, d.Z));
|
||||
if (entry.ModularParts is { } modParts)
|
||||
{
|
||||
Color custom = new(0f, 0f, entry.ManufacturerRoleIndex, 1f);
|
||||
for (int p = 0; p < modParts.Length; p++)
|
||||
{
|
||||
Transform3D partXf = gearXf * modParts[p].LocalToGearPivot;
|
||||
_partPool.Submit(modParts[p].Mesh, in partXf, in custom, wantsShadow: false);
|
||||
}
|
||||
}
|
||||
else if (entry.GearMesh is not null)
|
||||
{
|
||||
var gearXf = new Transform3D(
|
||||
new Basis(Vector3.Up, yaw) * Basis.FromScale(entry.GearScale),
|
||||
new Vector3(d.X, entry.BaseY + bob + entry.GearYOffset, d.Z));
|
||||
_partPool.Submit(entry.GearMesh, in gearXf, new Color(0f, 0f, 5f, 1f), wantsShadow: false);
|
||||
}
|
||||
|
||||
if (discCount < _dropDiscMm.InstanceCount)
|
||||
{
|
||||
_dropDiscMm.SetInstanceTransform(discCount, new Transform3D(Basis.Identity, new Vector3(d.X, entry.BaseY + bob + 0.08f, d.Z)));
|
||||
Color dCol = entry.IsImperial
|
||||
? new Color(TouristGold.R * 2.2f, TouristGold.G * 2.2f, TouristGold.B * 2.2f, 0.82f)
|
||||
: new Color(OlivePaint.R * 1.5f, OlivePaint.G * 1.5f, OlivePaint.B * 1.5f, 0.72f);
|
||||
Color dCol = entry.DropBeaconColor with { A = entry.IsImperial ? 0.82f : 0.72f };
|
||||
_dropDiscMm.SetInstanceCustomData(discCount, dCol);
|
||||
discCount++;
|
||||
}
|
||||
|
|
@ -1271,6 +1350,33 @@ public partial class ArenaRenderer : Node3D
|
|||
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(coreW, coreW, dist), coreCol);
|
||||
break;
|
||||
}
|
||||
|
||||
case WeaponVisualClass.GaussRail:
|
||||
{
|
||||
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(0.30f, 0.30f, dist), new Color(0.25f, 1.85f, 3.4f, 0.68f));
|
||||
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(0.10f, 0.10f, dist), new Color(2.2f, 3.6f, 4.0f, 0.98f));
|
||||
break;
|
||||
}
|
||||
|
||||
case WeaponVisualClass.PlasmaPpc:
|
||||
{
|
||||
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(0.36f, 0.36f, dist), new Color(0.18f, 2.25f, 2.65f, 0.65f));
|
||||
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(0.14f, 0.14f, dist), new Color(1.2f, 3.5f, 3.8f, 0.98f));
|
||||
break;
|
||||
}
|
||||
|
||||
case WeaponVisualClass.RocketSalvo:
|
||||
{
|
||||
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(0.22f, 0.22f, dist), new Color(3.2f, 1.45f, 0.30f, 0.92f));
|
||||
break;
|
||||
}
|
||||
|
||||
case WeaponVisualClass.SwarmSmart:
|
||||
{
|
||||
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(0.16f, 0.16f, dist), new Color(1.4f, 2.8f, 0.45f, 0.85f));
|
||||
EmitBeam(ref beamIdx, lookBasis, mid, new Vector3(0.07f, 0.07f, dist), new Color(2.0f, 0.95f, 3.2f, 0.96f));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1300,7 +1406,8 @@ public partial class ArenaRenderer : Node3D
|
|||
{
|
||||
continue;
|
||||
}
|
||||
if ((WeaponVisualClass)ev.WeaponClass != WeaponVisualClass.Explosive || ev.IsAirburst)
|
||||
var wClass = (WeaponVisualClass)ev.WeaponClass;
|
||||
if (ev.IsAirburst || wClass is not (WeaponVisualClass.Explosive or WeaponVisualClass.RocketSalvo or WeaponVisualClass.PlasmaPpc or WeaponVisualClass.SwarmSmart))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1311,8 +1418,20 @@ public partial class ArenaRenderer : Node3D
|
|||
normal = normal.Normalized();
|
||||
|
||||
bool isRecoilless = string.Equals(ev.WeaponId, "recoilless", StringComparison.Ordinal);
|
||||
float detSize = isRecoilless ? 3.2f : 1.7f;
|
||||
float ringSize = isRecoilless ? 6.2f : 2.9f;
|
||||
float detSize = isRecoilless || wClass == WeaponVisualClass.RocketSalvo ? 3.2f : 1.9f;
|
||||
float ringSize = isRecoilless || wClass == WeaponVisualClass.RocketSalvo ? 6.2f : 3.4f;
|
||||
Color coreStart = wClass switch
|
||||
{
|
||||
WeaponVisualClass.PlasmaPpc => new Color(0.35f, 3.2f, 3.6f, 0.92f),
|
||||
WeaponVisualClass.SwarmSmart => new Color(1.9f, 3.2f, 0.6f, 0.90f),
|
||||
_ => new Color(3.6f, 2.0f, 0.55f, 0.92f)
|
||||
};
|
||||
Color coreEnd = wClass switch
|
||||
{
|
||||
WeaponVisualClass.PlasmaPpc => new Color(0.10f, 0.55f, 0.85f, 0f),
|
||||
WeaponVisualClass.SwarmSmart => new Color(0.55f, 0.25f, 0.85f, 0f),
|
||||
_ => new Color(0.85f, 0.28f, 0.08f, 0f)
|
||||
};
|
||||
AddTransient(new TransientVfx
|
||||
{
|
||||
Shape = VfxShape.Sphere,
|
||||
|
|
@ -1321,10 +1440,10 @@ public partial class ArenaRenderer : Node3D
|
|||
BaseRotation = Basis.Identity,
|
||||
StartScale = Vector3.One * 0.5f,
|
||||
EndScale = Vector3.One * detSize,
|
||||
ColorStart = new Color(3.6f, 2.0f, 0.55f, 0.92f),
|
||||
ColorEnd = new Color(0.85f, 0.28f, 0.08f, 0.0f),
|
||||
ColorStart = coreStart,
|
||||
ColorEnd = coreEnd,
|
||||
Age = 0f,
|
||||
Lifetime = isRecoilless ? 0.28f : 0.20f
|
||||
Lifetime = isRecoilless ? 0.28f : 0.22f
|
||||
});
|
||||
|
||||
Vector3 upRef = MathF.Abs(normal.Y) > 0.92f ? Vector3.Forward : Vector3.Up;
|
||||
|
|
@ -1339,15 +1458,28 @@ public partial class ArenaRenderer : Node3D
|
|||
BaseRotation = ringBasis,
|
||||
StartScale = new Vector3(0.7f, 1.0f, 0.7f),
|
||||
EndScale = new Vector3(ringSize, 0.4f, ringSize),
|
||||
ColorStart = new Color(3.2f, 1.65f, 0.45f, 0.92f),
|
||||
ColorEnd = new Color(1.4f, 0.55f, 0.20f, 0.0f),
|
||||
ColorStart = coreStart,
|
||||
ColorEnd = coreEnd,
|
||||
Age = 0f,
|
||||
Lifetime = isRecoilless ? 0.32f : 0.22f
|
||||
Lifetime = isRecoilless ? 0.32f : 0.24f
|
||||
});
|
||||
}
|
||||
|
||||
int sphereIdx = 0;
|
||||
int ringIdx = 0;
|
||||
for (int i = 0; i < _mirrorSpheres.Count && sphereIdx < MaxVfxSpheres; i++)
|
||||
{
|
||||
_vfxSphereMm.SetInstanceTransform(sphereIdx, _mirrorSpheres[i].Xf);
|
||||
_vfxSphereMm.SetInstanceCustomData(sphereIdx, _mirrorSpheres[i].Col);
|
||||
sphereIdx++;
|
||||
}
|
||||
for (int i = 0; i < _mirrorRings.Count && ringIdx < MaxVfxRings; i++)
|
||||
{
|
||||
_vfxRingMm.SetInstanceTransform(ringIdx, _mirrorRings[i].Xf);
|
||||
_vfxRingMm.SetInstanceCustomData(ringIdx, _mirrorRings[i].Col);
|
||||
ringIdx++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _transientVfx.Count; i++)
|
||||
{
|
||||
TransientVfx v = _transientVfx[i];
|
||||
|
|
@ -1574,6 +1706,16 @@ public partial class ArenaRenderer : Node3D
|
|||
_transientVfx.Add(vfx);
|
||||
}
|
||||
|
||||
private static Color ResolveManufacturerBeaconColor(ManufacturerId mfg) => mfg switch
|
||||
{
|
||||
ManufacturerId.ScrapFrontier => new Color(2.1f, 1.35f, 0.40f, 0.82f),
|
||||
ManufacturerId.KorrathiIronworks => new Color(2.6f, 1.15f, 0.22f, 0.86f),
|
||||
ManufacturerId.AuralianOptics => new Color(0.55f, 2.25f, 2.65f, 0.86f),
|
||||
ManufacturerId.VexNineCollective => new Color(1.45f, 2.55f, 0.45f, 0.86f),
|
||||
ManufacturerId.ThalassanForge => new Color(0.35f, 1.95f, 2.85f, 0.86f),
|
||||
_ => TouristGold * 2.2f
|
||||
};
|
||||
|
||||
private static void ClearChildren(Node parent)
|
||||
{
|
||||
for (int i = parent.GetChildCount() - 1; i >= 0; i--)
|
||||
|
|
|
|||
Loading…
Reference in a new issue