diff --git a/docs/ISSUES.md b/docs/ISSUES.md index 91fe17b..a9eb292 100644 --- a/docs/ISSUES.md +++ b/docs/ISSUES.md @@ -48,6 +48,77 @@ Copy this block when adding a new issue: --- +## #87 — Drop WB fork patch by switching to PrepareEnvCellGeomMeshDataAsync + +**Status:** OPEN +**Severity:** MEDIUM (band-aid removal; not user-visible) +**Filed:** 2026-05-19 +**Component:** rendering, WB integration + +**Description:** Phase 2 (2026-05-19) shipped a one-line patch in our +WB fork at `references/WorldBuilder/Chorizite.OpenGLSDLBackend/Lib/ObjectMeshManager.cs:1230` +(branch `acdream` on the fork, SHA `34460c4`) to guard a blind +`TryGet(stab.Id, ...)` call against GfxObj-prefixed ids. That +patch fixes the symptom (missing floors) but is structurally a +band-aid — per CLAUDE.md's no-workarounds rule we should retire it. + +The proper fix: switch our EnvCell rendering from +`PrepareMeshDataAsync(envCellId, ...)` (general-purpose entry that +also iterates static-object parts + emitters we don't need) to WB's +narrower `PrepareEnvCellGeomMeshDataAsync(geomId, environmentId, cellStructure, surfaces)` +at [`ObjectMeshManager.cs:386`](../references/WorldBuilder/Chorizite.OpenGLSDLBackend/Lib/ObjectMeshManager.cs:386). +That function only builds the cell room mesh (floor / walls / ceiling), +which is the only piece we actually use from WB for cells — we already +hydrate static objects as separate `WorldEntity` instances in +`BuildInteriorEntitiesForStreaming`, and we run particle scripts via +our own `EntityScriptActivator` (Phase C.1.5b). + +**Root cause / status:** Misuse of WB's general-purpose API for a +geometry-only need. The general-purpose path triggers static-object +iteration that has a bug (TryGet without type check) AND that +does work we throw away. Both problems disappear if we use the +geometry-only entry point WB already exposes for exactly this purpose +(it's what WB's own `EnvCellRenderManager` uses internally). + +**Trade-offs:** + +| | Current (patched WB) | Switch to geom-only API | +|---|---|---| +| WB fork divergence | One-line patch | Zero | +| Future WB upstream merges | Conflicts | Clean | +| Performance | Slightly worse (wasted iteration) | Slightly better | +| Risk to other functionality | None (working today) | Needs re-verification | + +**Files (the change):** + +- `src/AcDream.App/Rendering/GameWindow.cs` around line 5367-5378 + (cell-entity hydration — change `MeshRefs[0].GfxObjId` from `envCellId` + to `envCellId | 0x100000000UL`, the synthetic geom id with bit 32 set). +- `src/AcDream.App/Rendering/Wb/WbMeshAdapter.cs` — add a new method + `PrepareEnvCellGeomMesh(ulong geomId, uint environmentId, ushort cellStructure, List surfaces)` + that forwards to `_meshManager.PrepareEnvCellGeomMeshDataAsync(...)`, + and call it from the streaming path instead of the bare + `IncrementRefCount(envCellId)`. +- `references/WorldBuilder/Chorizite.OpenGLSDLBackend/Lib/ObjectMeshManager.cs:1230` + — revert the type-check guard we added. The function returns to + pristine WB state. + +**Acceptance:** + +- Floors still render in Holtburg Inn (regression check vs Phase 2). +- `references/WorldBuilder` submodule pointer returns to upstream-clean + (no acdream-specific commits in the fork's `acdream` branch — or + rather, the `acdream` branch fast-forwards back to match upstream's + state for this file). +- Probe re-capture at Holtburg confirms `[indoor-upload] completed` for + all cells previously failing. +- No `[wb-error]` lines. + +**Research:** [`docs/research/2026-05-19-indoor-cell-rendering-cause.md`](research/2026-05-19-indoor-cell-rendering-cause.md) +documents the underlying WB bug. + +--- + ## Indoor walking issue cluster (2026-05-19) The Phase 2 indoor cell rendering fix (floor now renders inside buildings) diff --git a/docs/research/2026-05-19-indoor-followup-handoff.md b/docs/research/2026-05-19-indoor-followup-handoff.md index 2027c06..096ab00 100644 --- a/docs/research/2026-05-19-indoor-followup-handoff.md +++ b/docs/research/2026-05-19-indoor-followup-handoff.md @@ -28,7 +28,7 @@ The `WbMeshAdapter` also now injects a `ConsoleErrorLogger` ( - Indoor ambient color is now retail-faithful `(0.20, 0.20, 0.20)` — was guessed `(0.10, 0.09, 0.08)`. - Indoor lighting triggers off **player** cell, not camera cell — fixes "darker when camera enters" with third-person chase. -- WB submodule patched (`ObjectMeshManager.cs:1230` Setup-prefix guard at `TryGet`). Lives on `eriknihlen/WorldBuilder@acdream` at SHA `34460c4`. Submodule pointer in acdream's `main` advanced. +- WB submodule has a **one-line band-aid patch** (`ObjectMeshManager.cs:1230` Setup-prefix guard at `TryGet`) on `eriknihlen/WorldBuilder@acdream` at SHA `34460c4`. Submodule pointer in acdream's `main` is advanced. **This is a band-aid** — see `docs/ISSUES.md` #87 for the proper fix (switch to WB's narrower `PrepareEnvCellGeomMeshDataAsync` API). Retire the patch when that issue lands. ---