@adatechnology/game-urban-three 0.5.2 → 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.
@@ -4592,13 +4592,13 @@ var GameUrbanThree = (() => {
4592
4592
  });
4593
4593
  }
4594
4594
  function registerGroundItems() {
4595
- const flat = { category: "ground_cover", w: 1, d: 1, h: 0, decor: true, mount: "ground", flat: true };
4595
+ const flat2 = { category: "ground_cover", w: 1, d: 1, h: 0, decor: true, mount: "ground", flat: true };
4596
4596
  registerItems([
4597
- { type: "lawn", ...flat, color: { role: "lawn" } },
4598
- { type: "tile_floor", ...flat, color: { role: "exterior_floor" } },
4599
- { type: "concrete", ...flat, color: { role: "exterior_floor" } },
4600
- { type: "deck_floor", ...flat, color: { role: "deck_floor" } },
4601
- { type: "dirt", ...flat, color: { role: "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" } }
4602
4602
  ]);
4603
4603
  }
4604
4604
  var slotKit = {
@@ -13346,16 +13346,16 @@ var GameUrbanThree = (() => {
13346
13346
  function boxBody(c, o) {
13347
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;
13348
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 });
13349
- const rib = o.armored ? CM("#4a535a", { metalness: 0.35, roughness: 0.5 }) : CM("#c4c7c3", { metalness: 0.25, roughness: 0.42 });
13349
+ const rib2 = o.armored ? CM("#4a535a", { metalness: 0.35, roughness: 0.5 }) : CM("#c4c7c3", { metalness: 0.25, roughness: 0.42 });
13350
13350
  const doorM = o.armored ? c.paint(o.col) : CM("#d9dbd6", { metalness: 0.15, roughness: 0.45 });
13351
13351
  c.roundBox(L - 0.1, 0.12, 0.2, 0.02, MT.trim, cx, y0 - 0.07, 0.43);
13352
13352
  c.roundBox(L - 0.1, 0.12, 0.2, 0.02, MT.trim, cx, y0 - 0.07, -0.43);
13353
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);
13354
13354
  [1, -1].forEach(function(s) {
13355
13355
  const zs = s * (W / 2 + 0.012);
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, rib, x, cy, zs);
13357
- c.roundBox(L + 0.02, 0.09, 0.04, 0.015, rib, cx, y0 + 0.04, s * (W / 2 + 0.018));
13358
- c.roundBox(L + 0.02, 0.07, 0.04, 0.015, rib, cx, y1 - 0.035, s * (W / 2 + 0.018));
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));
13359
13359
  [x0 - 0.15, cx, x1 + 0.2].forEach(function(xx) {
13360
13360
  c.roundBox(0.07, 0.06, 0.02, 0.01, MT.amber, xx, y0 + 0.16, s * (W / 2 + 0.03));
13361
13361
  });
@@ -13399,7 +13399,7 @@ var GameUrbanThree = (() => {
13399
13399
  c.roundBox(0.04, 0.1, 0.16, 0.01, MT.steel, rx - 0.03, y0 + H * t, s * (W / 2 - 0.08));
13400
13400
  });
13401
13401
  });
13402
- c.roundBox(0.06, 0.1, W - 0.1, 0.02, rib, rx - 0.02, y1 - 0.05, 0);
13402
+ c.roundBox(0.06, 0.1, W - 0.1, 0.02, rib2, rx - 0.02, y1 - 0.05, 0);
13403
13403
  [1, -1].forEach(function(s) {
13404
13404
  c.roundBox(0.03, 0.05, 0.08, 0.01, MT.tail, rx - 0.02, y1 - 0.06, s * 0.35);
13405
13405
  });
@@ -35216,7 +35216,7 @@ var GameUrbanThree = (() => {
35216
35216
  { id: "flood_tower", shape: "flood_tower", spec: FLOOD },
35217
35217
  { id: "concrete_distribution", shape: "distribution", spec: DISTRIBUTION }
35218
35218
  ];
35219
- 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 } };
35220
35220
  var DEFAULT_WALK_STYLE = { color: 3816252, height: 0.15, castShadow: false };
35221
35221
  var ROAD_LEVEL = 0.02;
35222
35222
  var DEFAULT_GROUND_COLOR = 1382426;
