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:
@@ -27,12 +27,17 @@ describe('wallFaces', () => {
|
||||
expect(wall.positions[5]).toBe(3);
|
||||
});
|
||||
|
||||
it('maps u across the perimeter and v up the height', () => {
|
||||
it('uses planar UVs from the top face mapping, independent of z', () => {
|
||||
const wall = wallFaces(rectShape(2, 2), 2);
|
||||
// u starts at 0 for the first outline point.
|
||||
// First outline point is (-1,-1) -> planar UV (0, 0).
|
||||
expect(wall.uvs[0]).toBeCloseTo(0, 5);
|
||||
// v goes 0 -> 1 from bottom to top.
|
||||
expect(wall.uvs[1]).toBeCloseTo(0, 5);
|
||||
expect(wall.uvs[3]).toBeCloseTo(1, 5);
|
||||
// The bottom and top vertices of the same outline point share a UV,
|
||||
// so the texture is constant down the wall regardless of z.
|
||||
expect(wall.uvs[2]).toBeCloseTo(wall.uvs[0]!, 5);
|
||||
expect(wall.uvs[3]).toBeCloseTo(wall.uvs[1]!, 5);
|
||||
// Third outline point is (1, 1) -> planar UV (1, 1).
|
||||
expect(wall.uvs[8]).toBeCloseTo(1, 5);
|
||||
expect(wall.uvs[9]).toBeCloseTo(1, 5);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user