From d20091324865bc1e8a2aea0735e65226ca85d200 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Tue, 1 Sep 2026 13:41:27 +0000 Subject: [PATCH] feat: port facade lights probability from the Blender modifier Add lights (default 0.546), lightsPick ranges, COL(lights.001) gated like awnings, and a lil-gui slider. Stop claiming all 18 Blender params and low-poly until those exist. --- README.md | 6 +++--- src/generator.ts | 10 ++++++++-- src/main.ts | 1 + src/params.ts | 2 ++ tools/compare_truth.ts | 1 + 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 14d18758..b5c5312d 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ npm install npm run dev ``` -All 18 generator parameters from the Blender modifier (floors, footprint, AC/clothline/ -lights probabilities, window type & open amount, curtains, store state, seed, low-poly -toggle…) are exposed as live sliders. +Live sliders cover the ported generator inputs (floors, footprint, AC / clothline / +lights probabilities, window type & open amount, curtains, store state, seed). The +Blender modifier also has deform and low-poly toggles; those are not in this port yet. ## Re-exporting the asset kit diff --git a/src/generator.ts b/src/generator.ts index 72180ae7..0d98afe7 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -74,6 +74,7 @@ interface GridCfg { yShift: number; // -0.5 front/back, -0.1 sides roomsPick: [number, number]; awningPick: [number, number]; + lightsPick: [number, number]; curtainPick: [number, number]; acPick: [number, number]; clothPick: [number, number]; @@ -122,6 +123,11 @@ function windowCellContent(p: BuildingParams, cfg: GridCfg, counts: KitCounts): awningCells.forEach((c, j) => emit(COL("roof.002", randInt(cfg.awningPick[0], cfg.awningPick[1], j, seed), counts), c, 0, 0, 0)); + // facade lights (same gate pattern as awnings) + const [lightCells] = separate(cells, (_c, i) => randBool(p.lights, i, seed)); + lightCells.forEach((c, j) => + emit(COL("lights.001", randInt(cfg.lightsPick[0], cfg.lightsPick[1], j, seed), counts), c, 0, 0, 0)); + // AC units (front/back skip the first window row) and clotheslines const [eligible, belowCut] = cfg.acFirstFloorCut ? separate(cells, c => c.z > -(floor + 1) / 2 + 2) @@ -286,7 +292,7 @@ export function generateBuilding(p: BuildingParams, counts: KitCounts): Placemen // ---- front/back facade (grid B: length × floor) ---- const cfgB: GridCfg = { n: p.length, yShift: -0.5, - roomsPick: [0, 80], awningPick: [45, 125], curtainPick: [0, 101], + roomsPick: [0, 80], awningPick: [45, 125], lightsPick: [0, 120], curtainPick: [0, 101], acPick: [50, 100], clothPick: [0, 113], acFirstFloorCut: true, }; @@ -303,7 +309,7 @@ export function generateBuilding(p: BuildingParams, counts: KitCounts): Placemen // ---- side facades (grid A: width × floor) ---- const cfgA: GridCfg = { n: p.width, yShift: -0.1, - roomsPick: [0, 101], awningPick: [0, 113], curtainPick: [0, 164], + roomsPick: [0, 101], awningPick: [0, 113], lightsPick: [0, 89], curtainPick: [0, 164], acPick: [50, 200], clothPick: [0, 96], acFirstFloorCut: false, }; diff --git a/src/main.ts b/src/main.ts index dc17b1e3..d491efae 100644 --- a/src/main.ts +++ b/src/main.ts @@ -378,6 +378,7 @@ fBuild.add(params, "width", 2, 40, 1); fBuild.add(params, "acUnit", 0, 1, 0.01).name("AC unit"); fBuild.add(params, "roofProbability", 0, 1, 0.01).name("window awning"); fBuild.add(params, "clothlineProbability", 0, 1, 0.01).name("clothline"); +fBuild.add(params, "lights", 0, 1, 0.01).name("lights"); fBuild.add(params, "windowType", 0, 1, 0.01).name("window type"); fBuild.add(params, "windowOpenAmount", 0, 1, 0.01).name("window open"); fBuild.add(params, "curtainClose", 0, 1, 0.01).name("curtain close"); diff --git a/src/params.ts b/src/params.ts index 4573e671..8013d651 100644 --- a/src/params.ts +++ b/src/params.ts @@ -6,6 +6,7 @@ export interface BuildingParams { acUnit: number; roofProbability: number; clothlineProbability: number; + lights: number; windowType: number; windowOpenAmount: number; curtainClose: number; @@ -26,6 +27,7 @@ export function defaultParams(): BuildingParams { acUnit: 0.724, roofProbability: 0.512, clothlineProbability: 0.709, + lights: 0.546, windowType: 0.75, windowOpenAmount: 0.0, curtainClose: 0.0, diff --git a/tools/compare_truth.ts b/tools/compare_truth.ts index 0b56d6c4..f121bfd6 100644 --- a/tools/compare_truth.ts +++ b/tools/compare_truth.ts @@ -26,6 +26,7 @@ const p: BuildingParams = { acUnit: truth.params["AC UNIT"], roofProbability: truth.params["Roof Probability"], clothlineProbability: truth.params["Clothline Probability"], + lights: truth.params["Lights"] ?? 0.546, windowType: truth.params["window type"], windowOpenAmount: truth.params["window open amount"], curtainClose: truth.params["curtain close"],