docs: update mesh, viewers, and selection decisions

Document the separated front/back/walls extrusion, material-level back
flips, CardID sprite selection from the parent deck, index-path tree
selection, and the Bounds-inside-Suspense camera fit.
This commit is contained in:
2026-08-08 18:18:22 +08:00
parent ead2ba8c57
commit 12418898d0
3 changed files with 105 additions and 18 deletions
+25 -14
View File
@@ -205,16 +205,20 @@ Isomorphic analysis of a parsed `TTSMod`. No Node-specific APIs.
`scaleShape` and `signedArea`.
- `tessellate.ts`
- `triangulate(shape)` — earcut triangulation (same as three.js).
- `capFaces(shape, height, uvScale, uvBounds)` — top/bottom faces. UVs map
the shape's bounding box (or `uvBounds` framing) to the unit square; the
bottom face uses the same planar xy mapping as the top (no mirror).
- `frontFaces(shape, height, uvScale, uvBounds)` — top face, normal +Z.
- `backFaces(shape, height, uvScale, uvBounds)` — bottom face, normal -Z.
UVs map the shape's bounding box (or `uvBounds` framing) to the unit
square; the back uses the same planar xy mapping as the front (no mirror).
- `capFaces(...)` — front + back merged into one geometry (front vertices
first, then back).
- `walls.ts`
- `wallFaces(shape, height, uvScale, uvBounds)` — side walls with outward
normals and planar xy UVs (z-independent).
- `extrude.ts`
- `extrudeShape(shape, options)` — merged caps + walls as one geometry.
- `extrudeShapeParts(shape, options)` — caps and walls as separate
geometries (for distinct materials).
- `extrudeShape(shape, options)` — merged front + back + walls as one
geometry.
- `extrudeShapeParts(shape, options)` — `{ front, back, walls }` as separate
geometries, so each face can carry its own material.
- `ExtrudeOptions` — `height`, `capUvScale`, `wallUvScale`, `uvBounds`.
- `types.ts`
- `FaceGeometry`, `ExtrudedGeometry`, `UVBounds`.
@@ -278,7 +282,8 @@ proxy API and `packages/extract` directly for analysis.
- `components/SearchResults.tsx` — result grid + pagination.
- `components/ObjectTree.tsx` — recursive tree sidebar; each entry shows a
class icon (hover for the class name) + display label, indented by depth.
Clicking selects an object.
Clicking selects an object by its unique index path (not GUID — cards in a
deck share the deck's GUID).
- `components/viewers.tsx` — viewer registry (`registerViewer` /
`resolveViewer`) plus a `DefaultViewer` that renders an object's fields;
custom per-class viewers can be registered later.
@@ -286,13 +291,19 @@ proxy API and `packages/extract` directly for analysis.
`@react-three/drei`, and `@react-three/postprocessing`. `register.ts`
registers lazy-loaded viewers for `Tile`/`Custom_Tile` (flat box),
`Custom_Token` (shape traced from the image's alpha channel via `/trace`,
extruded with `@tts/mesh`), `Card`/`Deck`/`Custom_Deck` (thin box with
face/back textures), and `Custom_Model`/`Custom_Model_Bag`/
`Custom_Model_Infinite_Bag` (GLTF/OBJ/FBX from `CustomMesh.MeshURL`).
`Scene.tsx` is a shared canvas with lighting, orbit controls, contact
shadows, and subtle bloom/vignette. `assetUrl.ts` routes asset URLs through
the proxy for CORS-safe loading. The viewers are lazy-loaded so the three.js
stack is code-split out of the main bundle.
extruded with `@tts/mesh`), `Card`/`CardCustom`/`Deck`/`DeckCustom`/
`Custom_Deck` (thin rounded rect with face/back textures), and
`Custom_Model`/`Custom_Model_Bag`/`Custom_Model_Infinite_Bag` (GLTF/OBJ/FBX
from `CustomMesh.MeshURL`). Viewers build `{ front, back, walls }` geometry
via `extrudeShapeParts`; back faces are flipped left/right on the material
(`flipTexture.ts`) so they aren't mirrored, and card faces slice the deck
sprite sheet via `CardID` (`cardResolution.ts`). `Scene.tsx` is a shared
canvas with lighting, orbit controls, contact shadows, and subtle
bloom/vignette; it fits the camera to the object's bounds via drei's
`Bounds` inside the Suspense boundary, so it frames the loaded content.
`assetUrl.ts` routes asset URLs through the proxy for CORS-safe loading.
The viewers are lazy-loaded so the three.js stack is code-split out of the
main bundle.
- `components/objectIcons.tsx` — maps TTS object classes to one or more
Iconify icons (`iconsForObject`); unknown classes fall back to a help icon.
Icons may come from multiple sets (mdi, material-symbols, file-icons, ...);