diff --git a/media/kit.png b/media/kit.png index c7370ca..4694366 100644 Binary files a/media/kit.png and b/media/kit.png differ diff --git a/models.lock.json b/models.lock.json index f6a3cb9..071b7f0 100644 --- a/models.lock.json +++ b/models.lock.json @@ -82,7 +82,7 @@ "address": "@medieval-kit/core", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T09:56:44.478Z", + "installedAt": "2026-08-23T10:14:43.273Z", "files": [ { "path": "src\\models\\medieval-kit\\core\\geometry.ts", @@ -602,11 +602,11 @@ "address": "@medieval-kit/forge-hearth", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T09:56:44.485Z", + "installedAt": "2026-08-23T10:14:43.277Z", "files": [ { "path": "src\\models\\medieval-kit\\forge-hearth\\model.ts", - "sourceHash": "8b200a9e702cae87dbae6aac609a0645863163f775bbff983ede45b72ed97fe4" + "sourceHash": "f504416897d439bd6069fbb796dcfff64df40b01465481880230027d03dabaf7" } ], "dependencies": [ diff --git a/my-registry/README.md b/my-registry/README.md index 1e801f0..445a0a5 100644 --- a/my-registry/README.md +++ b/my-registry/README.md @@ -64,11 +64,11 @@ did once. | `hand-cart` | Structure | 2044 | 4 | 0.88×1.03×2.60 | oak, iron | | | `vegetables` | Props | 1718 | 2 | 0.60×0.12×0.59 | produce | | | `round-shield` | Arms | 729 | 3 | 0.73×0.73×0.17 | oak, leather, iron | | -| `forge-hearth` | Smithy | 1354 | 4 | 2.14×1.78×0.87 | stone, char, ember, oak, leather, iron | | +| `forge-hearth` | Smithy | 1426 | 4 | 2.06×1.78×0.87 | stone, char, ember, oak, leather, iron | | | `stone-well` | Structure | 1376 | 4 | 1.88×2.00×1.28 | stone, oak, iron, cloth | | | `post-mill` | Structure | 1672 | 4 | 6.60×7.23×6.98 | oak, iron | | -**29 022 triangles** in total. The whole kit in one scene costs less than a +**29 094 triangles** in total. The whole kit in one scene costs less than a single mid-complexity character model. Every model depends on `@medieval-kit/core`, a shared support item holding the diff --git a/my-registry/models/forge-hearth/model.ts b/my-registry/models/forge-hearth/model.ts index 790f775..1d9bdf0 100644 --- a/my-registry/models/forge-hearth/model.ts +++ b/my-registry/models/forge-hearth/model.ts @@ -28,9 +28,10 @@ * blocks go where they are read, which is the kerb around the fire and the top * course of the walls, and the body below is a roughened slab. */ -import { type BufferGeometry } from 'three' +import { Color, type BufferGeometry } from 'three' import { + boxGeometry, createKitModel, dishedSheetGeometry, createTinter, @@ -292,22 +293,30 @@ export function createModel(overrides: Partial = {}) { g.rotateY(-Math.PI / 2) return g } - // `w` scales the LENGTH as well as the width, and it has to. + // Width and LENGTH scale separately, because they mean opposite things. // - // Sized only across, every plate -- both boards, the gusset and both ribs - // -- ran to exactly the same back edge, and five end caps in one plane is - // five coplanar faces. Scaling both ways staggers those edges and is also - // the truer shape: a rib that swells wider swells longer with it. - const teardrop = (w: number, t: number): SheetLevel[] => [ + // One `w` drove both, which was how the five plates got their end caps + // out of a common plane -- five coplanar faces is five z-fighting faces. + // But it also meant the fix for the leather being too NARROW made it + // longer in the same breath, and the bag ended up running a third of its + // length past the boards it is nailed to. Leather cannot outrun its + // boards: they are what it is fastened to. + // + // So the leather is wider (1.18 to 1.33) and SHORTER (0.82 to 0.9) than + // the boards, which is the real thing -- the hide is tacked inboard of + // the board edges -- and it staggers the caps further apart than the old + // scheme managed, because now they are spread on purpose rather than as + // a by-product of the width. + const teardrop = (w: number, t: number, len: number): SheetLevel[] => [ { y: 0, halfWidth: bellowsW * 0.15 * w, thickness: t, curve: 0 }, - { y: bellowsL * 0.28 * w, halfWidth: bellowsW * 0.4 * w, thickness: t, curve: 0 }, - { y: bellowsL * 0.72 * w, halfWidth: bellowsW * 0.5 * w, thickness: t * 0.95, curve: 0 }, - { y: bellowsL * w, halfWidth: bellowsW * 0.38 * w, thickness: t * 0.9, curve: 0 }, + { y: bellowsL * 0.28 * len, halfWidth: bellowsW * 0.4 * w, thickness: t, curve: 0 }, + { y: bellowsL * 0.72 * len, halfWidth: bellowsW * 0.5 * w, thickness: t * 0.95, curve: 0 }, + { y: bellowsL * len, halfWidth: bellowsW * 0.38 * w, thickness: t * 0.9, curve: 0 }, ] for (const [board, at] of [[0, -1], [1, 1]] as const) { timber.push(lay(dishedSheetGeometry( - teardrop(board === 0 ? 1 : 0.97, D * 0.035), 5, + teardrop(board === 0 ? 1 : 0.97, D * 0.035, board === 0 ? 1 : 0.97), 5, tint('oak', (board === 0 ? 0.03 : -0.04) + jitter(random, 0.04)), // The nose is staggered as well as the tail. Scaling the plates only // spread their BACK edges; they all still began at y = 0, so after @@ -325,11 +334,11 @@ export function createModel(overrides: Partial = {}) { // daylight between; a bellows is a bag under pressure and its widest // point is the leather, not the wood. hide.push(lay(dishedSheetGeometry( - teardrop(1.18, D * 0.235), 5, tint('leather', -0.06, 0.9), + teardrop(1.18, D * 0.235, 0.9), 5, tint('leather', -0.06, 0.9), )).translate(bx + D * 0.032, bellowsY, 0)) for (const [i, at] of [-0.34, 0.34].entries()) { hide.push(lay(dishedSheetGeometry( - teardrop(1.26 + i * 0.07, D * 0.03), 5, + teardrop(1.26 + i * 0.07, D * 0.03, 0.82 + i * 0.04), 5, tint('leather', -0.01 + i * 0.04, 0.9), )).translate(bx + D * (0.022 + i * 0.019), bellowsY + at * D * 0.11, 0)) } @@ -344,8 +353,58 @@ export function createModel(overrides: Partial = {}) { 8, [0, 0, 0], tint('iron', 0.02, 0.7), ).rotateZ(Math.PI / 2).translate(bx - wall * 0.4, bellowsY, 0)) - // Post and lever. - const postX = bx + bellowsL * 0.16 + // --- The bench it rests on ------------------------------------------- + // + // The bellows was cantilevered off one post driven through its middle: a + // leather bag the size of a door hanging in the air with four fifths of + // it past its only prop. The support check passed it, because the post + // reaches the floor and the nose touches the wall, so the thing IS + // connected to the ground -- which is not the same as looking like it + // could hold itself up, and looking like it can is the whole rule. + // + // A great bellows sat on a low timber bench: two bearers let into the + // forge wall at one end and carried on legs at the other, with a rail + // across their tail. Six plain boxes, no rotations, and the bag now lies + // on something along its whole length. + const beamZ = bellowsW * 0.34 + const beamW = D * 0.075 + // Measured off the underside of the LOWER board rather than guessed: the + // boards, the gusset and the ribs all sit at different heights and which + // of them hangs lowest is not worth deriving twice. + const beamTop = bellowsY - D * 0.11 - D * 0.0175 + D * 0.008 + const beamY = beamTop - beamW / 2 + const frameTail = bx + bellowsL * 1.06 + const beamNose = bx - wall * 0.35 + + for (const side of [-1, 1] as const) { + // Let INTO the masonry by a third of the wall, not butted against its + // face. A bearer that stops at the wall is a bearer resting on nothing. + timber.push(boxGeometry( + [frameTail + D * 0.06 - beamNose, beamW, beamW], + [(beamNose + frameTail + D * 0.06) / 2, beamY, side * beamZ], + new Color(tint('oak', -0.05 + jitter(random, 0.04))), + )) + } + // The tail rail, run PAST the bearers on both sides. Ended flush with + // them, its end caps would have been coplanar with their outer faces. + timber.push(boxGeometry( + [D * 0.05, D * 0.07, (beamZ + beamW) * 2], + [frameTail, beamY, 0], + new Color(tint('oak', -0.09)), + )) + const legTop = beamY + beamW * 0.3 + for (const side of [-1, 1] as const) { + timber.push(boxGeometry( + [D * 0.055, legTop - floor, D * 0.045], + [bx + bellowsL * 1.03, (floor + legTop) / 2, side * beamZ], + new Color(tint('oak', -0.12 + jitter(random, 0.03))), + )) + } + + // --- Post and lever --------------------------------------------------- + // The post stands BEYOND the tail, clear of everything. At 0.16 of the + // bellows' length it was driven straight through the bag. + const postX = bx + bellowsL * 1.16 const postTop = floor + bodyTop + H * 0.42 timber.push(taperedBoxGeometry( [D * 0.07, D * 0.07], @@ -363,8 +422,8 @@ export function createModel(overrides: Partial = {}) { // a piece on the wrong axis, so it is built the plain way: the helper // gives a bar along Y, and a single turn about Z lays it along X with // its tilt folded into the same angle. - const leverLength = bellowsL * 1.02 - const leverTilt = 0.26 + const leverLength = bellowsL * 1.12 + const leverTilt = 0.24 const lever = taperedBoxGeometry( [D * 0.055, D * 0.05], [D * 0.045, D * 0.045], @@ -373,14 +432,38 @@ export function createModel(overrides: Partial = {}) { tint('oak', 0.05), ) lever.rotateZ(Math.PI / 2 + leverTilt) - // Pivots ON the post and reaches back over the bellows' broad end. + // Pivots on the post and reaches back over the bellows TOWARDS the fire, + // falling as it goes, because the end the smith pulls is the end he can + // reach standing at the hearth. It used to run the other way, out into + // open air away from everything. + // + // 0.42 of the length rather than 0.46: the short arm has to poke a good + // way past the post, or its end cap sits a couple of millimetres off the + // post's own face and the two fight. + const pivotY = postTop - D * 0.06 lever.translate( - postX + Math.cos(leverTilt) * leverLength * 0.46, - postTop - D * 0.06 - Math.sin(leverTilt) * leverLength * 0.46, + postX - Math.cos(leverTilt) * leverLength * 0.42, + pivotY - Math.sin(leverTilt) * leverLength * 0.42, 0, ) timber.push(lever) + // The link, which is what makes it a lever rather than a stick. + // + // A rocker with no connection to the top board does not work the bellows, + // it just hangs over it. This is the rod through the board, and it is + // also the only thing tying the two halves of the assembly together to + // the eye. + const linkX = bx + bellowsL * 0.8 + const leverY = pivotY - (postX - linkX) * Math.tan(leverTilt) + const linkFoot = bellowsY + D * 0.1 + const linkHead = leverY - D * 0.013 + metal.push(boxGeometry( + [D * 0.022, linkHead - linkFoot, D * 0.022], + [linkX, (linkFoot + linkHead) / 2, 0], + new Color(tint('iron', -0.02, 0.7)), + )) + return { hearth: { slot: 'stone' as const, geometry: hearth }, fire: { diff --git a/src/models/medieval-kit/forge-hearth/model.ts b/src/models/medieval-kit/forge-hearth/model.ts index 790f775..1d9bdf0 100644 --- a/src/models/medieval-kit/forge-hearth/model.ts +++ b/src/models/medieval-kit/forge-hearth/model.ts @@ -28,9 +28,10 @@ * blocks go where they are read, which is the kerb around the fire and the top * course of the walls, and the body below is a roughened slab. */ -import { type BufferGeometry } from 'three' +import { Color, type BufferGeometry } from 'three' import { + boxGeometry, createKitModel, dishedSheetGeometry, createTinter, @@ -292,22 +293,30 @@ export function createModel(overrides: Partial = {}) { g.rotateY(-Math.PI / 2) return g } - // `w` scales the LENGTH as well as the width, and it has to. + // Width and LENGTH scale separately, because they mean opposite things. // - // Sized only across, every plate -- both boards, the gusset and both ribs - // -- ran to exactly the same back edge, and five end caps in one plane is - // five coplanar faces. Scaling both ways staggers those edges and is also - // the truer shape: a rib that swells wider swells longer with it. - const teardrop = (w: number, t: number): SheetLevel[] => [ + // One `w` drove both, which was how the five plates got their end caps + // out of a common plane -- five coplanar faces is five z-fighting faces. + // But it also meant the fix for the leather being too NARROW made it + // longer in the same breath, and the bag ended up running a third of its + // length past the boards it is nailed to. Leather cannot outrun its + // boards: they are what it is fastened to. + // + // So the leather is wider (1.18 to 1.33) and SHORTER (0.82 to 0.9) than + // the boards, which is the real thing -- the hide is tacked inboard of + // the board edges -- and it staggers the caps further apart than the old + // scheme managed, because now they are spread on purpose rather than as + // a by-product of the width. + const teardrop = (w: number, t: number, len: number): SheetLevel[] => [ { y: 0, halfWidth: bellowsW * 0.15 * w, thickness: t, curve: 0 }, - { y: bellowsL * 0.28 * w, halfWidth: bellowsW * 0.4 * w, thickness: t, curve: 0 }, - { y: bellowsL * 0.72 * w, halfWidth: bellowsW * 0.5 * w, thickness: t * 0.95, curve: 0 }, - { y: bellowsL * w, halfWidth: bellowsW * 0.38 * w, thickness: t * 0.9, curve: 0 }, + { y: bellowsL * 0.28 * len, halfWidth: bellowsW * 0.4 * w, thickness: t, curve: 0 }, + { y: bellowsL * 0.72 * len, halfWidth: bellowsW * 0.5 * w, thickness: t * 0.95, curve: 0 }, + { y: bellowsL * len, halfWidth: bellowsW * 0.38 * w, thickness: t * 0.9, curve: 0 }, ] for (const [board, at] of [[0, -1], [1, 1]] as const) { timber.push(lay(dishedSheetGeometry( - teardrop(board === 0 ? 1 : 0.97, D * 0.035), 5, + teardrop(board === 0 ? 1 : 0.97, D * 0.035, board === 0 ? 1 : 0.97), 5, tint('oak', (board === 0 ? 0.03 : -0.04) + jitter(random, 0.04)), // The nose is staggered as well as the tail. Scaling the plates only // spread their BACK edges; they all still began at y = 0, so after @@ -325,11 +334,11 @@ export function createModel(overrides: Partial = {}) { // daylight between; a bellows is a bag under pressure and its widest // point is the leather, not the wood. hide.push(lay(dishedSheetGeometry( - teardrop(1.18, D * 0.235), 5, tint('leather', -0.06, 0.9), + teardrop(1.18, D * 0.235, 0.9), 5, tint('leather', -0.06, 0.9), )).translate(bx + D * 0.032, bellowsY, 0)) for (const [i, at] of [-0.34, 0.34].entries()) { hide.push(lay(dishedSheetGeometry( - teardrop(1.26 + i * 0.07, D * 0.03), 5, + teardrop(1.26 + i * 0.07, D * 0.03, 0.82 + i * 0.04), 5, tint('leather', -0.01 + i * 0.04, 0.9), )).translate(bx + D * (0.022 + i * 0.019), bellowsY + at * D * 0.11, 0)) } @@ -344,8 +353,58 @@ export function createModel(overrides: Partial = {}) { 8, [0, 0, 0], tint('iron', 0.02, 0.7), ).rotateZ(Math.PI / 2).translate(bx - wall * 0.4, bellowsY, 0)) - // Post and lever. - const postX = bx + bellowsL * 0.16 + // --- The bench it rests on ------------------------------------------- + // + // The bellows was cantilevered off one post driven through its middle: a + // leather bag the size of a door hanging in the air with four fifths of + // it past its only prop. The support check passed it, because the post + // reaches the floor and the nose touches the wall, so the thing IS + // connected to the ground -- which is not the same as looking like it + // could hold itself up, and looking like it can is the whole rule. + // + // A great bellows sat on a low timber bench: two bearers let into the + // forge wall at one end and carried on legs at the other, with a rail + // across their tail. Six plain boxes, no rotations, and the bag now lies + // on something along its whole length. + const beamZ = bellowsW * 0.34 + const beamW = D * 0.075 + // Measured off the underside of the LOWER board rather than guessed: the + // boards, the gusset and the ribs all sit at different heights and which + // of them hangs lowest is not worth deriving twice. + const beamTop = bellowsY - D * 0.11 - D * 0.0175 + D * 0.008 + const beamY = beamTop - beamW / 2 + const frameTail = bx + bellowsL * 1.06 + const beamNose = bx - wall * 0.35 + + for (const side of [-1, 1] as const) { + // Let INTO the masonry by a third of the wall, not butted against its + // face. A bearer that stops at the wall is a bearer resting on nothing. + timber.push(boxGeometry( + [frameTail + D * 0.06 - beamNose, beamW, beamW], + [(beamNose + frameTail + D * 0.06) / 2, beamY, side * beamZ], + new Color(tint('oak', -0.05 + jitter(random, 0.04))), + )) + } + // The tail rail, run PAST the bearers on both sides. Ended flush with + // them, its end caps would have been coplanar with their outer faces. + timber.push(boxGeometry( + [D * 0.05, D * 0.07, (beamZ + beamW) * 2], + [frameTail, beamY, 0], + new Color(tint('oak', -0.09)), + )) + const legTop = beamY + beamW * 0.3 + for (const side of [-1, 1] as const) { + timber.push(boxGeometry( + [D * 0.055, legTop - floor, D * 0.045], + [bx + bellowsL * 1.03, (floor + legTop) / 2, side * beamZ], + new Color(tint('oak', -0.12 + jitter(random, 0.03))), + )) + } + + // --- Post and lever --------------------------------------------------- + // The post stands BEYOND the tail, clear of everything. At 0.16 of the + // bellows' length it was driven straight through the bag. + const postX = bx + bellowsL * 1.16 const postTop = floor + bodyTop + H * 0.42 timber.push(taperedBoxGeometry( [D * 0.07, D * 0.07], @@ -363,8 +422,8 @@ export function createModel(overrides: Partial = {}) { // a piece on the wrong axis, so it is built the plain way: the helper // gives a bar along Y, and a single turn about Z lays it along X with // its tilt folded into the same angle. - const leverLength = bellowsL * 1.02 - const leverTilt = 0.26 + const leverLength = bellowsL * 1.12 + const leverTilt = 0.24 const lever = taperedBoxGeometry( [D * 0.055, D * 0.05], [D * 0.045, D * 0.045], @@ -373,14 +432,38 @@ export function createModel(overrides: Partial = {}) { tint('oak', 0.05), ) lever.rotateZ(Math.PI / 2 + leverTilt) - // Pivots ON the post and reaches back over the bellows' broad end. + // Pivots on the post and reaches back over the bellows TOWARDS the fire, + // falling as it goes, because the end the smith pulls is the end he can + // reach standing at the hearth. It used to run the other way, out into + // open air away from everything. + // + // 0.42 of the length rather than 0.46: the short arm has to poke a good + // way past the post, or its end cap sits a couple of millimetres off the + // post's own face and the two fight. + const pivotY = postTop - D * 0.06 lever.translate( - postX + Math.cos(leverTilt) * leverLength * 0.46, - postTop - D * 0.06 - Math.sin(leverTilt) * leverLength * 0.46, + postX - Math.cos(leverTilt) * leverLength * 0.42, + pivotY - Math.sin(leverTilt) * leverLength * 0.42, 0, ) timber.push(lever) + // The link, which is what makes it a lever rather than a stick. + // + // A rocker with no connection to the top board does not work the bellows, + // it just hangs over it. This is the rod through the board, and it is + // also the only thing tying the two halves of the assembly together to + // the eye. + const linkX = bx + bellowsL * 0.8 + const leverY = pivotY - (postX - linkX) * Math.tan(leverTilt) + const linkFoot = bellowsY + D * 0.1 + const linkHead = leverY - D * 0.013 + metal.push(boxGeometry( + [D * 0.022, linkHead - linkFoot, D * 0.022], + [linkX, (linkFoot + linkHead) / 2, 0], + new Color(tint('iron', -0.02, 0.7)), + )) + return { hearth: { slot: 'stone' as const, geometry: hearth }, fire: {