diff --git a/models.lock.json b/models.lock.json index 424377a..3663745 100644 --- a/models.lock.json +++ b/models.lock.json @@ -67,7 +67,7 @@ "address": "@medieval-kit/wooden-barrel", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.688Z", + "installedAt": "2026-08-23T04:12:22.217Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-barrel\\model.ts", @@ -82,7 +82,7 @@ "address": "@medieval-kit/core", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.667Z", + "installedAt": "2026-08-23T04:12:22.197Z", "files": [ { "path": "src\\models\\medieval-kit\\core\\geometry.ts", @@ -129,7 +129,7 @@ "address": "@medieval-kit/wooden-crate", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.693Z", + "installedAt": "2026-08-23T04:12:22.221Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-crate\\model.ts", @@ -144,7 +144,7 @@ "address": "@medieval-kit/kit", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.700Z", + "installedAt": "2026-08-23T04:12:22.227Z", "files": [], "dependencies": [] }, @@ -152,11 +152,11 @@ "address": "@medieval-kit/iron-anvil", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.676Z", + "installedAt": "2026-08-23T04:12:22.206Z", "files": [ { "path": "src\\models\\medieval-kit\\iron-anvil\\model.ts", - "sourceHash": "2e69721ea4901be21abb2b99011be74fa197335060655784a8b070a6287ef3d7" + "sourceHash": "ba54f7501a2b60047327567f22c2b206dd4471d25e69b52fee23f10905d9bb05" } ], "dependencies": [ @@ -167,7 +167,7 @@ "address": "@medieval-kit/wooden-bucket", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.690Z", + "installedAt": "2026-08-23T04:12:22.219Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-bucket\\model.ts", @@ -182,7 +182,7 @@ "address": "@medieval-kit/wooden-fence", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.694Z", + "installedAt": "2026-08-23T04:12:22.222Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-fence\\model.ts", @@ -197,7 +197,7 @@ "address": "@medieval-kit/wooden-hoe", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.695Z", + "installedAt": "2026-08-23T04:12:22.223Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-hoe\\model.ts", @@ -212,7 +212,7 @@ "address": "@medieval-kit/wooden-ladder", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.696Z", + "installedAt": "2026-08-23T04:12:22.224Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-ladder\\model.ts", @@ -227,7 +227,7 @@ "address": "@medieval-kit/wooden-pitchfork", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.697Z", + "installedAt": "2026-08-23T04:12:22.226Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-pitchfork\\model.ts", @@ -242,7 +242,7 @@ "address": "@medieval-kit/wooden-shovel", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.698Z", + "installedAt": "2026-08-23T04:12:22.227Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-shovel\\model.ts", @@ -257,7 +257,7 @@ "address": "@medieval-kit/wooden-stool", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.700Z", + "installedAt": "2026-08-23T04:12:22.227Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-stool\\model.ts", @@ -272,7 +272,7 @@ "address": "@medieval-kit/cart-wheel", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.671Z", + "installedAt": "2026-08-23T04:12:22.201Z", "files": [ { "path": "src\\models\\medieval-kit\\cart-wheel\\model.ts", @@ -287,7 +287,7 @@ "address": "@medieval-kit/log-pile", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.680Z", + "installedAt": "2026-08-23T04:12:22.210Z", "files": [ { "path": "src\\models\\medieval-kit\\log-pile\\model.ts", @@ -302,7 +302,7 @@ "address": "@medieval-kit/trestle-table", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.686Z", + "installedAt": "2026-08-23T04:12:22.215Z", "files": [ { "path": "src\\models\\medieval-kit\\trestle-table\\model.ts", @@ -317,7 +317,7 @@ "address": "@medieval-kit/wooden-chest", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.691Z", + "installedAt": "2026-08-23T04:12:22.221Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-chest\\model.ts", @@ -332,7 +332,7 @@ "address": "@medieval-kit/hay-bale", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.674Z", + "installedAt": "2026-08-23T04:12:22.205Z", "files": [ { "path": "src\\models\\medieval-kit\\hay-bale\\model.ts", @@ -347,7 +347,7 @@ "address": "@medieval-kit/pitch-torch", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.682Z", + "installedAt": "2026-08-23T04:12:22.212Z", "files": [ { "path": "src\\models\\medieval-kit\\pitch-torch\\model.ts", @@ -362,7 +362,7 @@ "address": "@medieval-kit/wooden-bench", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.689Z", + "installedAt": "2026-08-23T04:12:22.218Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-bench\\model.ts", @@ -377,7 +377,7 @@ "address": "@medieval-kit/linen-sack", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.679Z", + "installedAt": "2026-08-23T04:12:22.209Z", "files": [ { "path": "src\\models\\medieval-kit\\linen-sack\\model.ts", @@ -392,7 +392,7 @@ "address": "@medieval-kit/oak-tankard", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.681Z", + "installedAt": "2026-08-23T04:12:22.211Z", "files": [ { "path": "src\\models\\medieval-kit\\oak-tankard\\model.ts", @@ -407,7 +407,7 @@ "address": "@medieval-kit/straw-broom", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.683Z", + "installedAt": "2026-08-23T04:12:22.213Z", "files": [ { "path": "src\\models\\medieval-kit\\straw-broom\\model.ts", @@ -422,7 +422,7 @@ "address": "@medieval-kit/bronze-bell", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.669Z", + "installedAt": "2026-08-23T04:12:22.200Z", "files": [ { "path": "src\\models\\medieval-kit\\bronze-bell\\model.ts", @@ -437,7 +437,7 @@ "address": "@medieval-kit/iron-lantern", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.677Z", + "installedAt": "2026-08-23T04:12:22.207Z", "files": [ { "path": "src\\models\\medieval-kit\\iron-lantern\\model.ts", @@ -452,7 +452,7 @@ "address": "@medieval-kit/tavern-sign", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.685Z", + "installedAt": "2026-08-23T04:12:22.214Z", "files": [ { "path": "src\\models\\medieval-kit\\tavern-sign\\model.ts", @@ -467,7 +467,7 @@ "address": "@medieval-kit/coin-pouch", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.672Z", + "installedAt": "2026-08-23T04:12:22.202Z", "files": [ { "path": "src\\models\\medieval-kit\\coin-pouch\\model.ts", @@ -482,7 +482,7 @@ "address": "@medieval-kit/glass-phial", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.673Z", + "installedAt": "2026-08-23T04:12:22.204Z", "files": [ { "path": "src\\models\\medieval-kit\\glass-phial\\model.ts", @@ -497,7 +497,7 @@ "address": "@medieval-kit/leather-book", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.678Z", + "installedAt": "2026-08-23T04:12:22.208Z", "files": [ { "path": "src\\models\\medieval-kit\\leather-book\\model.ts", @@ -512,7 +512,7 @@ "address": "@medieval-kit/wicker-basket", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T04:07:08.687Z", + "installedAt": "2026-08-23T04:12:22.216Z", "files": [ { "path": "src\\models\\medieval-kit\\wicker-basket\\model.ts", diff --git a/my-registry/meta.ts b/my-registry/meta.ts index 4afd1e0..ec87467 100644 --- a/my-registry/meta.ts +++ b/my-registry/meta.ts @@ -196,8 +196,8 @@ export const MODEL_META: Readonly> = { hornReach: { type: 'number', label: 'Horn reach', min: 0.2, max: 0.8, step: 0.02 }, seed: { type: 'number', label: 'Variation seed', min: 1, max: 64, step: 1 }, }, - materialSlots: ['iron', 'steel'], - parts: ['base', 'waist', 'body', 'face', 'horn'], + materialSlots: ['iron', 'steel', 'oak'], + parts: ['base', 'waist', 'body', 'face', 'horn', 'stump'], }, 'cart-wheel': { title: 'Cart Wheel', diff --git a/my-registry/models/iron-anvil/model.ts b/my-registry/models/iron-anvil/model.ts index 5ceb2e0..824112d 100644 --- a/my-registry/models/iron-anvil/model.ts +++ b/my-registry/models/iron-anvil/model.ts @@ -12,6 +12,9 @@ import { Color } from 'three' import { chamferedBoxGeometry, createKitModel, + createTinter, + prismGeometry, + roughenGeometry, jitter, MEDIEVAL_PALETTE, mergeColoured, @@ -38,13 +41,13 @@ export const ironAnvilDefaults: IronAnvilConfig = { seed: 9, } -export type IronAnvilParts = 'base' | 'waist' | 'body' | 'face' | 'horn' +export type IronAnvilParts = 'base' | 'waist' | 'body' | 'face' | 'horn' | 'stump' export function createModel(overrides: Partial = {}) { - return createKitModel({ + return createKitModel({ id: 'iron-anvil', defaults: ironAnvilDefaults, - slots: ['iron', 'steel'], + slots: ['iron', 'steel', 'oak'], build: ({ config, random }) => { const tint = new Color() const shade = (amount = 0.05): Color => { @@ -134,7 +137,47 @@ export function createModel(overrides: Partial = {}) { // surface ends up coplanar with the body (the z-fighting rule). horn.translate(config.faceLength * 0.31 + reach / 2 - config.faceWidth * 0.35, bodyY + bodyHeight * 0.12, 0) + // --- Stump --------------------------------------------------------- + // An anvil is used ON something. It is bedded into the end grain of a + // log so the block takes the ring out of it and puts the face at the + // smith's knuckle height; the file header has said the model "comes to + // ~0.75 m with a real anvil stump" for as long as it has existed, while + // shipping the 0.34 m anvil on its own, lying on the floor. + // + // It is its own part, so anyone who wants the bare anvil for their own + // bench hides `parts.stump` -- the same arrangement as the bell's frame. + const stumpTop = -half + config.height * 0.06 + const stumpHeight = config.height * 1.2 + // Nearly as wide as the anvil is long. A block the anvil overhangs looks + // like it would tip the first time anyone swung at it; a chopping block + // is a section of trunk, chosen fat. + const stumpRadius = config.faceLength * 0.42 + const woodTint = createTinter(random) + // BOTH colours copied out before either is read. + // + // `createTinter` returns the same Color object on every call -- its own + // docstring says so -- so passing two tints as arguments to one call + // hands the callee the same object twice, holding whichever value was + // computed last. The block came out painted in end-grain on every face, + // which is why it rendered pale. + const side = new Color(woodTint('oak', -0.26)) + const endGrain = new Color(woodTint('oakEnd', -0.16)) + const stump = prismGeometry( + stumpRadius * 1.1, + stumpRadius, + stumpHeight, + 9, + [0, stumpTop - stumpHeight / 2, 0], + side, + { colourTop: endGrain }, + ) + // Split and weathered, the way a chopping block always is. Kept small: + // the block reads by its mass, and the anvil sitting square on it is the + // detail that matters. + roughenGeometry(stump, stumpRadius * 0.035, { salt: 5, scaleY: 0.3 }) + return { + stump: { slot: 'oak', geometry: stump }, base: { slot: 'iron', geometry: base }, waist: { slot: 'iron', geometry: waist }, body: { slot: 'iron', geometry: body }, diff --git a/scripts/verify-model.ts b/scripts/verify-model.ts index 5c6d3b7..5d69f28 100644 --- a/scripts/verify-model.ts +++ b/scripts/verify-model.ts @@ -299,7 +299,7 @@ const CASES: readonly Case[] = [ parts: 4, ownSlot: 'iron', borrowSlot: 'oak', radial: true, radialPart: 'staves', variants: [{ handle: 0 }, { hoopCount: 0 }] , maxSize: [0.45, 0.6, 0.45] }, { id: 'iron-anvil', make: as(createAnvil), patch: { hornReach: 0.7 }, - parts: 5, ownSlot: 'steel', borrowSlot: 'iron', closed: true , maxSize: [0.6, 0.5, 0.3] }, + parts: 6, ownSlot: 'steel', borrowSlot: 'iron', closed: true , maxSize: [0.6, 0.85, 0.42] }, { id: 'wooden-ladder', make: as(createLadder), patch: { rungCount: 12 }, parts: 2, ownSlot: 'oak', borrowSlot: 'oak', closed: true, variants: [{ rungCount: 3 }, { taper: 0 }] , maxSize: [0.6, 2.4, 0.12] }, diff --git a/src/models/medieval-kit/iron-anvil/model.ts b/src/models/medieval-kit/iron-anvil/model.ts index 5ceb2e0..824112d 100644 --- a/src/models/medieval-kit/iron-anvil/model.ts +++ b/src/models/medieval-kit/iron-anvil/model.ts @@ -12,6 +12,9 @@ import { Color } from 'three' import { chamferedBoxGeometry, createKitModel, + createTinter, + prismGeometry, + roughenGeometry, jitter, MEDIEVAL_PALETTE, mergeColoured, @@ -38,13 +41,13 @@ export const ironAnvilDefaults: IronAnvilConfig = { seed: 9, } -export type IronAnvilParts = 'base' | 'waist' | 'body' | 'face' | 'horn' +export type IronAnvilParts = 'base' | 'waist' | 'body' | 'face' | 'horn' | 'stump' export function createModel(overrides: Partial = {}) { - return createKitModel({ + return createKitModel({ id: 'iron-anvil', defaults: ironAnvilDefaults, - slots: ['iron', 'steel'], + slots: ['iron', 'steel', 'oak'], build: ({ config, random }) => { const tint = new Color() const shade = (amount = 0.05): Color => { @@ -134,7 +137,47 @@ export function createModel(overrides: Partial = {}) { // surface ends up coplanar with the body (the z-fighting rule). horn.translate(config.faceLength * 0.31 + reach / 2 - config.faceWidth * 0.35, bodyY + bodyHeight * 0.12, 0) + // --- Stump --------------------------------------------------------- + // An anvil is used ON something. It is bedded into the end grain of a + // log so the block takes the ring out of it and puts the face at the + // smith's knuckle height; the file header has said the model "comes to + // ~0.75 m with a real anvil stump" for as long as it has existed, while + // shipping the 0.34 m anvil on its own, lying on the floor. + // + // It is its own part, so anyone who wants the bare anvil for their own + // bench hides `parts.stump` -- the same arrangement as the bell's frame. + const stumpTop = -half + config.height * 0.06 + const stumpHeight = config.height * 1.2 + // Nearly as wide as the anvil is long. A block the anvil overhangs looks + // like it would tip the first time anyone swung at it; a chopping block + // is a section of trunk, chosen fat. + const stumpRadius = config.faceLength * 0.42 + const woodTint = createTinter(random) + // BOTH colours copied out before either is read. + // + // `createTinter` returns the same Color object on every call -- its own + // docstring says so -- so passing two tints as arguments to one call + // hands the callee the same object twice, holding whichever value was + // computed last. The block came out painted in end-grain on every face, + // which is why it rendered pale. + const side = new Color(woodTint('oak', -0.26)) + const endGrain = new Color(woodTint('oakEnd', -0.16)) + const stump = prismGeometry( + stumpRadius * 1.1, + stumpRadius, + stumpHeight, + 9, + [0, stumpTop - stumpHeight / 2, 0], + side, + { colourTop: endGrain }, + ) + // Split and weathered, the way a chopping block always is. Kept small: + // the block reads by its mass, and the anvil sitting square on it is the + // detail that matters. + roughenGeometry(stump, stumpRadius * 0.035, { salt: 5, scaleY: 0.3 }) + return { + stump: { slot: 'oak', geometry: stump }, base: { slot: 'iron', geometry: base }, waist: { slot: 'iron', geometry: waist }, body: { slot: 'iron', geometry: body },