feat(tile): render tiles with the mesh generator

Replace the per-shape tile geometries with @tts/mesh extrusion, honoring
the tile type and stretch aspect ratio. Add extrudeShapeParts so the
caps carry the texture while the walls are solid white, matching TTS
tinting. Fix bottom-face UVs to mirror horizontally and make wall UVs
inherit the front mapping independent of z.
This commit is contained in:
2026-08-08 14:21:53 +08:00
parent 14f83f476c
commit d554d6bde1
11 changed files with 246 additions and 45 deletions
+14
View File
@@ -6,6 +6,7 @@ import {
polygonShape,
rectShape,
roundedRectShape,
scaleShape,
shapeFromThree,
signedArea,
} from './shapes.js';
@@ -67,6 +68,19 @@ describe('shape generators', () => {
expect(signedArea(s.holes![0]!)).toBeLessThan(0);
});
it('scaleShape scales outline and holes', () => {
const s = scaleShape(rectShape(2, 2), 2, 3);
expect(s.outline).toEqual([
[-2, -3],
[2, -3],
[2, 3],
[-2, 3],
]);
const framed = scaleShape(frameShape(4, 4, 2), 2, 2);
expect(framed.holes).toHaveLength(1);
expect(framed.holes![0]![0]).toEqual([-2, -2]);
});
it('shapeFromThree converts three.js vectors', () => {
const fake = {
getPoints: () => [