@@ -35226,7 +35226,7 @@ var GameUrbanThree = (() => {
35226
35226
  function drawRoad(b, x, z, w, l, along2, options) {
35227
35227
  const style = roadStyle(options);
35228
35228
  const alongX = along2 === "x";
35229
- 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);
35230
35230
  const { dash } = style;
35231
35231
  for (let u = -l / 2 + dash.first; u < l / 2; u += dash.every) {
35232
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);
@@ -36513,6 +36513,50 @@ var GameUrbanThree = (() => {
36513
36513
  }
36514
36514
 
36515
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
+ }
36516
36560
  var DEFAULT_NETWORK_LAYOUT = {
36517
36561
  sidewalk: 2.5,
36518
36562
  edgeReach: 5,
@@ -36573,7 +36617,8 @@ var GameUrbanThree = (() => {
36573
36617
  storm_gutter: { min: 0 },
36574
36618
  sewer_main: { min: 0.9 }
36575
36619
  },
36576
- 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 },
36577
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 } },
36578
36623
  connectionTolerance: 0.01,
36579
36624
  layout: DEFAULT_NETWORK_LAYOUT
@@ -36584,6 +36629,7 @@ var GameUrbanThree = (() => {
36584
36629
  return isPoleSlots(slots2) ? slots2 : void 0;
36585
36630
  }
36586
36631
  var UINT322 = 2 ** 32;
36632
+ var DEGREES = Math.PI / 180;
36587
36633
  function poleHeightsOf(slots2) {
36588
36634
  const { mv, transformer, lv, lighting, telecom } = slots2.bands;
36589
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] };
@@ -36680,10 +36726,108 @@ var GameUrbanThree = (() => {
36680
36726
  const attachments = { mv: mv.mv, lv: lvAt, telecom: telecomAt, guy: [0, spec.slots.bands.mv[0] - 0.15, 0], ...transformer ? { transformer: transformer.points } : {} };
36681
36727
  return { boxes, cylinders, ...lamp ? { lens: lamp.lens } : {}, attachments };
36682
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";
36683
36827
 
36684
36828
  // src/networks/draw-pieces.ts
36685
36829
  var CYLINDER_SEGMENTS = 10;
36686
- function drawPieces(THREE, { masts, boxes, cylinders, specOf }) {
36830
+ function drawPieces(THREE, { masts, boxes, cylinders, specOf: specOf2 }) {
36687
36831
  const T = shapeGeometries(THREE);
36688
36832
  const owned = [];
36689
36833
  const meshes = [];
@@ -36704,7 +36848,7 @@ var GameUrbanThree = (() => {
36704
36848
  return mesh2;
36705
36849
  };
36706
36850
  for (const specId of new Set(masts.map((mast) => mast.specId))) {
36707
- const { mast } = specOf(specId);
36851
+ const { mast } = specOf2(specId);
36708
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);
36709
36853
  const own = masts.filter((item) => item.specId === specId);
36710
36854
  const mesh2 = instanced(geometry, new THREE.MeshStandardMaterial({ color: mast.color, roughness: 0.9 }), own.length, `network:masts:${specId}`);
@@ -36836,10 +36980,10 @@ var GameUrbanThree = (() => {
36836
36980
  function cablesAt(index, pole) {
36837
36981
  return Math.max(0, ...(index.at.get(pole.id) ?? []).filter((edge) => edge.kind === "telecom_span").map((edge) => edge.conductors ?? 1));
36838
36982
  }
36839
- function poleFramesOf({ networks, index, specOf }) {
36983
+ function poleFramesOf({ networks, index, specOf: specOf2 }) {
36840
36984
  return networks.nodes.filter((node) => node.kind === "pole").map((node) => {
36841
36985
  const specId = node.spec ?? "concrete_distribution";
36842
- const spec = specOf(specId);
36986
+ const spec = specOf2(specId);
36843
36987
  const road = roadOf(index, node);
36844
36988
  const hardware = distributionHardwareOf(spec, {
36845
36989
  mv: node.carries.includes("power_mv"),
@@ -37061,13 +37205,13 @@ var GameUrbanThree = (() => {
37061
37205
  };
37062
37206
  function drawNetworks(THREE, { networks, options, budget, physicalLights }) {
37063
37207
  const root = markKitOrigin(options.root ?? new THREE.Group(), { owner: "game-urban-three", kind: "networks" });
37064
- const specOf = specResolver(options.poles);
37208
+ const specOf2 = specResolver(options.poles);
37065
37209
  const index = indexOf(networks);
37066
- 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]));
37067
37211
  const guys = guysOf({ index, frames, ...options.surfaceAt ? { surfaceAt: options.surfaceAt } : {} });
37068
37212
  const wires = drawWires2(THREE, { runs: wireRunsOf({ frames, index }, networks.edges), guys });
37069
37213
  const pieces = piecesOf({ frames, index, guys });
37070
- 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 });
37071
37215
  const lamps = networkLampsOf({ networks, shares: options.lamps ?? ALL_LAMPS_WORK, isNight: options.isNight ?? false });
37072
37216
  const byPole = new Map(lamps.map((lamp) => [lamp.pole, lamp]));
37073
37217
  const lensMaterial = new THREE.MeshBasicMaterial({ color: 16777215 });
@@ -37129,6 +37273,296 @@ var GameUrbanThree = (() => {
37129
37273
  };
37130
37274
  }
37131
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
+
37132
37566
  // src/draw.ts
37133
37567
  var DEFAULT_ROUGHNESS = 0.9;
37134
37568
  var DEFAULT_METALNESS = 0;
@@ -37143,13 +37577,13 @@ var GameUrbanThree = (() => {
37143
37577
  const geometries = /* @__PURE__ */ new Map();
37144
37578
  const materials = /* @__PURE__ */ new Map();
37145
37579
  const disposables = [];
37146
- const standard = (color2, style, flat = false) => {
37580
+ const standard = (color2, style, flat2 = false) => {
37147
37581
  const roughness = style?.roughness ?? DEFAULT_ROUGHNESS;
37148
37582
  const metalness = style?.metalness ?? DEFAULT_METALNESS;
37149
- const key = `s|${color2}|${roughness}|${metalness}|${flat ? 1 : 0}`;
37583
+ const key = `s|${color2}|${roughness}|${metalness}|${flat2 ? 1 : 0}`;
37150
37584
  let material = materials.get(key);
37151
37585
  if (!material) {
37152
- material = new THREE.MeshStandardMaterial({ color: color2, roughness, metalness, flatShading: flat });
37586
+ material = new THREE.MeshStandardMaterial({ color: color2, roughness, metalness, flatShading: flat2 });
37153
37587
  materials.set(key, material);
37154
37588
  }
37155
37589
  return material;
@@ -37486,7 +37920,10 @@ var GameUrbanThree = (() => {
37486
37920
  };
37487
37921
  }
37488
37922
  const networks = (data, drawOptions = {}) => drawNetworks(THREE, { networks: data, options: drawOptions, ...options.lights ? { budget: options.lights } : {}, ...options.physicalLights ? { physicalLights: true } : {} });
37489
- return { THREE, draw, drawNetworks: networks };
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 };
37490
37927
  }
37491
37928
 
37492
37929
  // ../game-vegetation/dist/chunk-57VLOYXL.js
@@ -38188,15 +38625,15 @@ var GameUrbanThree = (() => {
38188
38625
  const ring2 = [];
38189
38626
  for (let i = 0; i < S; i++) {
38190
38627
  const ridge = i % 2 === 0;
38191
- const rib = i >> 1;
38628
+ const rib2 = i >> 1;
38192
38629
  const a = i / S * TAU;
38193
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)];
38194
- const wob = o.rough ? o.rough(k, rib) : 0;
38631
+ const wob = o.rough ? o.rough(k, rib2) : 0;
38195
38632
  const rr = radii[k] * (ridge ? 1 + wob : o.valley);
38196
38633
  const p = add(pts[k], mul(dir, rr));
38197
- const c = o.color(Math.min(1, k / (path.length - 1)), ridge, rib);
38634
+ const c = o.color(Math.min(1, k / (path.length - 1)), ridge, rib2);
38198
38635
  ring2.push({ p, nr: dir, c });
38199
- 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 });
38200
38637
  }
38201
38638
  rings.push(ring2);
38202
38639
  }
@@ -38232,8 +38669,8 @@ var GameUrbanThree = (() => {
38232
38669
  const lightTip = shade(base, 1.18);
38233
38670
  return (t, a) => {
38234
38671
  const band = 0.93 + 0.07 * Math.sin(t * (level === 0 ? 38 : 16) + seed);
38235
- const rib = 0.92 + 0.08 * Math.cos(a * Math.PI * 2 * 3 + seed * 1.7 + t * 2.2);
38236
- let k = band * rib;
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;
38237
38674
  if (level === 0) k *= 0.8 + 0.2 * clamp3(t * 7, 0, 1);
38238
38675
  const c = shade(base, k * 1.5);
38239
38676
  return level === 0 ? c : mix(c, lightTip, clamp3(t * 0.8, 0, 1) * 0.5);
@@ -40015,9 +40452,9 @@ var GameUrbanThree = (() => {
40015
40452
  const rings = ctx.pick(1, 0.7, 0.45);
40016
40453
  const domeSteps = ctx.pick(2, 1, 1);
40017
40454
  const spineOn = ctx.lod === 0 && ctx.condition !== "dead" ? 1 : ctx.lod === 0 ? 0.5 : 0;
40018
- const bodyColor = (t, ridge, rib) => {
40455
+ const bodyColor = (t, ridge, rib2) => {
40019
40456
  let k = ridge ? 1.05 : 0.7;
40020
- if (rib % 2 === 0) k *= 1.04;
40457
+ if (rib2 % 2 === 0) k *= 1.04;
40021
40458
  const c = shade(base, k * (0.78 + 0.28 * Math.min(1, t * 1.4)));
40022
40459
  return mix(c, lighten(base, 0.8), Math.max(0, t - 0.8) * 1.4 * (ridge ? 1 : 0.5));
40023
40460
  };
@@ -40029,9 +40466,9 @@ var GameUrbanThree = (() => {
40029
40466
  radii,
40030
40467
  valley: 0.74,
40031
40468
  dome: domeSteps,
40032
- color: (t, ridge, rib) => bodyColor(t, ridge, rib + seedK),
40469
+ color: (t, ridge, rib2) => bodyColor(t, ridge, rib2 + seedK),
40033
40470
  sway: () => 0,
40034
- rough: (ring2, rib) => Math.sin(ring2 * 1.7 + rib * 2.3 + seedK) * 0.03
40471
+ rough: (ring2, rib2) => Math.sin(ring2 * 1.7 + rib2 * 2.3 + seedK) * 0.03
40035
40472
  });
40036
40473
  const last = path[path.length - 1];
40037
40474
  const prev = path[path.length - 2];
@@ -40238,12 +40675,12 @@ var GameUrbanThree = (() => {
40238
40675
  radii,
40239
40676
  valley: 0.7,
40240
40677
  dome: ctx.pick(2, 1, 1),
40241
- color: (t, ridge, rib) => {
40242
- const k = (ridge ? 1.08 : 0.68) * (0.75 + 0.3 * t) * (rib % 2 ? 0.97 : 1.03);
40678
+ color: (t, ridge, rib2) => {
40679
+ const k = (ridge ? 1.08 : 0.68) * (0.75 + 0.3 * t) * (rib2 % 2 ? 0.97 : 1.03);
40243
40680
  return shade(base, k);
40244
40681
  },
40245
40682
  sway: () => 0,
40246
- rough: (ring2, rib) => Math.sin(ring2 * 2.1 + rib * 1.3) * 0.02
40683
+ rough: (ring2, rib2) => Math.sin(ring2 * 2.1 + rib2 * 1.3) * 0.02
40247
40684
  });
40248
40685
  if (ctx.lod === 0) {
40249
40686
  for (const rd of res.ridges) {
@@ -41497,7 +41934,7 @@ gl_Position = projectionMatrix * mvPosition;
41497
41934
  };
41498
41935
  m.customProgramCacheKey = () => "vegetation-sway-v1";
41499
41936
  };
41500
- const flat = opts.flatShading !== false;
41937
+ const flat2 = opts.flatShading !== false;
41501
41938
  const rough = typeof opts.roughness === "number" ? opts.roughness : 0.85;
41502
41939
  const make2 = (flatShading, double, roughness) => {
41503
41940
  const m = new THREE.MeshStandardMaterial({
@@ -41511,9 +41948,9 @@ gl_Position = projectionMatrix * mvPosition;
41511
41948
  return m;
41512
41949
  };
41513
41950
  const wood = make2(false, false, 0.95);
41514
- const foliage = make2(flat, true, rough);
41515
- const flowers = make2(flat, true, 0.7);
41516
- const fruit = make2(flat, false, 0.55);
41951
+ const foliage = make2(flat2, true, rough);
41952
+ const flowers = make2(flat2, true, 0.7);
41953
+ const fruit = make2(flat2, false, 0.55);
41517
41954
  const spines = make2(true, true, 0.8);
41518
41955
  const dir = uniforms.uWindDir.value;
41519
41956
  return {