Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 8 additions & 2 deletions src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
};
Expand All @@ -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,
};
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions src/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface BuildingParams {
acUnit: number;
roofProbability: number;
clothlineProbability: number;
lights: number;
windowType: number;
windowOpenAmount: number;
curtainClose: number;
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tools/compare_truth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down