Adds CachedBatch, EntityCacheEntry, and EntityClassificationCache with just TryGet (returns false on empty). The skeleton compiles and the first test (TryGet_EmptyCache_ReturnsFalse) passes. Subsequent tasks add Populate, InvalidateEntity, InvalidateLandblock, and the dispatcher integration. Per spec design Section 6.1. Note: CachedBatch / EntityCacheEntry / EntityClassificationCache are internal (not public as the plan snippet showed). Their members transitively reference the internal GroupKey type, so promoting them to public produces CS0051 inconsistent-accessibility errors. The cache is dispatcher-internal coordination state anyway, and the AcDream.App csproj already exposes internals to AcDream.Core.Tests via InternalsVisibleTo, so the test sees everything it needs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
33 lines
946 B
C#
33 lines
946 B
C#
using System.Collections.Generic;
|
|
using System.Numerics;
|
|
using AcDream.App.Rendering.Wb;
|
|
using AcDream.Core.Meshing;
|
|
using Xunit;
|
|
|
|
namespace AcDream.Core.Tests.Rendering.Wb;
|
|
|
|
public class EntityClassificationCacheTests
|
|
{
|
|
[Fact]
|
|
public void TryGet_EmptyCache_ReturnsFalse()
|
|
{
|
|
var cache = new EntityClassificationCache();
|
|
bool found = cache.TryGet(entityId: 42, out var entry);
|
|
Assert.False(found);
|
|
Assert.Null(entry);
|
|
}
|
|
|
|
private static CachedBatch MakeCachedBatch(
|
|
uint ibo, uint firstIndex, int indexCount, ulong texHandle)
|
|
{
|
|
var key = new GroupKey(
|
|
Ibo: ibo,
|
|
FirstIndex: firstIndex,
|
|
BaseVertex: 0,
|
|
IndexCount: indexCount,
|
|
BindlessTextureHandle: texHandle,
|
|
TextureLayer: 0,
|
|
Translucency: TranslucencyKind.Opaque);
|
|
return new CachedBatch(key, texHandle, Matrix4x4.Identity);
|
|
}
|
|
}
|