feat(render): implement Campaign AR and terrain fidelity

This commit is contained in:
Erik 2026-08-22 13:13:29 +02:00
parent 99cf26e00c
commit 7a5f96ede5
368 changed files with 50611 additions and 950 deletions

View file

@ -1,8 +1,10 @@
using System.Numerics;
using AcDream.App.Input;
using AcDream.App.Rendering.Scene;
using AcDream.App.Rendering.Scene.Arch;
using AcDream.App.Streaming;
using AcDream.App.World;
using AcDream.Core.Items;
using AcDream.Core.Net;
using AcDream.Core.Net.Messages;
using AcDream.Core.Physics;
@ -40,6 +42,43 @@ public sealed class LiveRenderProjectionJournalTests
Assert.True((registered.Record.Flags & RenderProjectionFlags.Draw) != 0);
}
[Fact]
public void EntityReady_RetainsExactLocalPlayerIdentityAtRenderPublication()
{
Harness harness = CreateHarness(loadLandblock: true, localPlayerGuid: Guid);
LiveEntityRecord record = Materialize(harness, Guid, instance: 12);
Assert.True(harness.Projections.OnEntityReady(
LiveEntityReadyCandidate.Capture(record)));
Assert.Equal(
RenderCasterIdentityKind.LocalPlayer,
Assert.Single(harness.Journal.Pending.ToArray())
.Record.EntityPayload.CasterIdentity);
}
[Theory]
[InlineData(0x80000001u, null, null, 0x80000001u, (byte)RenderCasterIdentityKind.LocalPlayer)]
[InlineData(0x80000001u, null, 0x8u, 0u, (byte)RenderCasterIdentityKind.RemotePlayer)]
[InlineData(0x50000001u, null, null, 0u, (byte)RenderCasterIdentityKind.RemotePlayer)]
[InlineData(0x80000001u, (uint)ItemType.Creature, null, 0u, (byte)RenderCasterIdentityKind.NonPlayerCreature)]
[InlineData(0x80000001u, (uint)ItemType.Misc, null, 0u, (byte)RenderCasterIdentityKind.OtherLiveDynamic)]
public void CasterIdentityClassifier_UsesOnlyAuthoritativeSpawnFacts(
uint serverGuid,
uint? itemType,
uint? objectDescriptionFlags,
uint localPlayerGuid,
byte expected)
{
Assert.Equal(
(RenderCasterIdentityKind)expected,
RenderCasterIdentityClassifier.Classify(
serverGuid,
itemType,
objectDescriptionFlags,
localPlayerGuid));
}
[Fact]
public void PendingToLoadedAndLoadedToLoaded_RebucketWithoutLogicalRecreate()
{
@ -347,7 +386,9 @@ public sealed class LiveRenderProjectionJournalTests
Assert.Equal(0, harness.Projections.ProjectionCount);
}
private static Harness CreateHarness(bool loadLandblock)
private static Harness CreateHarness(
bool loadLandblock,
uint localPlayerGuid = 0)
{
var state = new GpuWorldState();
if (loadLandblock)
@ -360,10 +401,15 @@ public sealed class LiveRenderProjectionJournalTests
var runtime = LiveEntityRuntimeFixture.Create(state, resources);
var journal = new RenderProjectionJournal(
RenderSceneGeneration.FromRaw(1));
var localPlayer = new LocalPlayerIdentityState
{
ServerGuid = localPlayerGuid,
};
var projections = new LiveRenderProjectionJournal(
runtime,
journal,
new GpuWorldRenderTraversalOrderSource(state));
new GpuWorldRenderTraversalOrderSource(state),
localPlayer);
sink = projections;
var scene = new ArchRenderScene(RenderSceneGeneration.FromRaw(1));
return new Harness(state, runtime, journal, projections, scene);