checkpoint(render): preserve pre-overhaul investigation state

This commit is contained in:
Erik 2026-09-01 18:04:24 +02:00
parent e880860291
commit b3b7d922f1
45 changed files with 3168 additions and 619 deletions

View file

@ -1,12 +1,46 @@
using AcDream.Content.Pak;
using DatReaderWriter;
using DatReaderWriter.Options;
using GfxObj = DatReaderWriter.DBObjs.GfxObj;
namespace AcDream.Content.Tests;
[Trait("Lane", "PreparedPackage")]
public sealed class InstalledPreparedCollisionCatalogTests
{
[Fact]
public void InstalledPackage_FacilityHubStepsCarryRetailDrawingSphere()
{
const uint stairGfxObjId = 0x0100_00DEu;
string? datDir = ResolveDatDir();
if (datDir is null)
Assert.Fail("Lane=PreparedPackage requires installed retail DATs and a validated acdream.pak; see docs/release-gate.md.");
string packagePath = ResolvePackagePath(datDir);
if (!File.Exists(packagePath))
Assert.Fail("Lane=PreparedPackage requires installed retail DATs and a validated acdream.pak; see docs/release-gate.md.");
using var dats = new DatCollection(datDir, DatAccessType.Read);
using var adapter = new DatCollectionAdapter(dats);
using var source = new PakPreparedAssetSource(packagePath, adapter);
GfxObj stair = Assert.IsType<GfxObj>(dats.Get<GfxObj>(stairGfxObjId));
PreparedAssetReadResult prepared = source.Read(
PreparedAssetRequest.GfxObj(stairGfxObjId));
Assert.Equal(PreparedAssetReadStatus.Loaded, prepared.Status);
Assert.NotNull(prepared.Data);
Assert.NotNull(prepared.Data!.SelectionSphere);
DatReaderWriter.Types.DrawingBSPNode root = Assert.IsType<
DatReaderWriter.Types.DrawingBSPNode>(stair.DrawingBSP.Root);
Assert.Equal(
root.BoundingSphere.Origin,
prepared.Data.SelectionSphere.Origin);
Assert.Equal(
root.BoundingSphere.Radius,
prepared.Data.SelectionSphere.Radius);
}
[Fact]
public void InstalledPackage_ContainsAndReadsCanonicalCollisionKeys()
{

View file

@ -35,6 +35,47 @@ public sealed class MeshExtractorSolidFaceExtractionTests
private const uint SurfaceTextureId = 0x05000001u;
private const uint RenderSurfaceId = 0x06000001u;
[Fact]
public void PrepareMeshData_CarriesAuthoredDrawingBspSphereInsteadOfVertexAabbSphere()
{
var authored = new Sphere
{
Origin = new Vector3(-0.25f, 0.125f, 0.5f),
Radius = 3.125f,
};
GfxObj gfxObj = BuildQuadGfxObj(SolidSurfaceId, noPos: true);
gfxObj.DrawingBSP = new DrawingBSPTree
{
Root = new DrawingBSPNode { BoundingSphere = authored },
};
var dats = new FakeMeshExtractorDats();
dats.RegisterRootGfxObj(GfxObjId, gfxObj);
dats.Register(SolidSurfaceId, new Surface
{
Type = SurfaceType.Base1Solid,
ColorValue = new ColorARGB
{
Alpha = 255,
Red = 12,
Green = 34,
Blue = 56,
},
});
var extractor = new MeshExtractor(
dats,
NullLogger.Instance,
sideStagedSink: null);
ObjectMeshData? mesh = extractor.PrepareMeshData(
GfxObjId,
isSetup: false);
Assert.NotNull(mesh);
Assert.NotNull(mesh!.SelectionSphere);
Assert.Equal(authored.Origin, mesh.SelectionSphere.Origin);
Assert.Equal(authored.Radius, mesh.SelectionSphere.Radius);
}
/// <summary>
/// One quad polygon, NoPos + Base1Solid: the exact shape of the windmill
/// axle's own polygons. Must now extract to 4 vertices / 6 indices in a