From 28513eae88571549dd9572dc8dc7f6faed9e6739 Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 10 May 2026 18:14:35 +0200 Subject: [PATCH] feat(render #53): add optional CachedBatch collector to ClassifyBatches ClassifyBatches now accepts a restPose parameter (the model-matrix component without entityWorld baked in) and an optional collector. When collector is non-null, each classified batch is appended as a CachedBatch record. Defaults preserve today's behavior. Used in Task 9 to populate the cache on a static-entity miss. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/AcDream.App/Rendering/Wb/WbDrawDispatcher.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/AcDream.App/Rendering/Wb/WbDrawDispatcher.cs b/src/AcDream.App/Rendering/Wb/WbDrawDispatcher.cs index 9196bab..de29be3 100644 --- a/src/AcDream.App/Rendering/Wb/WbDrawDispatcher.cs +++ b/src/AcDream.App/Rendering/Wb/WbDrawDispatcher.cs @@ -421,14 +421,15 @@ public sealed unsafe class WbDrawDispatcher : IDisposable var model = ComposePartWorldMatrix( entityWorld, meshRef.PartTransform, partTransform); - ClassifyBatches(partData, partGfxObjId, model, entity, meshRef, palHash, metaTable); + var restPose = partTransform * meshRef.PartTransform; + ClassifyBatches(partData, partGfxObjId, model, entity, meshRef, palHash, metaTable, restPose); drewAny = true; } } else { var model = meshRef.PartTransform * entityWorld; - ClassifyBatches(renderData, gfxObjId, model, entity, meshRef, palHash, metaTable); + ClassifyBatches(renderData, gfxObjId, model, entity, meshRef, palHash, metaTable, restPose: meshRef.PartTransform); drewAny = true; } @@ -724,7 +725,9 @@ public sealed unsafe class WbDrawDispatcher : IDisposable WorldEntity entity, MeshRef meshRef, ulong palHash, - AcSurfaceMetadataTable metaTable) + AcSurfaceMetadataTable metaTable, + Matrix4x4 restPose, + List? collector = null) { for (int batchIdx = 0; batchIdx < renderData.Batches.Count; batchIdx++) { @@ -768,6 +771,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable _groups[key] = grp; } grp.Matrices.Add(model); + collector?.Add(new CachedBatch(key, texHandle, restPose)); } }