@adatechnology/game-urban-three 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/{chunk-JTXGLKOL.js → chunk-QS2K4DEO.js} +315 -11
- package/dist/chunk-QS2K4DEO.js.map +1 -0
- package/dist/index.d.ts +35 -2
- package/dist/index.global.js +536 -52
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/testing.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-JTXGLKOL.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -2576,6 +2576,17 @@ var GameUrbanThree = (() => {
|
|
|
2576
2576
|
"outhouse"
|
|
2577
2577
|
]);
|
|
2578
2578
|
var CAR_CLEARANCE = { driver: 0.8, side: 0.6, end: 0.6 };
|
|
2579
|
+
var visor = false;
|
|
2580
|
+
var visorLayout = () => visor;
|
|
2581
|
+
function withVisorLayout(on2, fn) {
|
|
2582
|
+
const previous = visor;
|
|
2583
|
+
visor = on2;
|
|
2584
|
+
try {
|
|
2585
|
+
return fn();
|
|
2586
|
+
} finally {
|
|
2587
|
+
visor = previous;
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2579
2590
|
var active = WALL_THICKNESS;
|
|
2580
2591
|
var wallThickness = () => active;
|
|
2581
2592
|
var wallMargin = () => active / 2;
|
|
@@ -3044,6 +3055,7 @@ var GameUrbanThree = (() => {
|
|
|
3044
3055
|
}
|
|
3045
3056
|
return [u0, v0, u0 + extentU, v0 + extentV];
|
|
3046
3057
|
}
|
|
3058
|
+
var BESIDE_GAP = 0.03;
|
|
3047
3059
|
var RELAXED_RADIUS = 0.12;
|
|
3048
3060
|
var MESH_FRONT = { "+z": [0, 1], "-z": [0, -1], "+x": [1, 0], "-x": [-1, 0] };
|
|
3049
3061
|
function rotationFor(f, front) {
|
|
@@ -3059,6 +3071,7 @@ var GameUrbanThree = (() => {
|
|
|
3059
3071
|
const state = {};
|
|
3060
3072
|
const solids = [];
|
|
3061
3073
|
const reserves = [];
|
|
3074
|
+
const openings = [];
|
|
3062
3075
|
const rims = [];
|
|
3063
3076
|
const inners = usableParts(room, 0);
|
|
3064
3077
|
const grid = createGrid(plan, room);
|
|
@@ -3081,11 +3094,11 @@ var GameUrbanThree = (() => {
|
|
|
3081
3094
|
}
|
|
3082
3095
|
for (const u of units) u.required = u.members.some((m) => m.required);
|
|
3083
3096
|
const queue = units.filter((u) => u.required).concat(units.filter((u) => !u.required));
|
|
3084
|
-
const dependencies = (u) => u.members.flatMap((m) => [m.requires, m.on]).filter(Boolean).filter((id) => slots2.some((s) => s.id === id && !u.members.includes(s)));
|
|
3097
|
+
const dependencies = (u) => u.members.flatMap((m) => [m.requires, m.on]).filter(Boolean).filter((id) => slots2.some((s) => (s.id === id || s.group === id) && !u.members.includes(s)));
|
|
3085
3098
|
const done = /* @__PURE__ */ new Set();
|
|
3086
3099
|
const ready = (u) => dependencies(u).every((id) => done.has(id));
|
|
3087
3100
|
const make2 = (s, it, r, parent, overheadOff) => {
|
|
3088
|
-
const f =
|
|
3101
|
+
const f = facingOf(s);
|
|
3089
3102
|
const id = room.id + "." + s.id;
|
|
3090
3103
|
const m = {
|
|
3091
3104
|
id,
|
|
@@ -3121,9 +3134,31 @@ var GameUrbanThree = (() => {
|
|
|
3121
3134
|
if (parent && s.anchor === "inside") m.y = r2(parent.y || 0);
|
|
3122
3135
|
if (room.link) m.link = { from: room.link[0], to: room.link[1] };
|
|
3123
3136
|
state[s.id] = m;
|
|
3137
|
+
if (s.group && !state[s.group]) state[s.group] = m;
|
|
3124
3138
|
items.push(m);
|
|
3125
3139
|
return m;
|
|
3126
3140
|
};
|
|
3141
|
+
const facingOf = (s) => {
|
|
3142
|
+
const parent = s.anchor === "beside" ? state[s.on] : void 0;
|
|
3143
|
+
return parent ? [parent.frontU ?? 0, parent.frontV ?? 1] : [s.frontU, s.frontV];
|
|
3144
|
+
};
|
|
3145
|
+
const besideRects = (s, it) => {
|
|
3146
|
+
const parent = state[s.on];
|
|
3147
|
+
if (!parent) return [];
|
|
3148
|
+
const f = [parent.frontU ?? 0, parent.frontV ?? 1];
|
|
3149
|
+
const r = parent._r ?? parent.aabb;
|
|
3150
|
+
const sign2 = s.side === "left" ? 1 : -1;
|
|
3151
|
+
const t = [-f[1] * sign2, f[0] * sign2];
|
|
3152
|
+
const [extentU, extentV] = extent([it.w, it.d], f);
|
|
3153
|
+
const halfAlong = Math.abs(t[0]) * (r[2] - r[0]) / 2 + Math.abs(t[1]) * (r[3] - r[1]) / 2;
|
|
3154
|
+
const itemAlong = Math.abs(t[0]) * extentU / 2 + Math.abs(t[1]) * extentV / 2;
|
|
3155
|
+
const cu = (r[0] + r[2]) / 2 + t[0] * (halfAlong + BESIDE_GAP + itemAlong);
|
|
3156
|
+
const cv = (r[1] + r[3]) / 2 + t[1] * (halfAlong + BESIDE_GAP + itemAlong);
|
|
3157
|
+
const back = f[1] > 0 ? r[1] : f[1] < 0 ? r[3] : f[0] > 0 ? r[0] : r[2];
|
|
3158
|
+
const u0 = f[0] > 0 ? back : f[0] < 0 ? back - extentU : cu - extentU / 2;
|
|
3159
|
+
const v0 = f[1] > 0 ? back : f[1] < 0 ? back - extentV : cv - extentV / 2;
|
|
3160
|
+
return [{ rect: [u0, v0, u0 + extentU, v0 + extentV] }];
|
|
3161
|
+
};
|
|
3127
3162
|
const tryFit = (s, relax, overheadOff) => {
|
|
3128
3163
|
const cands = weightedOrder(candidatesOf(s.cats), rng);
|
|
3129
3164
|
if (s.anchor === "on" || s.anchor === "inside") {
|
|
@@ -3142,13 +3177,13 @@ var GameUrbanThree = (() => {
|
|
|
3142
3177
|
}
|
|
3143
3178
|
for (const { it } of cands) {
|
|
3144
3179
|
if (it.w > s.w + EPS || it.d > s.d + EPS) continue;
|
|
3145
|
-
const f =
|
|
3180
|
+
const f = facingOf(s);
|
|
3146
3181
|
const slide = s.anchor === "wall" ? s.slide == null ? 2 : s.slide : 0;
|
|
3147
3182
|
const shifts = [0];
|
|
3148
3183
|
for (let k = 1; k * 0.1 <= slide + 1e-9; k++) shifts.push(k * 0.1, -k * 0.1);
|
|
3149
3184
|
let found = null;
|
|
3150
3185
|
const car = it.category === "car" && !relax;
|
|
3151
|
-
const tries = car ? carCandidates(s, it, plan.carClearance) : shifts.map((shift) => ({ rect: itemRect(s, it, shift) }));
|
|
3186
|
+
const tries = car ? carCandidates(s, it, plan.carClearance) : s.anchor === "beside" ? besideRects(s, it) : shifts.map((shift) => ({ rect: itemRect(s, it, shift) }));
|
|
3152
3187
|
for (const attempt of tries) {
|
|
3153
3188
|
const r3 = attempt.rect;
|
|
3154
3189
|
if (!insideUnion(r3, inners)) continue;
|
|
@@ -3160,6 +3195,7 @@ var GameUrbanThree = (() => {
|
|
|
3160
3195
|
if (zones.some((z) => overlaps(r3, z))) continue;
|
|
3161
3196
|
if (windowZones.some(({ z, j }) => blocksWindow(it, j, overheadOff) && overlaps(r3, z))) continue;
|
|
3162
3197
|
if (solids.some((o) => overlaps(r3, o))) continue;
|
|
3198
|
+
if (openings.some((o) => overlaps(r3, o))) continue;
|
|
3163
3199
|
if (!it.deck && rims.some((a) => overlaps(r3, a))) continue;
|
|
3164
3200
|
let cl2 = car ? attempt.clear : null;
|
|
3165
3201
|
if (!car && !relax && s.clearance > 0 && !it.low) {
|
|
@@ -3167,6 +3203,12 @@ var GameUrbanThree = (() => {
|
|
|
3167
3203
|
if (!insideUnion(cl2, inners)) continue;
|
|
3168
3204
|
if (items.some((m2) => !m2.low && !m2.flat && !m2.on && overlaps(cl2, m2._r ?? m2.aabb))) continue;
|
|
3169
3205
|
}
|
|
3206
|
+
let front2 = null;
|
|
3207
|
+
if (!car && it.opening && !visorLayout()) {
|
|
3208
|
+
front2 = clearRect(r3, f, it.opening);
|
|
3209
|
+
if (!insideUnion(front2, inners)) continue;
|
|
3210
|
+
if (items.some((m2) => !m2.flat && !m2.on && overlaps(front2, m2._r ?? m2.aabb))) continue;
|
|
3211
|
+
}
|
|
3170
3212
|
if (!it.low && reserves.some((q) => overlaps(r3, q))) continue;
|
|
3171
3213
|
let rimRect2 = null;
|
|
3172
3214
|
if (it.rim) {
|
|
@@ -3174,11 +3216,12 @@ var GameUrbanThree = (() => {
|
|
|
3174
3216
|
if (!insideUnion(rimRect2, inners) || solids.some((o) => overlaps(rimRect2, o)) || zones.some((z) => overlaps(rimRect2, z))) continue;
|
|
3175
3217
|
}
|
|
3176
3218
|
if (!(relax ? reachable(relaxedGrid, solids.concat([r3]), RELAXED_RADIUS) : reachable(grid, solids.concat([r3]), inflation))) continue;
|
|
3177
|
-
found = { rect: r3, cl: cl2, rimRect: rimRect2 };
|
|
3219
|
+
found = { rect: r3, cl: cl2, rimRect: rimRect2, front: front2 };
|
|
3178
3220
|
break;
|
|
3179
3221
|
}
|
|
3180
3222
|
if (!found) continue;
|
|
3181
|
-
const { rect: r, cl, rimRect } = found;
|
|
3223
|
+
const { rect: r, cl, rimRect, front } = found;
|
|
3224
|
+
if (front) openings.push(front);
|
|
3182
3225
|
if (it.flat) return make2(s, it, r, null);
|
|
3183
3226
|
const m = make2(s, it, r, null, overheadOff);
|
|
3184
3227
|
if (cl) reserves.push(cl);
|
|
@@ -3226,6 +3269,7 @@ var GameUrbanThree = (() => {
|
|
|
3226
3269
|
const u = pending.splice(i, 1)[0];
|
|
3227
3270
|
process2(u);
|
|
3228
3271
|
for (const m of u.members) done.add(m.id);
|
|
3272
|
+
if (u.group) done.add(u.group);
|
|
3229
3273
|
}
|
|
3230
3274
|
return { items, missing };
|
|
3231
3275
|
}
|
|
@@ -3352,6 +3396,7 @@ var GameUrbanThree = (() => {
|
|
|
3352
3396
|
continue;
|
|
3353
3397
|
}
|
|
3354
3398
|
if (occupied.some((m) => !m.low && !m.flat && !m.on && !m.decor && (m.clearance ?? 0) > 0 && overlaps(r, clearRect(m._r, [m.frontU ?? 0, m.frontV ?? 1], m.clearance ?? 0)))) continue;
|
|
3399
|
+
if (!visorLayout() && occupied.some((m) => !m.flat && !m.on && !m.decor && (registries().CATALOG[m.type]?.opening ?? 0) > 0 && overlaps(r, clearRect(m._r, [m.frontU ?? 0, m.frontV ?? 1], registries().CATALOG[m.type]?.opening ?? 0)))) continue;
|
|
3355
3400
|
if (opts.without && opts.without(r)) continue;
|
|
3356
3401
|
if (!reachable(opts.railing || gridOf(room), solidList.concat([r]), room.outdoor ? 0.16 : plan.playerRadius)) continue;
|
|
3357
3402
|
return r;
|
|
@@ -4185,6 +4230,7 @@ var GameUrbanThree = (() => {
|
|
|
4185
4230
|
for (const def of defs) {
|
|
4186
4231
|
const s = resolveSlot(plan, room, def, byId2, zones);
|
|
4187
4232
|
byId2[def.id] = s;
|
|
4233
|
+
if (s.valid && def.group && !byId2[def.group]) byId2[def.group] = s;
|
|
4188
4234
|
all.push(s);
|
|
4189
4235
|
}
|
|
4190
4236
|
}
|
|
@@ -4212,7 +4258,7 @@ var GameUrbanThree = (() => {
|
|
|
4212
4258
|
reason: null
|
|
4213
4259
|
};
|
|
4214
4260
|
const invalid = (m) => Object.assign(base, { valid: false, reason: m, x: 0, z: 0, ry: 0, w: 0, d: 0, frontU: 0, frontV: 1, aabb: [0, 0, 0, 0], _cell: null });
|
|
4215
|
-
if (def.anchor === "on" || def.anchor === "inside") {
|
|
4261
|
+
if (def.anchor === "on" || def.anchor === "inside" || def.anchor === "beside") {
|
|
4216
4262
|
const parent = def.parent ? byId2[def.parent] : void 0;
|
|
4217
4263
|
if (!parent || !parent.valid) return invalid("invalid_parent");
|
|
4218
4264
|
return Object.assign(base, { x: parent.x, z: parent.z, ry: parent.ry, w: parent.w, d: parent.d, frontU: parent.frontU, frontV: parent.frontV, aabb: parent.aabb, _cell: parent._cell });
|
|
@@ -4354,7 +4400,7 @@ var GameUrbanThree = (() => {
|
|
|
4354
4400
|
function slots(template, options) {
|
|
4355
4401
|
const tpl = templateOf(template);
|
|
4356
4402
|
const o = resolveOptions(tpl, options || {});
|
|
4357
|
-
return withWallThickness(wallThicknessFor(tpl, o), () => slotsWith(tpl, o));
|
|
4403
|
+
return withVisorLayout(o.visorLayout === true, () => withWallThickness(wallThicknessFor(tpl, o), () => slotsWith(tpl, o)));
|
|
4358
4404
|
}
|
|
4359
4405
|
function slotsWith(tpl, o) {
|
|
4360
4406
|
const plan = buildPlan(tpl, o.w, o.d, o);
|
|
@@ -4400,7 +4446,7 @@ var GameUrbanThree = (() => {
|
|
|
4400
4446
|
function generate2(template, options) {
|
|
4401
4447
|
const tpl = templateOf(template);
|
|
4402
4448
|
const o = resolveOptions(tpl, options || {});
|
|
4403
|
-
return withWallThickness(wallThicknessFor(tpl, o), () => generateWith(tpl, o));
|
|
4449
|
+
return withVisorLayout(o.visorLayout === true, () => withWallThickness(wallThicknessFor(tpl, o), () => generateWith(tpl, o)));
|
|
4404
4450
|
}
|
|
4405
4451
|
var resolveOptions = (tpl, options) => registries().OPTION_RESOLVERS.reduce((op, r) => r.resolve(tpl, op), options);
|
|
4406
4452
|
function generateWith(tpl, o) {
|
|
@@ -4546,13 +4592,13 @@ var GameUrbanThree = (() => {
|
|
|
4546
4592
|
});
|
|
4547
4593
|
}
|
|
4548
4594
|
function registerGroundItems() {
|
|
4549
|
-
const
|
|
4595
|
+
const flat2 = { category: "ground_cover", w: 1, d: 1, h: 0, decor: true, mount: "ground", flat: true };
|
|
4550
4596
|
registerItems([
|
|
4551
|
-
{ type: "lawn", ...
|
|
4552
|
-
{ type: "tile_floor", ...
|
|
4553
|
-
{ type: "concrete", ...
|
|
4554
|
-
{ type: "deck_floor", ...
|
|
4555
|
-
{ type: "dirt", ...
|
|
4597
|
+
{ type: "lawn", ...flat2, color: { role: "lawn" } },
|
|
4598
|
+
{ type: "tile_floor", ...flat2, color: { role: "exterior_floor" } },
|
|
4599
|
+
{ type: "concrete", ...flat2, color: { role: "exterior_floor" } },
|
|
4600
|
+
{ type: "deck_floor", ...flat2, color: { role: "deck_floor" } },
|
|
4601
|
+
{ type: "dirt", ...flat2, color: { role: "dirt" } }
|
|
4556
4602
|
]);
|
|
4557
4603
|
}
|
|
4558
4604
|
var slotKit = {
|
|
@@ -4561,7 +4607,8 @@ var GameUrbanThree = (() => {
|
|
|
4561
4607
|
center: (id, fx, fz, size, cats, o) => Object.assign({ id, anchor: "center", fx, fz, size, cats }, o),
|
|
4562
4608
|
windowSlot: (id, size, cats, o) => Object.assign({ id, anchor: "window", size, cats }, o),
|
|
4563
4609
|
on: (id, parent, cats, o) => Object.assign({ id, anchor: "on", on: parent, cats }, o),
|
|
4564
|
-
inside: (id, parent, cats, o) => Object.assign({ id, anchor: "inside", on: parent, cats }, o)
|
|
4610
|
+
inside: (id, parent, cats, o) => Object.assign({ id, anchor: "inside", on: parent, cats }, o),
|
|
4611
|
+
beside: (id, parent, side, cats, o) => Object.assign({ id, anchor: "beside", on: parent, side, cats }, o)
|
|
4565
4612
|
};
|
|
4566
4613
|
var en_default = {
|
|
4567
4614
|
labels: {
|
|
@@ -13299,16 +13346,16 @@ var GameUrbanThree = (() => {
|
|
|
13299
13346
|
function boxBody(c, o) {
|
|
13300
13347
|
const x0 = o.x0, x1 = o.x1, y0 = o.y0, y1 = o.y1, W = o.W, L = x0 - x1, H = y1 - y0, cx = (x0 + x1) / 2, cy = (y0 + y1) / 2;
|
|
13301
13348
|
const body = c.roundBox(L, H, W, o.armored ? 0.1 : 0.05, c.paint(o.col), cx, cy, 0, { def: true, sub: 0.3 });
|
|
13302
|
-
const
|
|
13349
|
+
const rib2 = o.armored ? CM("#4a535a", { metalness: 0.35, roughness: 0.5 }) : CM("#c4c7c3", { metalness: 0.25, roughness: 0.42 });
|
|
13303
13350
|
const doorM = o.armored ? c.paint(o.col) : CM("#d9dbd6", { metalness: 0.15, roughness: 0.45 });
|
|
13304
13351
|
c.roundBox(L - 0.1, 0.12, 0.2, 0.02, MT.trim, cx, y0 - 0.07, 0.43);
|
|
13305
13352
|
c.roundBox(L - 0.1, 0.12, 0.2, 0.02, MT.trim, cx, y0 - 0.07, -0.43);
|
|
13306
13353
|
for (let xs = x1 + 0.2; xs < x0; xs += 0.6) c.roundBox(0.08, 0.1, W - 0.1, 0.02, MT.trim, xs, y0 - 0.05, 0);
|
|
13307
13354
|
[1, -1].forEach(function(s) {
|
|
13308
13355
|
const zs = s * (W / 2 + 0.012);
|
|
13309
|
-
if (!o.armored) for (let x = x1 + 0.35; x < x0 - 0.2; x += 0.6) c.roundBox(0.055, H - 0.12, 0.025, 0.01,
|
|
13310
|
-
c.roundBox(L + 0.02, 0.09, 0.04, 0.015,
|
|
13311
|
-
c.roundBox(L + 0.02, 0.07, 0.04, 0.015,
|
|
13356
|
+
if (!o.armored) for (let x = x1 + 0.35; x < x0 - 0.2; x += 0.6) c.roundBox(0.055, H - 0.12, 0.025, 0.01, rib2, x, cy, zs);
|
|
13357
|
+
c.roundBox(L + 0.02, 0.09, 0.04, 0.015, rib2, cx, y0 + 0.04, s * (W / 2 + 0.018));
|
|
13358
|
+
c.roundBox(L + 0.02, 0.07, 0.04, 0.015, rib2, cx, y1 - 0.035, s * (W / 2 + 0.018));
|
|
13312
13359
|
[x0 - 0.15, cx, x1 + 0.2].forEach(function(xx) {
|
|
13313
13360
|
c.roundBox(0.07, 0.06, 0.02, 0.01, MT.amber, xx, y0 + 0.16, s * (W / 2 + 0.03));
|
|
13314
13361
|
});
|
|
@@ -13352,7 +13399,7 @@ var GameUrbanThree = (() => {
|
|
|
13352
13399
|
c.roundBox(0.04, 0.1, 0.16, 0.01, MT.steel, rx - 0.03, y0 + H * t, s * (W / 2 - 0.08));
|
|
13353
13400
|
});
|
|
13354
13401
|
});
|
|
13355
|
-
c.roundBox(0.06, 0.1, W - 0.1, 0.02,
|
|
13402
|
+
c.roundBox(0.06, 0.1, W - 0.1, 0.02, rib2, rx - 0.02, y1 - 0.05, 0);
|
|
13356
13403
|
[1, -1].forEach(function(s) {
|
|
13357
13404
|
c.roundBox(0.03, 0.05, 0.08, 0.01, MT.tail, rx - 0.02, y1 - 0.06, s * 0.35);
|
|
13358
13405
|
});
|
|
@@ -35169,7 +35216,7 @@ var GameUrbanThree = (() => {
|
|
|
35169
35216
|
{ id: "flood_tower", shape: "flood_tower", spec: FLOOD },
|
|
35170
35217
|
{ id: "concrete_distribution", shape: "distribution", spec: DISTRIBUTION }
|
|
35171
35218
|
];
|
|
35172
|
-
var DEFAULT_ROAD_STYLE = { color: 2237480, dash: { color: 9404239, every: 5, first: 2, length: 1.8, width: 0.16, height: 0.01, y: 0.025 } };
|
|
35219
|
+
var DEFAULT_ROAD_STYLE = { color: 2237480, plane: true, dash: { color: 9404239, every: 5, first: 2, length: 1.8, width: 0.16, height: 0.01, y: 0.025 } };
|
|
35173
35220
|
var DEFAULT_WALK_STYLE = { color: 3816252, height: 0.15, castShadow: false };
|
|
35174
35221
|
var ROAD_LEVEL = 0.02;
|
|
35175
35222
|
var DEFAULT_GROUND_COLOR = 1382426;
|
|
@@ -35179,7 +35226,7 @@ var GameUrbanThree = (() => {
|
|
|
35179
35226
|
function drawRoad(b, x, z, w, l, along2, options) {
|
|
35180
35227
|
const style = roadStyle(options);
|
|
35181
35228
|
const alongX = along2 === "x";
|
|
35182
|
-
b.plane(x, ROAD_LEVEL, z, alongX ? l : w, alongX ? w : l, style.color);
|
|
35229
|
+
if (style.plane) b.plane(x, ROAD_LEVEL, z, alongX ? l : w, alongX ? w : l, style.color);
|
|
35183
35230
|
const { dash } = style;
|
|
35184
35231
|
for (let u = -l / 2 + dash.first; u < l / 2; u += dash.every) {
|
|
35185
35232
|
b.item(alongX ? x + u : x, dash.y, alongX ? z : z + u, alongX ? dash.length : dash.width, dash.height, alongX ? dash.width : dash.length, dash.color);
|
|
@@ -36466,6 +36513,50 @@ var GameUrbanThree = (() => {
|
|
|
36466
36513
|
}
|
|
36467
36514
|
|
|
36468
36515
|
// ../game-urban/dist/networks/index.js
|
|
36516
|
+
var EDGE_NETWORK = {
|
|
36517
|
+
mv_span: "power_mv",
|
|
36518
|
+
lv_span: "power_lv",
|
|
36519
|
+
service_drop: "power_lv",
|
|
36520
|
+
light_feed: "lighting",
|
|
36521
|
+
telecom_span: "telecom",
|
|
36522
|
+
telecom_drop: "telecom",
|
|
36523
|
+
sewer_main: "sewer",
|
|
36524
|
+
sewer_lateral: "sewer",
|
|
36525
|
+
storm_gallery: "storm",
|
|
36526
|
+
storm_lateral: "storm",
|
|
36527
|
+
storm_gutter: "storm",
|
|
36528
|
+
water_main: "water",
|
|
36529
|
+
water_service: "water"
|
|
36530
|
+
};
|
|
36531
|
+
var AERIAL = /* @__PURE__ */ new Set(["mv_span", "lv_span", "telecom_span", "service_drop", "telecom_drop", "light_feed"]);
|
|
36532
|
+
function isAerialEdgeKind(kind) {
|
|
36533
|
+
return AERIAL.has(kind);
|
|
36534
|
+
}
|
|
36535
|
+
var NONE = [];
|
|
36536
|
+
var ofNetwork = (edges, network) => {
|
|
36537
|
+
if (edges === void 0) return NONE;
|
|
36538
|
+
return network === void 0 ? edges : edges.filter((edge) => EDGE_NETWORK[edge.kind] === network);
|
|
36539
|
+
};
|
|
36540
|
+
function buildNetworkGraph(input) {
|
|
36541
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
36542
|
+
for (const node of input.nodes) if (!nodes.has(node.id)) nodes.set(node.id, node);
|
|
36543
|
+
const edges = /* @__PURE__ */ new Map();
|
|
36544
|
+
const out = /* @__PURE__ */ new Map();
|
|
36545
|
+
const into = /* @__PURE__ */ new Map();
|
|
36546
|
+
for (const edge of input.edges) {
|
|
36547
|
+
if (edges.has(edge.id)) continue;
|
|
36548
|
+
edges.set(edge.id, edge);
|
|
36549
|
+
if (!nodes.has(edge.from) || !nodes.has(edge.to)) continue;
|
|
36550
|
+
out.set(edge.from, [...out.get(edge.from) ?? [], edge]);
|
|
36551
|
+
into.set(edge.to, [...into.get(edge.to) ?? [], edge]);
|
|
36552
|
+
}
|
|
36553
|
+
return {
|
|
36554
|
+
nodes,
|
|
36555
|
+
edges,
|
|
36556
|
+
outgoing: (nodeId, network) => ofNetwork(out.get(nodeId), network),
|
|
36557
|
+
incoming: (nodeId, network) => ofNetwork(into.get(nodeId), network)
|
|
36558
|
+
};
|
|
36559
|
+
}
|
|
36469
36560
|
var DEFAULT_NETWORK_LAYOUT = {
|
|
36470
36561
|
sidewalk: 2.5,
|
|
36471
36562
|
edgeReach: 5,
|
|
@@ -36526,7 +36617,8 @@ var GameUrbanThree = (() => {
|
|
|
36526
36617
|
storm_gutter: { min: 0 },
|
|
36527
36618
|
sewer_main: { min: 0.9 }
|
|
36528
36619
|
},
|
|
36529
|
-
sewer: { maxDepth: 4.5, coverUnderGallery: 1.8, galleryReach: 3, lateralOverGallery: 0.85, manholeSpacing: 80 },
|
|
36620
|
+
sewer: { maxDepth: 4.5, coverUnderGallery: 1.8, galleryReach: 3, lateralOverGallery: 0.85, manholeSpacing: 80, turnTolerance: 5, branchMaxSkew: 5 },
|
|
36621
|
+
storm: { inletSpacing: 60, cornerReach: 15 },
|
|
36530
36622
|
crossing: { separation: 0.2, rank: { storm_gutter: 0, water_main: 1, water_service: 1, sewer_lateral: 2, storm_lateral: 3, storm_gallery: 3, sewer_main: 4 } },
|
|
36531
36623
|
connectionTolerance: 0.01,
|
|
36532
36624
|
layout: DEFAULT_NETWORK_LAYOUT
|
|
@@ -36537,6 +36629,7 @@ var GameUrbanThree = (() => {
|
|
|
36537
36629
|
return isPoleSlots(slots2) ? slots2 : void 0;
|
|
36538
36630
|
}
|
|
36539
36631
|
var UINT322 = 2 ** 32;
|
|
36632
|
+
var DEGREES = Math.PI / 180;
|
|
36540
36633
|
function poleHeightsOf(slots2) {
|
|
36541
36634
|
const { mv, transformer, lv, lighting, telecom } = slots2.bands;
|
|
36542
36635
|
return { mv: mv[1], transformer: (transformer[0] + transformer[1]) / 2, transformerBottom: transformer[0], lv: lv[1] - 0.1, lamp: lighting[0] + 0.1, telecom: telecom[1] };
|
|
@@ -36633,10 +36726,108 @@ var GameUrbanThree = (() => {
|
|
|
36633
36726
|
const attachments = { mv: mv.mv, lv: lvAt, telecom: telecomAt, guy: [0, spec.slots.bands.mv[0] - 0.15, 0], ...transformer ? { transformer: transformer.points } : {} };
|
|
36634
36727
|
return { boxes, cylinders, ...lamp ? { lens: lamp.lens } : {}, attachments };
|
|
36635
36728
|
}
|
|
36729
|
+
var COVER = 0.6;
|
|
36730
|
+
var SHAFT_PV = { shape: "round", width: 0.9, depth: 0.9, material: "concrete" };
|
|
36731
|
+
function specOf(node) {
|
|
36732
|
+
const network = node.carries[0];
|
|
36733
|
+
switch (node.kind) {
|
|
36734
|
+
case "manhole":
|
|
36735
|
+
return node.spec === "gallery_box" ? { kind: "manhole_cover", shape: "square", size: [COVER, 0.03, COVER], material: "cast_iron", solid: false, shaft: { shape: "square", width: 0.9, depth: 0.9, material: "concrete" } } : { kind: "manhole_cover", shape: "round", size: [COVER, 0.03, COVER], material: "cast_iron", solid: false, shaft: SHAFT_PV };
|
|
36736
|
+
case "pumping_station":
|
|
36737
|
+
return { kind: "manhole_cover", shape: "round", size: [0.9, 0.03, 0.9], material: "cast_iron", solid: false, shaft: { shape: "round", width: 1.5, depth: 1.5, material: "concrete" } };
|
|
36738
|
+
case "cleanout":
|
|
36739
|
+
return { kind: "cleanout_cover", shape: "round", size: [0.25, 0.03, 0.25], material: "cast_iron", solid: false, shaft: { shape: "round", width: 0.2, depth: 0.2, material: "plastic" } };
|
|
36740
|
+
case "inlet":
|
|
36741
|
+
return { kind: "inlet_grate", shape: "square", size: [0.9, 0.03, 0.5], material: "cast_iron", solid: false, shaft: { shape: "square", width: 0.8, depth: 0.5, material: "concrete" } };
|
|
36742
|
+
case "valve":
|
|
36743
|
+
return { kind: "valve_cover", shape: "round", size: [0.2, 0.03, 0.2], material: "cast_iron", solid: false, shaft: { shape: "round", width: 0.1, depth: 0.1, material: "cast_iron" } };
|
|
36744
|
+
case "hydrant":
|
|
36745
|
+
return { kind: "hydrant", shape: "round", size: [0.2, 0.8, 0.2], material: "cast_iron", solid: true, shaft: { shape: "round", width: 0.1, depth: 0.1, material: "cast_iron" } };
|
|
36746
|
+
case "outfall":
|
|
36747
|
+
return { kind: "wing_wall", shape: "square", size: [3, 0.8, 1.6], material: "concrete", solid: true };
|
|
36748
|
+
case "connection":
|
|
36749
|
+
if (network === "sewer") return { kind: "inspection_cover", shape: "square", size: [0.6, 0.03, 0.6], material: "concrete", solid: false, shaft: { shape: "square", width: 0.6, depth: 0.6, material: "concrete" } };
|
|
36750
|
+
if (network === "water") return { kind: "meter_box", shape: "square", size: [0.4, 0.3, 0.25], material: "concrete", solid: true, shaft: { shape: "round", width: 0.04, depth: 0.04, material: "plastic" } };
|
|
36751
|
+
return network === "storm" ? { kind: "downspout_mouth", shape: "square", size: [0.3, 0.02, 0.2], material: "concrete", solid: false } : void 0;
|
|
36752
|
+
default:
|
|
36753
|
+
return void 0;
|
|
36754
|
+
}
|
|
36755
|
+
}
|
|
36756
|
+
var unit2 = (dx, dz) => {
|
|
36757
|
+
const length2 = Math.hypot(dx, dz);
|
|
36758
|
+
return length2 === 0 ? [1, 0] : [dx / length2, dz / length2];
|
|
36759
|
+
};
|
|
36760
|
+
var planOf2 = (graph, id, from) => {
|
|
36761
|
+
const other = graph.nodes.get(id);
|
|
36762
|
+
return other === void 0 ? [0, 0] : [other.at[0] - from.at[0], other.at[2] - from.at[2]];
|
|
36763
|
+
};
|
|
36764
|
+
function alongOf(graph, node) {
|
|
36765
|
+
const edges = [...graph.outgoing(node.id), ...graph.incoming(node.id)];
|
|
36766
|
+
const square = edges.find((edge) => edge.kind === "storm_lateral" || edge.kind === "sewer_lateral" || edge.kind === "water_service");
|
|
36767
|
+
if (square !== void 0) {
|
|
36768
|
+
const [dx2, dz2] = planOf2(graph, square.from === node.id ? square.to : square.from, node);
|
|
36769
|
+
return unit2(-dz2, dx2);
|
|
36770
|
+
}
|
|
36771
|
+
const along2 = edges.find((edge) => edge.kind === "storm_gutter" || edge.kind === "storm_gallery" || edge.kind === "sewer_main");
|
|
36772
|
+
if (along2 === void 0) return [1, 0];
|
|
36773
|
+
const [dx, dz] = planOf2(graph, along2.from === node.id ? along2.to : along2.from, node);
|
|
36774
|
+
return unit2(dx, dz);
|
|
36775
|
+
}
|
|
36776
|
+
function headingOf(graph, node) {
|
|
36777
|
+
if (node.kind === "outfall") {
|
|
36778
|
+
const into = graph.incoming(node.id).find((edge) => edge.kind === "storm_gallery");
|
|
36779
|
+
const [bx, bz] = into === void 0 ? [0, -1] : planOf2(graph, into.from, node);
|
|
36780
|
+
const [fx, fz] = unit2(-bx, -bz);
|
|
36781
|
+
return Math.atan2(fx, fz);
|
|
36782
|
+
}
|
|
36783
|
+
const [dx, dz] = alongOf(graph, node);
|
|
36784
|
+
return Math.atan2(-dz, dx);
|
|
36785
|
+
}
|
|
36786
|
+
var ROAD_SURFACE_LEVEL = 0.02;
|
|
36787
|
+
function surfacePiecesOf(networks, options = {}) {
|
|
36788
|
+
const graph = buildNetworkGraph(networks);
|
|
36789
|
+
const lift = (node) => options.surfaceAt?.(node.at[0], node.at[2]) === "road" ? options.roadLevel ?? ROAD_SURFACE_LEVEL : 0;
|
|
36790
|
+
const taken = [];
|
|
36791
|
+
return networks.nodes.flatMap((node) => {
|
|
36792
|
+
const spec = specOf(node);
|
|
36793
|
+
if (spec === void 0) return [];
|
|
36794
|
+
const reach = spec.size[0] + 0.12;
|
|
36795
|
+
if (taken.some((other) => other.kind === spec.kind && Math.hypot(other.x - node.at[0], other.z - node.at[2]) < reach)) return [];
|
|
36796
|
+
taken.push({ kind: spec.kind, x: node.at[0], z: node.at[2] });
|
|
36797
|
+
const { shaft, ...piece } = spec;
|
|
36798
|
+
const bottom = node.invert;
|
|
36799
|
+
return [{ id: node.id, ...piece, at: [node.at[0], node.at[1] + lift(node), node.at[2]], ry: headingOf(graph, node), spec: node.spec, ...shaft === void 0 || bottom === void 0 ? {} : { shaft: { ...shaft, top: node.at[1] + lift(node), bottom } } }];
|
|
36800
|
+
});
|
|
36801
|
+
}
|
|
36802
|
+
var CONTENT = {
|
|
36803
|
+
sewer_main: "sewage",
|
|
36804
|
+
sewer_lateral: "sewage",
|
|
36805
|
+
storm_gallery: "stormwater",
|
|
36806
|
+
storm_lateral: "stormwater",
|
|
36807
|
+
water_main: "water",
|
|
36808
|
+
water_service: "water"
|
|
36809
|
+
};
|
|
36810
|
+
var MATERIAL_OF = { sewage: "plastic", water: "plastic", stormwater: "concrete" };
|
|
36811
|
+
var WALL_SHARE = 0.12;
|
|
36812
|
+
var HYDRANT_BRANCH_SHARE = 0.8;
|
|
36813
|
+
function pipePiecesOf(networks) {
|
|
36814
|
+
const nodes = new Map(networks.nodes.map((node) => [node.id, node]));
|
|
36815
|
+
return networks.edges.flatMap((edge) => {
|
|
36816
|
+
const content = isAerialEdgeKind(edge.kind) ? void 0 : CONTENT[edge.kind];
|
|
36817
|
+
const [from, to] = [nodes.get(edge.from), nodes.get(edge.to)];
|
|
36818
|
+
if (content === void 0 || from === void 0 || to === void 0 || edge.diameter === void 0) return [];
|
|
36819
|
+
const inverts = edge.inverts ?? (from.invert !== void 0 && to.invert !== void 0 ? [from.invert, to.invert] : void 0);
|
|
36820
|
+
if (inverts === void 0) return [];
|
|
36821
|
+
const diameter = edge.diameter * (1 + WALL_SHARE) * (to.kind === "hydrant" ? HYDRANT_BRANCH_SHARE : 1);
|
|
36822
|
+
const centre = (invert) => invert + edge.diameter / 2;
|
|
36823
|
+
return [{ id: edge.id, kind: edge.kind, content, from: [from.at[0], centre(inverts[0]), from.at[2]], to: [to.at[0], centre(inverts[1]), to.at[2]], diameter, material: MATERIAL_OF[content], ground: [from.at[1], to.at[1]] }];
|
|
36824
|
+
});
|
|
36825
|
+
}
|
|
36826
|
+
var COVER_PLATE_PART = "plate";
|
|
36636
36827
|
|
|
36637
36828
|
// src/networks/draw-pieces.ts
|
|
36638
36829
|
var CYLINDER_SEGMENTS = 10;
|
|
36639
|
-
function drawPieces(THREE, { masts, boxes, cylinders, specOf }) {
|
|
36830
|
+
function drawPieces(THREE, { masts, boxes, cylinders, specOf: specOf2 }) {
|
|
36640
36831
|
const T = shapeGeometries(THREE);
|
|
36641
36832
|
const owned = [];
|
|
36642
36833
|
const meshes = [];
|
|
@@ -36657,7 +36848,7 @@ var GameUrbanThree = (() => {
|
|
|
36657
36848
|
return mesh2;
|
|
36658
36849
|
};
|
|
36659
36850
|
for (const specId of new Set(masts.map((mast) => mast.specId))) {
|
|
36660
|
-
const { mast } =
|
|
36851
|
+
const { mast } = specOf2(specId);
|
|
36661
36852
|
const geometry = new T.CylinderGeometry(mast.radiusTop, mast.radiusBottom, mast.height, mast.segments ?? 4).rotateY(Math.PI / 4).translate(0, mast.height / 2, 0);
|
|
36662
36853
|
const own = masts.filter((item) => item.specId === specId);
|
|
36663
36854
|
const mesh2 = instanced(geometry, new THREE.MeshStandardMaterial({ color: mast.color, roughness: 0.9 }), own.length, `network:masts:${specId}`);
|
|
@@ -36789,10 +36980,10 @@ var GameUrbanThree = (() => {
|
|
|
36789
36980
|
function cablesAt(index, pole) {
|
|
36790
36981
|
return Math.max(0, ...(index.at.get(pole.id) ?? []).filter((edge) => edge.kind === "telecom_span").map((edge) => edge.conductors ?? 1));
|
|
36791
36982
|
}
|
|
36792
|
-
function poleFramesOf({ networks, index, specOf }) {
|
|
36983
|
+
function poleFramesOf({ networks, index, specOf: specOf2 }) {
|
|
36793
36984
|
return networks.nodes.filter((node) => node.kind === "pole").map((node) => {
|
|
36794
36985
|
const specId = node.spec ?? "concrete_distribution";
|
|
36795
|
-
const spec =
|
|
36986
|
+
const spec = specOf2(specId);
|
|
36796
36987
|
const road = roadOf(index, node);
|
|
36797
36988
|
const hardware = distributionHardwareOf(spec, {
|
|
36798
36989
|
mv: node.carries.includes("power_mv"),
|
|
@@ -37014,13 +37205,13 @@ var GameUrbanThree = (() => {
|
|
|
37014
37205
|
};
|
|
37015
37206
|
function drawNetworks(THREE, { networks, options, budget, physicalLights }) {
|
|
37016
37207
|
const root = markKitOrigin(options.root ?? new THREE.Group(), { owner: "game-urban-three", kind: "networks" });
|
|
37017
|
-
const
|
|
37208
|
+
const specOf2 = specResolver(options.poles);
|
|
37018
37209
|
const index = indexOf(networks);
|
|
37019
|
-
const frames = new Map(poleFramesOf({ networks, index, specOf }).map((frame) => [frame.id, frame]));
|
|
37210
|
+
const frames = new Map(poleFramesOf({ networks, index, specOf: specOf2 }).map((frame) => [frame.id, frame]));
|
|
37020
37211
|
const guys = guysOf({ index, frames, ...options.surfaceAt ? { surfaceAt: options.surfaceAt } : {} });
|
|
37021
37212
|
const wires = drawWires2(THREE, { runs: wireRunsOf({ frames, index }, networks.edges), guys });
|
|
37022
37213
|
const pieces = piecesOf({ frames, index, guys });
|
|
37023
|
-
const drawn = drawPieces(THREE, { masts: pieces.masts, boxes: pieces.boxes, cylinders: pieces.cylinders, specOf });
|
|
37214
|
+
const drawn = drawPieces(THREE, { masts: pieces.masts, boxes: pieces.boxes, cylinders: pieces.cylinders, specOf: specOf2 });
|
|
37024
37215
|
const lamps = networkLampsOf({ networks, shares: options.lamps ?? ALL_LAMPS_WORK, isNight: options.isNight ?? false });
|
|
37025
37216
|
const byPole = new Map(lamps.map((lamp) => [lamp.pole, lamp]));
|
|
37026
37217
|
const lensMaterial = new THREE.MeshBasicMaterial({ color: 16777215 });
|
|
@@ -37082,6 +37273,296 @@ var GameUrbanThree = (() => {
|
|
|
37082
37273
|
};
|
|
37083
37274
|
}
|
|
37084
37275
|
|
|
37276
|
+
// src/networks/draw-buried.ts
|
|
37277
|
+
var PIPE_COLOR = { sewage: 12090186, water: 3108014, stormwater: 9342343 };
|
|
37278
|
+
var SHAFT_COLOR = { concrete: 9342343, plastic: 12090186, cast_iron: 3882562 };
|
|
37279
|
+
var PIPE_SEGMENTS = 8;
|
|
37280
|
+
var SHAFT_SEGMENTS = 14;
|
|
37281
|
+
var BREAK_GAP = 1.2;
|
|
37282
|
+
var FLOOR = 0.1;
|
|
37283
|
+
var ROOF_DEPTH = 4e-3;
|
|
37284
|
+
function drawBuried(THREE, { networks, root, options }) {
|
|
37285
|
+
const T = shapeGeometries(THREE);
|
|
37286
|
+
const group = markKitOrigin(root ?? new THREE.Group(), { owner: "game-urban-three", kind: "network-buried" });
|
|
37287
|
+
const pipes = pipePiecesOf(networks);
|
|
37288
|
+
const shafts = surfacePiecesOf(networks, options).flatMap((piece) => piece.shaft === void 0 ? [] : [{ piece, shaft: piece.shaft }]);
|
|
37289
|
+
const round2 = shafts.filter(({ shaft }) => shaft.shape === "round");
|
|
37290
|
+
const square = shafts.filter(({ shaft }) => shaft.shape === "square");
|
|
37291
|
+
const material = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.85 });
|
|
37292
|
+
const openMaterial = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.85, side: THREE.DoubleSide });
|
|
37293
|
+
const geometries = [new T.CylinderGeometry(1, 1, 1, PIPE_SEGMENTS), new T.CylinderGeometry(1, 1, 1, SHAFT_SEGMENTS, 1, true), new T.BoxGeometry(1, 1, 1)];
|
|
37294
|
+
const make2 = (geometry, count, name, using) => {
|
|
37295
|
+
const mesh2 = new THREE.InstancedMesh(geometry, using, Math.max(count, 1));
|
|
37296
|
+
mesh2.name = name;
|
|
37297
|
+
mesh2.count = count;
|
|
37298
|
+
mesh2.frustumCulled = false;
|
|
37299
|
+
return mesh2;
|
|
37300
|
+
};
|
|
37301
|
+
const pipeMesh = make2(geometries[0], pipes.length * 2, "network:buried:pipes", material);
|
|
37302
|
+
const roundMesh = make2(geometries[1], round2.length, "network:buried:shafts", openMaterial);
|
|
37303
|
+
const squareMesh = make2(geometries[2], square.length, "network:buried:boxes", material);
|
|
37304
|
+
const up = new THREE.Vector3(0, 1, 0);
|
|
37305
|
+
const matrix = new THREE.Matrix4();
|
|
37306
|
+
const color2 = new THREE.Color();
|
|
37307
|
+
const place = (mesh2, slot, from, to, radius) => {
|
|
37308
|
+
const axis = new THREE.Vector3(to[0] - from[0], to[1] - from[1], to[2] - from[2]);
|
|
37309
|
+
const length = axis.length();
|
|
37310
|
+
const quaternion = new THREE.Quaternion().setFromUnitVectors(up, length === 0 ? up : axis.clone().normalize());
|
|
37311
|
+
mesh2.setMatrixAt(slot, matrix.compose(new THREE.Vector3((from[0] + to[0]) / 2, (from[1] + to[1]) / 2, (from[2] + to[2]) / 2), quaternion, new THREE.Vector3(radius, length, radius)));
|
|
37312
|
+
};
|
|
37313
|
+
const along2 = (pipe, share) => [pipe.from[0] + (pipe.to[0] - pipe.from[0]) * share, pipe.from[1] + (pipe.to[1] - pipe.from[1]) * share, pipe.from[2] + (pipe.to[2] - pipe.from[2]) * share];
|
|
37314
|
+
const trimmed = (pipe, index) => {
|
|
37315
|
+
const length = Math.hypot(pipe.to[0] - pipe.from[0], pipe.to[1] - pipe.from[1], pipe.to[2] - pipe.from[2]);
|
|
37316
|
+
if (length < 0.1) return pipe;
|
|
37317
|
+
const [start, end] = [(index % 7 + 1) * 3e-3, (index % 5 + 1) * 4e-3];
|
|
37318
|
+
const at = (share) => along2(pipe, share);
|
|
37319
|
+
return { ...pipe, from: at(start / length), to: at(1 - end / length) };
|
|
37320
|
+
};
|
|
37321
|
+
const halves = (whole, index, gap) => {
|
|
37322
|
+
const pipe = trimmed(whole, index);
|
|
37323
|
+
if (gap[0] === gap[1]) {
|
|
37324
|
+
place(pipeMesh, index * 2, pipe.from, pipe.to, pipe.diameter / 2);
|
|
37325
|
+
pipeMesh.setMatrixAt(index * 2 + 1, matrix.makeScale(0, 0, 0));
|
|
37326
|
+
return;
|
|
37327
|
+
}
|
|
37328
|
+
place(pipeMesh, index * 2, pipe.from, along2(pipe, gap[0]), pipe.diameter / 2);
|
|
37329
|
+
place(pipeMesh, index * 2 + 1, along2(pipe, gap[1]), pipe.to, pipe.diameter / 2);
|
|
37330
|
+
};
|
|
37331
|
+
const slotOf = new Map(pipes.map((pipe, index) => [pipe.id, index]));
|
|
37332
|
+
pipes.forEach((pipe, index) => {
|
|
37333
|
+
halves(pipe, index, [0.5, 0.5]);
|
|
37334
|
+
for (const slot of [index * 2, index * 2 + 1]) pipeMesh.setColorAt(slot, color2.set(PIPE_COLOR[pipe.content]));
|
|
37335
|
+
});
|
|
37336
|
+
round2.forEach(({ piece, shaft }, slot) => {
|
|
37337
|
+
const [x, , z] = piece.at;
|
|
37338
|
+
place(roundMesh, slot, [x, shaft.bottom - FLOOR, z], [x, shaft.top, z], shaft.width / 2);
|
|
37339
|
+
roundMesh.setColorAt(slot, color2.set(SHAFT_COLOR[shaft.material]));
|
|
37340
|
+
});
|
|
37341
|
+
square.forEach(({ piece, shaft }, slot) => {
|
|
37342
|
+
const height = shaft.top - ROOF_DEPTH - shaft.bottom + FLOOR;
|
|
37343
|
+
squareMesh.setMatrixAt(slot, matrix.compose(new THREE.Vector3(piece.at[0], shaft.top - ROOF_DEPTH - height / 2, piece.at[2]), new THREE.Quaternion().setFromAxisAngle(up, piece.ry), new THREE.Vector3(shaft.width, height, shaft.depth)));
|
|
37344
|
+
squareMesh.setColorAt(slot, color2.set(SHAFT_COLOR[shaft.material]));
|
|
37345
|
+
});
|
|
37346
|
+
group.add(pipeMesh, roundMesh, squareMesh);
|
|
37347
|
+
return {
|
|
37348
|
+
root: group,
|
|
37349
|
+
pipes,
|
|
37350
|
+
drawCalls: () => [pipeMesh, roundMesh, squareMesh].filter((mesh2) => mesh2.count > 0).length,
|
|
37351
|
+
sever(id, share) {
|
|
37352
|
+
const index = slotOf.get(id);
|
|
37353
|
+
const pipe = index === void 0 ? void 0 : pipes[index];
|
|
37354
|
+
if (index === void 0 || pipe === void 0) return;
|
|
37355
|
+
const length = Math.hypot(pipe.to[0] - pipe.from[0], pipe.to[1] - pipe.from[1], pipe.to[2] - pipe.from[2]);
|
|
37356
|
+
const half = Math.min(0.5, BREAK_GAP / 2 / Math.max(length, 1e-6));
|
|
37357
|
+
halves(pipe, index, [Math.max(0, share - half), Math.min(1, share + half)]);
|
|
37358
|
+
pipeMesh.instanceMatrix.needsUpdate = true;
|
|
37359
|
+
},
|
|
37360
|
+
mend(id) {
|
|
37361
|
+
const index = slotOf.get(id);
|
|
37362
|
+
const pipe = index === void 0 ? void 0 : pipes[index];
|
|
37363
|
+
if (index === void 0 || pipe === void 0) return;
|
|
37364
|
+
halves(pipe, index, [0.5, 0.5]);
|
|
37365
|
+
pipeMesh.instanceMatrix.needsUpdate = true;
|
|
37366
|
+
},
|
|
37367
|
+
dispose() {
|
|
37368
|
+
group.parent?.remove(group);
|
|
37369
|
+
for (const mesh2 of [pipeMesh, roundMesh, squareMesh]) mesh2.dispose();
|
|
37370
|
+
for (const item of [...geometries, material, openMaterial]) item.dispose();
|
|
37371
|
+
}
|
|
37372
|
+
};
|
|
37373
|
+
}
|
|
37374
|
+
|
|
37375
|
+
// src/networks/surface-parts.ts
|
|
37376
|
+
var IRON2 = 3882562;
|
|
37377
|
+
var IRON_WORN = 5593438;
|
|
37378
|
+
var CONCRETE2 = 10197652;
|
|
37379
|
+
var CONCRETE_LID = 11052960;
|
|
37380
|
+
var VOID = 723724;
|
|
37381
|
+
var HYDRANT_RED = 11545122;
|
|
37382
|
+
var FRAME_TOP = 2e-3;
|
|
37383
|
+
var LID_TOP = 4e-3;
|
|
37384
|
+
var RIB_TOP = 9e-3;
|
|
37385
|
+
var CROSS_RIB_TOP = 0.011;
|
|
37386
|
+
var THICK = 0.03;
|
|
37387
|
+
var flat = (shape, top, size, color2) => shape === "box" ? { shape, centre: [0, top - THICK / 2, 0], size: [size[0], THICK, size[1]], color: color2 } : { shape, centre: [0, top - THICK / 2, 0], size: [size[0], THICK, size[0]], color: color2 };
|
|
37388
|
+
var rib = (size, top, at) => ({ shape: "box", centre: [at[0], top - size[1] / 2, at[1]], size, color: IRON_WORN });
|
|
37389
|
+
function cover(piece) {
|
|
37390
|
+
const [width, , depth] = piece.size;
|
|
37391
|
+
const shape = piece.shape === "round" ? "cylinder" : "box";
|
|
37392
|
+
const [frame, lid] = piece.shape === "round" ? [(width + 0.12) / 2, width / 2] : [width + 0.12, width];
|
|
37393
|
+
const colors2 = piece.material === "concrete" ? [IRON2, CONCRETE_LID] : [IRON2, IRON_WORN];
|
|
37394
|
+
const parts = [flat(shape, FRAME_TOP, [frame, piece.shape === "round" ? frame : depth + 0.12], colors2[0]), flat(shape, LID_TOP, [lid, piece.shape === "round" ? lid : depth], colors2[1])];
|
|
37395
|
+
if (piece.kind === "inspection_cover") return [...parts, rib([0.14, 6e-3, 0.03], RIB_TOP, [0, 0])];
|
|
37396
|
+
if (piece.shape === "round") return [...parts, rib([lid * 1.7, 5e-3, 0.04], RIB_TOP, [0, 0]), rib([0.04, 5e-3, lid * 1.7], CROSS_RIB_TOP, [0, 0])];
|
|
37397
|
+
return [...parts, ...[-0.15, 0, 0.15].map((z) => rib([lid * 0.85, 5e-3, 0.03], RIB_TOP, [0, z]))];
|
|
37398
|
+
}
|
|
37399
|
+
function grate() {
|
|
37400
|
+
const bars = [-0.2, -0.1, 0, 0.1, 0.2].map((z) => ({ shape: "box", centre: [0, RIB_TOP - 6e-3, z], size: [0.9, 0.012, 0.025], color: IRON_WORN }));
|
|
37401
|
+
const brace = { shape: "box", centre: [0, 55e-4, 0], size: [0.03, 3e-3, 0.5], color: IRON2 };
|
|
37402
|
+
return [
|
|
37403
|
+
{ shape: "box", centre: [0, FRAME_TOP - THICK / 2, 0], size: [1, THICK, 0.6], color: IRON2 },
|
|
37404
|
+
{ shape: "box", centre: [0, 25e-4, 0], size: [0.9, 1e-3, 0.5], color: VOID },
|
|
37405
|
+
...bars,
|
|
37406
|
+
brace
|
|
37407
|
+
];
|
|
37408
|
+
}
|
|
37409
|
+
function hydrant() {
|
|
37410
|
+
const part = (y, radius, length, axis, at = [0, 0]) => ({ shape: "cylinder", centre: [at[0], y, at[1]], size: [radius, length, radius], axis, color: HYDRANT_RED });
|
|
37411
|
+
return [part(0.02, 0.1, 0.04, "y"), part(0.38, 0.065, 0.68, "y"), part(0.74, 0.085, 0.06, "y"), part(0.55, 0.032, 0.26, "x"), part(0.5, 0.045, 0.14, "z", [0, 0.1])];
|
|
37412
|
+
}
|
|
37413
|
+
function wingWall(piece) {
|
|
37414
|
+
const [width, height, depth] = piece.size;
|
|
37415
|
+
return [
|
|
37416
|
+
{ shape: "box", centre: [0, (height - 0.4) / 2, 0], size: [width, height + 0.4, 0.25], color: CONCRETE2 },
|
|
37417
|
+
...[-1, 1].map((side) => ({ shape: "box", centre: [side * (width / 2 - 0.135), (height - 0.2 - 0.4) / 2 + 0.01, depth / 2], size: [0.25, height - 0.2 + 0.4 - 0.02, depth], color: CONCRETE2 })),
|
|
37418
|
+
{ shape: "box", centre: [0, 0.01 - 0.075, depth / 2], size: [width - 0.6, 0.15, depth - 0.1], color: CONCRETE_LID }
|
|
37419
|
+
];
|
|
37420
|
+
}
|
|
37421
|
+
function meterBox(piece) {
|
|
37422
|
+
const [width, height, depth] = piece.size;
|
|
37423
|
+
return [
|
|
37424
|
+
{ shape: "box", centre: [0, height / 2, 0], size: [width, height, depth], color: CONCRETE2 },
|
|
37425
|
+
{ shape: "box", centre: [0, height, 0], size: [width - 0.06, 8e-3, depth - 0.06], color: IRON2 }
|
|
37426
|
+
];
|
|
37427
|
+
}
|
|
37428
|
+
function mouth() {
|
|
37429
|
+
return [
|
|
37430
|
+
{ shape: "box", centre: [0, FRAME_TOP - 0.01, 0], size: [0.3, 0.02, 0.2], color: CONCRETE2 },
|
|
37431
|
+
{ shape: "box", centre: [0, 25e-4, 0], size: [0.2, 1e-3, 0.08], color: VOID }
|
|
37432
|
+
];
|
|
37433
|
+
}
|
|
37434
|
+
function partsOf(piece) {
|
|
37435
|
+
switch (piece.kind) {
|
|
37436
|
+
case "inlet_grate":
|
|
37437
|
+
return grate();
|
|
37438
|
+
case "hydrant":
|
|
37439
|
+
return hydrant();
|
|
37440
|
+
case "wing_wall":
|
|
37441
|
+
return wingWall(piece);
|
|
37442
|
+
case "meter_box":
|
|
37443
|
+
return meterBox(piece);
|
|
37444
|
+
case "downspout_mouth":
|
|
37445
|
+
return mouth();
|
|
37446
|
+
default:
|
|
37447
|
+
return cover(piece);
|
|
37448
|
+
}
|
|
37449
|
+
}
|
|
37450
|
+
|
|
37451
|
+
// src/networks/draw-lid.ts
|
|
37452
|
+
var CYLINDER_SEGMENTS2 = 14;
|
|
37453
|
+
function drawLid(THREE, piece) {
|
|
37454
|
+
const T = shapeGeometries(THREE);
|
|
37455
|
+
const [frame, second, ...over] = partsOf(piece);
|
|
37456
|
+
const [lid, ...ribs] = piece.kind === "inlet_grate" ? [frame, ...over] : second === void 0 ? [] : [second, ...over];
|
|
37457
|
+
if (lid === void 0) throw new Error(`game-urban-three: "${piece.id}" has no lid to draw`);
|
|
37458
|
+
const lift = lid.size[1] / 2 - lid.centre[1];
|
|
37459
|
+
const group = markKitOrigin(new THREE.Group(), { owner: "game-urban-three", kind: "network-lid" });
|
|
37460
|
+
group.name = `network:lid:${piece.id}`;
|
|
37461
|
+
const geometries = { box: new T.BoxGeometry(1, 1, 1), cylinder: new T.CylinderGeometry(1, 1, 1, CYLINDER_SEGMENTS2) };
|
|
37462
|
+
const materials = /* @__PURE__ */ new Map();
|
|
37463
|
+
const axisTurn = { x: [0, 0, Math.PI / 2], y: [0, 0, 0], z: [Math.PI / 2, 0, 0] };
|
|
37464
|
+
for (const part of [lid, ...ribs]) {
|
|
37465
|
+
let material = materials.get(part.color);
|
|
37466
|
+
if (material === void 0) materials.set(part.color, material = new THREE.MeshStandardMaterial({ color: part.color, roughness: 0.7, metalness: 0.2 }));
|
|
37467
|
+
const mesh2 = new THREE.Mesh(geometries[part.shape], material);
|
|
37468
|
+
mesh2.position.set(part.centre[0], part.centre[1] + lift, part.centre[2]);
|
|
37469
|
+
mesh2.scale.set(part.size[0], part.size[1], part.size[2]);
|
|
37470
|
+
const [turnX, turnY, turnZ] = axisTurn[part.axis ?? "y"];
|
|
37471
|
+
mesh2.rotation.set(turnX, turnY, turnZ);
|
|
37472
|
+
mesh2.userData.destructionPart = COVER_PLATE_PART;
|
|
37473
|
+
mesh2.castShadow = true;
|
|
37474
|
+
mesh2.receiveShadow = true;
|
|
37475
|
+
group.add(mesh2);
|
|
37476
|
+
}
|
|
37477
|
+
return {
|
|
37478
|
+
root: group,
|
|
37479
|
+
dispose() {
|
|
37480
|
+
group.parent?.remove(group);
|
|
37481
|
+
for (const geometry of Object.values(geometries)) geometry.dispose();
|
|
37482
|
+
for (const material of materials.values()) material.dispose();
|
|
37483
|
+
}
|
|
37484
|
+
};
|
|
37485
|
+
}
|
|
37486
|
+
|
|
37487
|
+
// src/networks/draw-surface.ts
|
|
37488
|
+
var CYLINDER_SEGMENTS3 = 14;
|
|
37489
|
+
function drawSurface(THREE, { networks, pieces, root, options }) {
|
|
37490
|
+
const list2 = pieces ?? surfacePiecesOf(networks ?? { nodes: [], edges: [] }, options);
|
|
37491
|
+
const T = shapeGeometries(THREE);
|
|
37492
|
+
const group = markKitOrigin(root ?? new THREE.Group(), { owner: "game-urban-three", kind: "network-surface" });
|
|
37493
|
+
const boxes = [];
|
|
37494
|
+
const cylinders = [];
|
|
37495
|
+
const ranges = /* @__PURE__ */ new Map();
|
|
37496
|
+
for (const piece of list2) {
|
|
37497
|
+
const parts = partsOf(piece);
|
|
37498
|
+
const range2 = { box: [boxes.length, 0], cylinder: [cylinders.length, 0] };
|
|
37499
|
+
for (const part of parts) (part.shape === "box" ? boxes : cylinders).push({ piece, part });
|
|
37500
|
+
range2.box[1] = boxes.length - range2.box[0];
|
|
37501
|
+
range2.cylinder[1] = cylinders.length - range2.cylinder[0];
|
|
37502
|
+
ranges.set(piece.id, range2);
|
|
37503
|
+
}
|
|
37504
|
+
const material = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.7, metalness: 0.2 });
|
|
37505
|
+
const boxGeometry = new T.BoxGeometry(1, 1, 1);
|
|
37506
|
+
const cylinderGeometry = new T.CylinderGeometry(1, 1, 1, CYLINDER_SEGMENTS3);
|
|
37507
|
+
const matrix = new THREE.Matrix4();
|
|
37508
|
+
const turn = new THREE.Quaternion();
|
|
37509
|
+
const spin = new THREE.Quaternion();
|
|
37510
|
+
const local = new THREE.Matrix4();
|
|
37511
|
+
const color2 = new THREE.Color();
|
|
37512
|
+
const axisTurn = { x: new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 0, 1), Math.PI / 2), y: new THREE.Quaternion(), z: new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(1, 0, 0), Math.PI / 2) };
|
|
37513
|
+
const fill2 = (mesh2, items, [start, count] = [0, items.length]) => {
|
|
37514
|
+
for (let slot = start; slot < start + count; slot++) {
|
|
37515
|
+
const { piece, part } = items[slot];
|
|
37516
|
+
turn.setFromAxisAngle(new THREE.Vector3(0, 1, 0), piece.ry);
|
|
37517
|
+
matrix.compose(new THREE.Vector3(piece.at[0], piece.at[1], piece.at[2]), turn, new THREE.Vector3(1, 1, 1));
|
|
37518
|
+
spin.copy(axisTurn[part.axis ?? "y"]);
|
|
37519
|
+
local.compose(new THREE.Vector3(...part.centre), spin, new THREE.Vector3(...part.size));
|
|
37520
|
+
mesh2.setMatrixAt(slot, matrix.multiply(local));
|
|
37521
|
+
mesh2.setColorAt(slot, color2.set(part.color));
|
|
37522
|
+
}
|
|
37523
|
+
};
|
|
37524
|
+
const make2 = (geometry, items, name) => {
|
|
37525
|
+
const mesh2 = new THREE.InstancedMesh(geometry, material, Math.max(items.length, 1));
|
|
37526
|
+
mesh2.name = name;
|
|
37527
|
+
mesh2.count = items.length;
|
|
37528
|
+
mesh2.receiveShadow = true;
|
|
37529
|
+
fill2(mesh2, items);
|
|
37530
|
+
return mesh2;
|
|
37531
|
+
};
|
|
37532
|
+
const boxMesh = make2(boxGeometry, boxes, "network:surface:boxes");
|
|
37533
|
+
const cylinderMesh = make2(cylinderGeometry, cylinders, "network:surface:cylinders");
|
|
37534
|
+
group.add(boxMesh, cylinderMesh);
|
|
37535
|
+
const hide = (mesh2, [start, count]) => {
|
|
37536
|
+
matrix.makeScale(0, 0, 0);
|
|
37537
|
+
for (let slot = start; slot < start + count; slot++) mesh2.setMatrixAt(slot, matrix);
|
|
37538
|
+
mesh2.instanceMatrix.needsUpdate = true;
|
|
37539
|
+
};
|
|
37540
|
+
return {
|
|
37541
|
+
root: group,
|
|
37542
|
+
pieces: list2,
|
|
37543
|
+
drawCalls: () => [boxMesh, cylinderMesh].filter((mesh2) => mesh2.count > 0).length,
|
|
37544
|
+
remove(id) {
|
|
37545
|
+
const range2 = ranges.get(id);
|
|
37546
|
+
if (range2 === void 0) return;
|
|
37547
|
+
hide(boxMesh, range2.box);
|
|
37548
|
+
hide(cylinderMesh, range2.cylinder);
|
|
37549
|
+
},
|
|
37550
|
+
restore(id) {
|
|
37551
|
+
const range2 = ranges.get(id);
|
|
37552
|
+
if (range2 === void 0) return;
|
|
37553
|
+
fill2(boxMesh, boxes, range2.box);
|
|
37554
|
+
fill2(cylinderMesh, cylinders, range2.cylinder);
|
|
37555
|
+
boxMesh.instanceMatrix.needsUpdate = true;
|
|
37556
|
+
cylinderMesh.instanceMatrix.needsUpdate = true;
|
|
37557
|
+
},
|
|
37558
|
+
dispose() {
|
|
37559
|
+
group.parent?.remove(group);
|
|
37560
|
+
for (const mesh2 of [boxMesh, cylinderMesh]) mesh2.dispose();
|
|
37561
|
+
for (const item of [boxGeometry, cylinderGeometry, material]) item.dispose();
|
|
37562
|
+
}
|
|
37563
|
+
};
|
|
37564
|
+
}
|
|
37565
|
+
|
|
37085
37566
|
// src/draw.ts
|
|
37086
37567
|
var DEFAULT_ROUGHNESS = 0.9;
|
|
37087
37568
|
var DEFAULT_METALNESS = 0;
|
|
@@ -37096,13 +37577,13 @@ var GameUrbanThree = (() => {
|
|
|
37096
37577
|
const geometries = /* @__PURE__ */ new Map();
|
|
37097
37578
|
const materials = /* @__PURE__ */ new Map();
|
|
37098
37579
|
const disposables = [];
|
|
37099
|
-
const standard = (color2, style,
|
|
37580
|
+
const standard = (color2, style, flat2 = false) => {
|
|
37100
37581
|
const roughness = style?.roughness ?? DEFAULT_ROUGHNESS;
|
|
37101
37582
|
const metalness = style?.metalness ?? DEFAULT_METALNESS;
|
|
37102
|
-
const key = `s|${color2}|${roughness}|${metalness}|${
|
|
37583
|
+
const key = `s|${color2}|${roughness}|${metalness}|${flat2 ? 1 : 0}`;
|
|
37103
37584
|
let material = materials.get(key);
|
|
37104
37585
|
if (!material) {
|
|
37105
|
-
material = new THREE.MeshStandardMaterial({ color: color2, roughness, metalness, flatShading:
|
|
37586
|
+
material = new THREE.MeshStandardMaterial({ color: color2, roughness, metalness, flatShading: flat2 });
|
|
37106
37587
|
materials.set(key, material);
|
|
37107
37588
|
}
|
|
37108
37589
|
return material;
|
|
@@ -37439,7 +37920,10 @@ var GameUrbanThree = (() => {
|
|
|
37439
37920
|
};
|
|
37440
37921
|
}
|
|
37441
37922
|
const networks = (data, drawOptions = {}) => drawNetworks(THREE, { networks: data, options: drawOptions, ...options.lights ? { budget: options.lights } : {}, ...options.physicalLights ? { physicalLights: true } : {} });
|
|
37442
|
-
|
|
37923
|
+
const networkSurface = (data, surfaceOptions) => drawSurface(THREE, { networks: data, ...surfaceOptions ? { options: surfaceOptions } : {} });
|
|
37924
|
+
const buriedNetworks = (data, surfaceOptions) => drawBuried(THREE, { networks: data, ...surfaceOptions ? { options: surfaceOptions } : {} });
|
|
37925
|
+
const coverLid = (piece) => drawLid(THREE, piece);
|
|
37926
|
+
return { THREE, draw, drawNetworks: networks, drawNetworkSurface: networkSurface, drawBuriedNetworks: buriedNetworks, drawCoverLid: coverLid };
|
|
37443
37927
|
}
|
|
37444
37928
|
|
|
37445
37929
|
// ../game-vegetation/dist/chunk-57VLOYXL.js
|
|
@@ -38141,15 +38625,15 @@ var GameUrbanThree = (() => {
|
|
|
38141
38625
|
const ring2 = [];
|
|
38142
38626
|
for (let i = 0; i < S; i++) {
|
|
38143
38627
|
const ridge = i % 2 === 0;
|
|
38144
|
-
const
|
|
38628
|
+
const rib2 = i >> 1;
|
|
38145
38629
|
const a = i / S * TAU;
|
|
38146
38630
|
const dir = [f.n[0] * Math.cos(a) + f.b[0] * Math.sin(a), f.n[1] * Math.cos(a) + f.b[1] * Math.sin(a), f.n[2] * Math.cos(a) + f.b[2] * Math.sin(a)];
|
|
38147
|
-
const wob = o.rough ? o.rough(k,
|
|
38631
|
+
const wob = o.rough ? o.rough(k, rib2) : 0;
|
|
38148
38632
|
const rr = radii[k] * (ridge ? 1 + wob : o.valley);
|
|
38149
38633
|
const p = add(pts[k], mul(dir, rr));
|
|
38150
|
-
const c = o.color(Math.min(1, k / (path.length - 1)), ridge,
|
|
38634
|
+
const c = o.color(Math.min(1, k / (path.length - 1)), ridge, rib2);
|
|
38151
38635
|
ring2.push({ p, nr: dir, c });
|
|
38152
|
-
if (ridge && k < path.length) info.ridges.push({ p, n: dir, t: k / (path.length - 1), rib, ring: k });
|
|
38636
|
+
if (ridge && k < path.length) info.ridges.push({ p, n: dir, t: k / (path.length - 1), rib: rib2, ring: k });
|
|
38153
38637
|
}
|
|
38154
38638
|
rings.push(ring2);
|
|
38155
38639
|
}
|
|
@@ -38185,8 +38669,8 @@ var GameUrbanThree = (() => {
|
|
|
38185
38669
|
const lightTip = shade(base, 1.18);
|
|
38186
38670
|
return (t, a) => {
|
|
38187
38671
|
const band = 0.93 + 0.07 * Math.sin(t * (level === 0 ? 38 : 16) + seed);
|
|
38188
|
-
const
|
|
38189
|
-
let k = band *
|
|
38672
|
+
const rib2 = 0.92 + 0.08 * Math.cos(a * Math.PI * 2 * 3 + seed * 1.7 + t * 2.2);
|
|
38673
|
+
let k = band * rib2;
|
|
38190
38674
|
if (level === 0) k *= 0.8 + 0.2 * clamp3(t * 7, 0, 1);
|
|
38191
38675
|
const c = shade(base, k * 1.5);
|
|
38192
38676
|
return level === 0 ? c : mix(c, lightTip, clamp3(t * 0.8, 0, 1) * 0.5);
|
|
@@ -39968,9 +40452,9 @@ var GameUrbanThree = (() => {
|
|
|
39968
40452
|
const rings = ctx.pick(1, 0.7, 0.45);
|
|
39969
40453
|
const domeSteps = ctx.pick(2, 1, 1);
|
|
39970
40454
|
const spineOn = ctx.lod === 0 && ctx.condition !== "dead" ? 1 : ctx.lod === 0 ? 0.5 : 0;
|
|
39971
|
-
const bodyColor = (t, ridge,
|
|
40455
|
+
const bodyColor = (t, ridge, rib2) => {
|
|
39972
40456
|
let k = ridge ? 1.05 : 0.7;
|
|
39973
|
-
if (
|
|
40457
|
+
if (rib2 % 2 === 0) k *= 1.04;
|
|
39974
40458
|
const c = shade(base, k * (0.78 + 0.28 * Math.min(1, t * 1.4)));
|
|
39975
40459
|
return mix(c, lighten(base, 0.8), Math.max(0, t - 0.8) * 1.4 * (ridge ? 1 : 0.5));
|
|
39976
40460
|
};
|
|
@@ -39982,9 +40466,9 @@ var GameUrbanThree = (() => {
|
|
|
39982
40466
|
radii,
|
|
39983
40467
|
valley: 0.74,
|
|
39984
40468
|
dome: domeSteps,
|
|
39985
|
-
color: (t, ridge,
|
|
40469
|
+
color: (t, ridge, rib2) => bodyColor(t, ridge, rib2 + seedK),
|
|
39986
40470
|
sway: () => 0,
|
|
39987
|
-
rough: (ring2,
|
|
40471
|
+
rough: (ring2, rib2) => Math.sin(ring2 * 1.7 + rib2 * 2.3 + seedK) * 0.03
|
|
39988
40472
|
});
|
|
39989
40473
|
const last = path[path.length - 1];
|
|
39990
40474
|
const prev = path[path.length - 2];
|
|
@@ -40191,12 +40675,12 @@ var GameUrbanThree = (() => {
|
|
|
40191
40675
|
radii,
|
|
40192
40676
|
valley: 0.7,
|
|
40193
40677
|
dome: ctx.pick(2, 1, 1),
|
|
40194
|
-
color: (t, ridge,
|
|
40195
|
-
const k = (ridge ? 1.08 : 0.68) * (0.75 + 0.3 * t) * (
|
|
40678
|
+
color: (t, ridge, rib2) => {
|
|
40679
|
+
const k = (ridge ? 1.08 : 0.68) * (0.75 + 0.3 * t) * (rib2 % 2 ? 0.97 : 1.03);
|
|
40196
40680
|
return shade(base, k);
|
|
40197
40681
|
},
|
|
40198
40682
|
sway: () => 0,
|
|
40199
|
-
rough: (ring2,
|
|
40683
|
+
rough: (ring2, rib2) => Math.sin(ring2 * 2.1 + rib2 * 1.3) * 0.02
|
|
40200
40684
|
});
|
|
40201
40685
|
if (ctx.lod === 0) {
|
|
40202
40686
|
for (const rd of res.ridges) {
|
|
@@ -41450,7 +41934,7 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
41450
41934
|
};
|
|
41451
41935
|
m.customProgramCacheKey = () => "vegetation-sway-v1";
|
|
41452
41936
|
};
|
|
41453
|
-
const
|
|
41937
|
+
const flat2 = opts.flatShading !== false;
|
|
41454
41938
|
const rough = typeof opts.roughness === "number" ? opts.roughness : 0.85;
|
|
41455
41939
|
const make2 = (flatShading, double, roughness) => {
|
|
41456
41940
|
const m = new THREE.MeshStandardMaterial({
|
|
@@ -41464,9 +41948,9 @@ gl_Position = projectionMatrix * mvPosition;
|
|
|
41464
41948
|
return m;
|
|
41465
41949
|
};
|
|
41466
41950
|
const wood = make2(false, false, 0.95);
|
|
41467
|
-
const foliage = make2(
|
|
41468
|
-
const flowers = make2(
|
|
41469
|
-
const fruit = make2(
|
|
41951
|
+
const foliage = make2(flat2, true, rough);
|
|
41952
|
+
const flowers = make2(flat2, true, 0.7);
|
|
41953
|
+
const fruit = make2(flat2, false, 0.55);
|
|
41470
41954
|
const spines = make2(true, true, 0.8);
|
|
41471
41955
|
const dir = uniforms.uWindDir.value;
|
|
41472
41956
|
return {
|