54 lines
1.8 KiB
C#
54 lines
1.8 KiB
C#
using System.Numerics;
|
|
using AcDream.App.Rendering.Scene;
|
|
using AcDream.App.Rendering.Walk;
|
|
|
|
namespace AcDream.App.Tests.Rendering.Walk;
|
|
|
|
public sealed class WalkProductionWorldDataTests
|
|
{
|
|
[Fact]
|
|
public void BucketOutdoorRecord_UsesEveryOutdoorPhysicsShadowCellAcrossLandblockEdge()
|
|
{
|
|
RenderProjectionRecord record = Record(
|
|
id: 0x1234u,
|
|
position: new Vector3(191f, 191f, 0f));
|
|
var buckets = new Dictionary<uint, List<RenderProjectionRecord>>();
|
|
|
|
WalkProductionWorldData.BucketOutdoorRecord(
|
|
in record,
|
|
[0xF07F0040u, 0xF0800001u, 0xF4180101u],
|
|
buckets,
|
|
renderCenterLbX: 0xF0,
|
|
renderCenterLbY: 0x7F);
|
|
|
|
Assert.Equal([0xF07F0040u, 0xF0800001u], buckets.Keys.Order());
|
|
Assert.All(buckets.Values, bucket => Assert.Equal(record, Assert.Single(bucket)));
|
|
}
|
|
|
|
[Fact]
|
|
public void BucketOutdoorRecord_UnregisteredEffectFallsBackToRootPositionCell()
|
|
{
|
|
RenderProjectionRecord record = Record(
|
|
id: 0x5678u,
|
|
position: new Vector3(193f, 25f, 0f));
|
|
var buckets = new Dictionary<uint, List<RenderProjectionRecord>>();
|
|
|
|
WalkProductionWorldData.BucketOutdoorRecord(
|
|
in record,
|
|
Array.Empty<uint>(),
|
|
buckets,
|
|
renderCenterLbX: 0xEF,
|
|
renderCenterLbY: 0x7F);
|
|
|
|
Assert.Equal([0xF07F0002u], buckets.Keys);
|
|
Assert.Equal(record, Assert.Single(buckets[0xF07F0002u]));
|
|
}
|
|
|
|
private static RenderProjectionRecord Record(uint id, Vector3 position) =>
|
|
new RenderProjectionRecord() with
|
|
{
|
|
Id = RenderProjectionId.FromRaw(id),
|
|
Transform = new RenderTransform(Matrix4x4.CreateTranslation(position)),
|
|
Source = new RenderSourceMetadata() with { LocalEntityId = id },
|
|
};
|
|
}
|