diff --git a/models.lock.json b/models.lock.json index c270987..cde4aff 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-23T05:02:54.976Z", + "installedAt": "2026-08-23T05:09:14.197Z", "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-23T05:02:54.957Z", + "installedAt": "2026-08-23T05:09:14.176Z", "files": [ { "path": "src\\models\\medieval-kit\\core\\geometry.ts", @@ -118,7 +118,7 @@ }, { "path": "src\\models\\medieval-kit\\core\\tint.ts", - "sourceHash": "d5b8d1606a64dfc223543330499b22de00850a8fc446597d211cddc46d08e73b" + "sourceHash": "381f4b64574ebc80bd150c50cd8faadd778cbb31775e412f52f2d500075f8350" } ], "dependencies": [ @@ -129,7 +129,7 @@ "address": "@medieval-kit/wooden-crate", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T05:02:54.980Z", + "installedAt": "2026-08-23T05:09:14.202Z", "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-23T05:02:54.985Z", + "installedAt": "2026-08-23T05:09:14.209Z", "files": [], "dependencies": [] }, @@ -152,7 +152,7 @@ "address": "@medieval-kit/iron-anvil", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T05:02:54.964Z", + "installedAt": "2026-08-23T05:09:14.184Z", "files": [ { "path": "src\\models\\medieval-kit\\iron-anvil\\model.ts", @@ -167,7 +167,7 @@ "address": "@medieval-kit/wooden-bucket", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T05:02:54.978Z", + "installedAt": "2026-08-23T05:09:14.199Z", "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-23T05:02:54.981Z", + "installedAt": "2026-08-23T05:09:14.203Z", "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-23T05:02:54.982Z", + "installedAt": "2026-08-23T05:09:14.204Z", "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-23T05:02:54.982Z", + "installedAt": "2026-08-23T05:09:14.205Z", "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-23T05:02:54.983Z", + "installedAt": "2026-08-23T05:09:14.206Z", "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-23T05:02:54.984Z", + "installedAt": "2026-08-23T05:09:14.208Z", "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-23T05:02:54.985Z", + "installedAt": "2026-08-23T05:09:14.209Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-stool\\model.ts", @@ -272,11 +272,11 @@ "address": "@medieval-kit/cart-wheel", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T05:02:54.960Z", + "installedAt": "2026-08-23T05:09:14.180Z", "files": [ { "path": "src\\models\\medieval-kit\\cart-wheel\\model.ts", - "sourceHash": "5ed858155c12e65a7e9ba4a9a6cce681770fbbc88d97233f2d1b7577417d178c" + "sourceHash": "08fb82af124cfaab7e7b3682eb04d912b552e7f2310e3ec290fe03159642384a" } ], "dependencies": [ @@ -287,7 +287,7 @@ "address": "@medieval-kit/log-pile", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T05:02:54.968Z", + "installedAt": "2026-08-23T05:09:14.189Z", "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-23T05:02:54.974Z", + "installedAt": "2026-08-23T05:09:14.194Z", "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-23T05:02:54.979Z", + "installedAt": "2026-08-23T05:09:14.201Z", "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-23T05:02:54.963Z", + "installedAt": "2026-08-23T05:09:14.183Z", "files": [ { "path": "src\\models\\medieval-kit\\hay-bale\\model.ts", @@ -347,11 +347,11 @@ "address": "@medieval-kit/pitch-torch", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T05:02:54.970Z", + "installedAt": "2026-08-23T05:09:14.191Z", "files": [ { "path": "src\\models\\medieval-kit\\pitch-torch\\model.ts", - "sourceHash": "cc6f51cdb70dfb9c247eed26dc42cdd28a45a78959ce318bf8aadd20f2f05a50" + "sourceHash": "afc3b92ad659f102aa141de59ba8d1d5d6ba36cace3f10d4b51639098acbd510" } ], "dependencies": [ @@ -362,7 +362,7 @@ "address": "@medieval-kit/wooden-bench", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-23T05:02:54.977Z", + "installedAt": "2026-08-23T05:09:14.198Z", "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-23T05:02:54.967Z", + "installedAt": "2026-08-23T05:09:14.188Z", "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-23T05:02:54.969Z", + "installedAt": "2026-08-23T05:09:14.190Z", "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-23T05:02:54.971Z", + "installedAt": "2026-08-23T05:09:14.192Z", "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-23T05:02:54.959Z", + "installedAt": "2026-08-23T05:09:14.178Z", "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-23T05:02:54.965Z", + "installedAt": "2026-08-23T05:09:14.186Z", "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-23T05:02:54.972Z", + "installedAt": "2026-08-23T05:09:14.193Z", "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-23T05:02:54.961Z", + "installedAt": "2026-08-23T05:09:14.181Z", "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-23T05:02:54.962Z", + "installedAt": "2026-08-23T05:09:14.182Z", "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-23T05:02:54.966Z", + "installedAt": "2026-08-23T05:09:14.187Z", "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-23T05:02:54.975Z", + "installedAt": "2026-08-23T05:09:14.195Z", "files": [ { "path": "src\\models\\medieval-kit\\wicker-basket\\model.ts", diff --git a/my-registry/models/cart-wheel/model.ts b/my-registry/models/cart-wheel/model.ts index 729ae6b..ab3e2a9 100644 --- a/my-registry/models/cart-wheel/model.ts +++ b/my-registry/models/cart-wheel/model.ts @@ -44,7 +44,11 @@ export const cartWheelDefaults: CartWheelConfig = { spokeCount: 10, width: 0.09, hubLength: 2.1, - tyre: 0.045, + // An iron tyre is a HOOP: 8 to 12 mm of bar shrunk onto the felloe. At + // 0.045 of a 0.52 m radius it was 23 mm of iron, and with an axial width + // greater than the wheel's own it read as a pneumatic tyre rather than as + // the band that holds a wooden rim together. + tyre: 0.022, seed: 27, } @@ -163,12 +167,20 @@ export function createModel(overrides: Partial = {}) { const tyre = bandGeometry( config.radius, 0, - // Wider than the felloe, and wider than the widest felloe piece can - // jitter to (±7%). A tyre exactly the felloe's width put its side faces - // in the same plane as any piece whose jitter came out near zero, and - // those pairs flickered. A real iron tyre is proud of the wood anyway — - // it is what takes the wear. - config.width * 1.1, + // NARROWER than the narrowest felloe piece can jitter to. + // + // The felloe's axial thickness jitters by ±7%, so anything between + // 0.93 and 1.07 of the width lands inside that range and will sooner + // or later share a plane with some piece; a tyre at exactly the + // felloe's width flickered against whichever piece came out near + // zero jitter. The first answer was to go wider than the whole range, + // at 1.1 -- which stopped the flicker and made the wheel look shod in + // a pneumatic tyre, a black band standing proud of its own rim. + // + // Going under the range instead solves it the same way and is the + // truer shape: the hoop is set into the tread, and on a worn wheel a + // sliver of felloe shows at each edge where the iron has bedded in. + config.width * 0.9, tyreThickness * 1.06, segments * 2, iron(), diff --git a/my-registry/models/core/tint.ts b/my-registry/models/core/tint.ts index 9c53efe..43c5cb7 100644 --- a/my-registry/models/core/tint.ts +++ b/my-registry/models/core/tint.ts @@ -11,14 +11,27 @@ import { jitter } from './random.ts' * amounts had drifted from model to model, so when two models were put side * by side one of them visibly had more variation than the other. * - * The returned Color IS THE SAME OBJECT ON EVERY CALL. That is not a problem - * because the geometry functions read the colour immediately and write it into - * the vertices, and it is far cheaper than allocating one Color per call. But - * anyone who wants to keep it must do `new Color(tint(...))` — otherwise the - * next call mutates what they are holding. + * Every call returns A NEW Color. + * + * It used to return one shared object and mutate it, on the reasoning that the + * geometry helpers read the colour immediately and an allocation per call is + * waste. The reasoning holds right up until two tints appear as arguments of + * the SAME call: + * + * latheGeometry(profile, 7, origin, tint('char', 0.06), + * { colourTop: tint('charHot', -0.12) }) + * + * Both arguments are the same object, so both carry whatever the second call + * computed. That is not a hypothetical: it is why the torch's pitch head + * rendered hot orange instead of black, and the same mistake was made twice + * more in one session -- once in the anvil's stump, which came out painted in + * end grain on every face, and once nearly in the shovel. Three times means + * the hazard is in the helper, not in the callers. + * + * A few hundred Color allocations at build time is not a cost worth one class + * of silent, invisible bug. */ export function createTinter(random: () => number) { - const scratch = new Color() return ( key: keyof MedievalPalette, /** Lightness shift. Negative darkens. */ @@ -26,7 +39,7 @@ export function createTinter(random: () => number) { /** Deviation multiplier. 0 gives a completely flat colour. */ spread = 1, ): Color => { - scratch.copy(MEDIEVAL_PALETTE[key]) + const scratch = new Color(MEDIEVAL_PALETTE[key]) scratch.offsetHSL( jitter(random, 0.012 * spread), jitter(random, 0.05 * spread), diff --git a/my-registry/models/pitch-torch/model.ts b/my-registry/models/pitch-torch/model.ts index 192e2a6..0f6e3a9 100644 --- a/my-registry/models/pitch-torch/model.ts +++ b/my-registry/models/pitch-torch/model.ts @@ -51,7 +51,9 @@ export const pitchTorchDefaults: PitchTorchConfig = { length: 0.58, radius: 0.019, wrapLength: 0.3, - flameHeight: 1.15, + // The flame was taller than the head that feeds it. A pitch torch burns + // with a low, fat, smoky flame, not a candle's spire. + flameHeight: 0.78, flicker: 1, seed: 37, } @@ -103,13 +105,16 @@ export function createModel(overrides: Partial = {}) { // soot — an oak colour would be a lie here. const wrapProfile: Level[] = [ { y: wrapBase - wrapLength * 0.12, radius: config.radius * 1.15 }, - { y: wrapBase + wrapLength * 0.22, radius: config.radius * 2.35 }, - { y: wrapBase + wrapLength * 0.62, radius: config.radius * 2.5 }, - { y: half, radius: config.radius * 2.05 }, + // Fatter. A torch head is a fist of tow and rags soaked in pitch, + // bound on; at 2.5 shaft radii it was a spindle, and the head is the + // whole reason the object is not a stick. + { y: wrapBase + wrapLength * 0.22, radius: config.radius * 3.3 }, + { y: wrapBase + wrapLength * 0.62, radius: config.radius * 3.5 }, + { y: half, radius: config.radius * 2.9 }, ] const wrap = mergeColoured([latheGeometry( wrapProfile, 7, [0, 0, 0], tint('char', 0.06), - { colourTop: tint('charHot', -0.12) }, + { colourTop: tint('charHot', -0.32) }, )]) // --- Flame ----------------------------------------------------------- diff --git a/src/models/medieval-kit/cart-wheel/model.ts b/src/models/medieval-kit/cart-wheel/model.ts index 729ae6b..ab3e2a9 100644 --- a/src/models/medieval-kit/cart-wheel/model.ts +++ b/src/models/medieval-kit/cart-wheel/model.ts @@ -44,7 +44,11 @@ export const cartWheelDefaults: CartWheelConfig = { spokeCount: 10, width: 0.09, hubLength: 2.1, - tyre: 0.045, + // An iron tyre is a HOOP: 8 to 12 mm of bar shrunk onto the felloe. At + // 0.045 of a 0.52 m radius it was 23 mm of iron, and with an axial width + // greater than the wheel's own it read as a pneumatic tyre rather than as + // the band that holds a wooden rim together. + tyre: 0.022, seed: 27, } @@ -163,12 +167,20 @@ export function createModel(overrides: Partial = {}) { const tyre = bandGeometry( config.radius, 0, - // Wider than the felloe, and wider than the widest felloe piece can - // jitter to (±7%). A tyre exactly the felloe's width put its side faces - // in the same plane as any piece whose jitter came out near zero, and - // those pairs flickered. A real iron tyre is proud of the wood anyway — - // it is what takes the wear. - config.width * 1.1, + // NARROWER than the narrowest felloe piece can jitter to. + // + // The felloe's axial thickness jitters by ±7%, so anything between + // 0.93 and 1.07 of the width lands inside that range and will sooner + // or later share a plane with some piece; a tyre at exactly the + // felloe's width flickered against whichever piece came out near + // zero jitter. The first answer was to go wider than the whole range, + // at 1.1 -- which stopped the flicker and made the wheel look shod in + // a pneumatic tyre, a black band standing proud of its own rim. + // + // Going under the range instead solves it the same way and is the + // truer shape: the hoop is set into the tread, and on a worn wheel a + // sliver of felloe shows at each edge where the iron has bedded in. + config.width * 0.9, tyreThickness * 1.06, segments * 2, iron(), diff --git a/src/models/medieval-kit/core/tint.ts b/src/models/medieval-kit/core/tint.ts index 9c53efe..43c5cb7 100644 --- a/src/models/medieval-kit/core/tint.ts +++ b/src/models/medieval-kit/core/tint.ts @@ -11,14 +11,27 @@ import { jitter } from './random.ts' * amounts had drifted from model to model, so when two models were put side * by side one of them visibly had more variation than the other. * - * The returned Color IS THE SAME OBJECT ON EVERY CALL. That is not a problem - * because the geometry functions read the colour immediately and write it into - * the vertices, and it is far cheaper than allocating one Color per call. But - * anyone who wants to keep it must do `new Color(tint(...))` — otherwise the - * next call mutates what they are holding. + * Every call returns A NEW Color. + * + * It used to return one shared object and mutate it, on the reasoning that the + * geometry helpers read the colour immediately and an allocation per call is + * waste. The reasoning holds right up until two tints appear as arguments of + * the SAME call: + * + * latheGeometry(profile, 7, origin, tint('char', 0.06), + * { colourTop: tint('charHot', -0.12) }) + * + * Both arguments are the same object, so both carry whatever the second call + * computed. That is not a hypothetical: it is why the torch's pitch head + * rendered hot orange instead of black, and the same mistake was made twice + * more in one session -- once in the anvil's stump, which came out painted in + * end grain on every face, and once nearly in the shovel. Three times means + * the hazard is in the helper, not in the callers. + * + * A few hundred Color allocations at build time is not a cost worth one class + * of silent, invisible bug. */ export function createTinter(random: () => number) { - const scratch = new Color() return ( key: keyof MedievalPalette, /** Lightness shift. Negative darkens. */ @@ -26,7 +39,7 @@ export function createTinter(random: () => number) { /** Deviation multiplier. 0 gives a completely flat colour. */ spread = 1, ): Color => { - scratch.copy(MEDIEVAL_PALETTE[key]) + const scratch = new Color(MEDIEVAL_PALETTE[key]) scratch.offsetHSL( jitter(random, 0.012 * spread), jitter(random, 0.05 * spread), diff --git a/src/models/medieval-kit/pitch-torch/model.ts b/src/models/medieval-kit/pitch-torch/model.ts index 192e2a6..0f6e3a9 100644 --- a/src/models/medieval-kit/pitch-torch/model.ts +++ b/src/models/medieval-kit/pitch-torch/model.ts @@ -51,7 +51,9 @@ export const pitchTorchDefaults: PitchTorchConfig = { length: 0.58, radius: 0.019, wrapLength: 0.3, - flameHeight: 1.15, + // The flame was taller than the head that feeds it. A pitch torch burns + // with a low, fat, smoky flame, not a candle's spire. + flameHeight: 0.78, flicker: 1, seed: 37, } @@ -103,13 +105,16 @@ export function createModel(overrides: Partial = {}) { // soot — an oak colour would be a lie here. const wrapProfile: Level[] = [ { y: wrapBase - wrapLength * 0.12, radius: config.radius * 1.15 }, - { y: wrapBase + wrapLength * 0.22, radius: config.radius * 2.35 }, - { y: wrapBase + wrapLength * 0.62, radius: config.radius * 2.5 }, - { y: half, radius: config.radius * 2.05 }, + // Fatter. A torch head is a fist of tow and rags soaked in pitch, + // bound on; at 2.5 shaft radii it was a spindle, and the head is the + // whole reason the object is not a stick. + { y: wrapBase + wrapLength * 0.22, radius: config.radius * 3.3 }, + { y: wrapBase + wrapLength * 0.62, radius: config.radius * 3.5 }, + { y: half, radius: config.radius * 2.9 }, ] const wrap = mergeColoured([latheGeometry( wrapProfile, 7, [0, 0, 0], tint('char', 0.06), - { colourTop: tint('charHot', -0.12) }, + { colourTop: tint('charHot', -0.32) }, )]) // --- Flame -----------------------------------------------------------