Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(office): give the agents floor its own Scandinavian oak look and window strip

rubenluetke10-beepe7ffe2fd424e
diff --git a/jarvis/ui/web/frontend/src/components/society/office/AgentsFloorAmbience.tsx b/jarvis/ui/web/frontend/src/components/society/office/AgentsFloorAmbience.tsx
new file mode 100644
index 0000000000..e475d36a2d
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/AgentsFloorAmbience.tsx
@@ -0,0 +1,346 @@
+/**
+ * The agents floor's ambience between the rooms: olive trees in pale stone
+ * pots closing the cross aisles at the windows, cushioned oak window benches
+ * and slatted oak planters of grasses along both glass sides, a rack of felt
+ * acoustic baffles floating over every bench in its department's colour with
+ * two warm linear lights under it and soft pools of light below, and one warm
+ * fill light for the whole floor.
+ *
+ * Every repeated part is one instanced mesh, so the whole dressing costs a
+ * handful of draw calls. The solid pieces come from `agentsAmbience`, which
+ * the layout also adds to its obstacles; the baffles and light pools are out
+ * of reach (overhead, or flat on the floor). The baffles fade out whenever the
+ * camera comes down towards their height, so they never block a close view.
+ */
+import { useEffect, useMemo, useRef } from "react";
+import { useFrame } from "@react-three/fiber";
+import { AdditiveBlending, Group, MeshBasicMaterial, MeshStandardMaterial, PlaneGeometry } from "three";
+import { cachedCanvasTexture } from "./canvasMaterials";
+import { agentsAmbience, BENCH_H, PLANTER_H, type AgentsAmbienceItem } from "./agentsAmbience";
+import { agentsRug, AGENTS_SCENE } from "./AgentsFloorLook";
+import { benchesOf, Instances, type Placement } from "./CodingFloorAmbience";
+import { GEO, MAT, matte } from "./OfficeFurniture";
+import type { Department, OfficeLayout } from "./officeLayout";
+
+// ---------------------------------------------------------------------------
+// Materials
+// ---------------------------------------------------------------------------
+
+const AMB = {
+ stone: matte("#e4ddd1", { roughness: 0.8 }),
+ stoneDark: matte("#cfc6b8", { roughness: 0.85 }),
+ gravel: matte("#b9b0a3", { roughness: 1 }),
+ bark: matte("#7a6a58", { roughness: 0.9 }),
+ oak: matte("#d9bf97", { roughness: 0.6 }),
+ oakDark: matte("#b89b74", { roughness: 0.65 }),
+ linen: matte("#efe7d8", { roughness: 1 }),
+ /** White, so each instance's colour is the fabric's or the felt's colour. */
+ fabric: matte("#ffffff", { roughness: 1 }),
+ plume: matte("#e9dcc0", { roughness: 1 }),
+ stalk: matte("#b7a582", { roughness: 1 }),
+};
+
+/** Olive leaves: silvery sage greens, lighter than the office's other plants. */
+const OLIVE_LEAVES = [
+ matte("#8c9c6e", { flatShading: true }), matte("#9fae82", { flatShading: true }),
+ matte("#77885d", { flatShading: true }), matte("#b0b995", { flatShading: true }),
+];
+/** Grasses in the planters: deeper greens, the office's own leaf tones. */
+const GRASS = [MAT.leaf, MAT.leafDark, MAT.leafLight, OLIVE_LEAVES[0]];
+/** Throw pillows on the benches: clay, sage, mustard, dusty blue and oat. */
+const PILLOWS = ["#c07f63", "#8fa383", "#d2a650", "#7f93a8", "#d9c9ab"];
+
+/** Deterministic pseudo-random numbers per seed, so the dressing never changes between loads. */
+function lcg(seed: number): () => number {
+ let state = seed >>> 0;
+ return () => {
+ state = (state * 1664525 + 1013904223) >>> 0;
+ return state / 0x1_0000_0000;
+ };
+}
+
+function seedOf(id: string): number {
+ let h = 2166136261;
+ for (let i = 0; i < id.length; i += 1) h = Math.imul(h ^ id.charCodeAt(i), 16777619);
+ return h >>> 0;
+}
+
+// ---------------------------------------------------------------------------
+// Olive trees
+// ---------------------------------------------------------------------------
+
+/** An olive in a round stone pot: a leaning, forked trunk and an airy crown of small silvery clusters. */
+function Olives({ items }: { items: readonly AgentsAmbienceItem[] }) {
+ const parts = useMemo(() => {
+ const pot: Placement[] = [], lip: Placement[] = [], gravel: Placement[] = [], trunk: Placement[] = [];
+ const leaves: Placement[][] = OLIVE_LEAVES.map(() => []);
+ for (const item of items) {
+ const x = (item.minX + item.maxX) / 2, z = (item.minZ + item.maxZ) / 2, r = (item.maxX - item.minX) / 2;
+ const rand = lcg(seedOf(item.id));
+ pot.push({ position: [x, 0.3, z], scale: [r - 0.03, 0.6, r - 0.03] });
+ lip.push({ position: [x, 0.61, z], scale: [r, 0.04, r] });
+ gravel.push({ position: [x, 0.625, z], scale: [r - 0.07, 0.01, r - 0.07] });
+ // Two leaning stems that fork from a short trunk.
+ const lean = (rand() - 0.5) * 0.3;
+ trunk.push({ position: [x, 0.85, z], scale: [0.055, 0.5, 0.055], rotation: [lean * 0.5, 0, 0.06] });
+ trunk.push({ position: [x - 0.08, 1.35, z + 0.02], scale: [0.035, 0.62, 0.035], rotation: [0.1, 0, 0.28] });
+ trunk.push({ position: [x + 0.09, 1.4, z - 0.03], scale: [0.032, 0.66, 0.032], rotation: [-0.12, 0, -0.26] });
+ // The crown: an open dome of small clusters, so the trunk shows through.
+ for (let k = 0; k < 22; k += 1) {
+ const a = rand() * Math.PI * 2, ring = 0.15 + rand() * 0.45;
+ const y = 1.55 + rand() * 0.7 - ring * 0.35;
+ const s = 0.1 + rand() * 0.09;
+ leaves[Math.floor(rand() * leaves.length)].push({
+ position: [x + Math.cos(a) * ring, y, z + Math.sin(a) * ring], scale: [s * 1.3, s * 0.8, s * 1.3],
+ });
+ }
+ }
+ return { pot, lip, gravel, trunk, leaves };
+ }, [items]);
+ return (
+ <group>
+ <Instances geometry={GEO.potCyl} material={AMB.stone} items={parts.pot} />
+ <Instances geometry={GEO.cyl} material={AMB.stoneDark} items={parts.lip} />
+ <Instances geometry={GEO.cyl} material={AMB.gravel} items={parts.gravel} cast={false} />
+ <Instances geometry={GEO.cyl} material={AMB.bark} items={parts.trunk} />
+ {parts.leaves.map((list, i) => <Instances key={i} geometry={GEO.blob} material={OLIVE_LEAVES[i]} items={list} />)}
+ </group>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Window benches
+// ---------------------------------------------------------------------------
+
+/**
+ * A long oak bench against the glass: a recessed plinth, an oak seat box, a
+ * linen seat cushion, back cushions leaning on the glass side, a few throw
+ * pillows and now and then a book left behind.
+ */
+function Benches({ items }: { items: readonly AgentsAmbienceItem[] }) {
+ const parts = useMemo(() => {
+ const plinth: Placement[] = [], box: Placement[] = [], cushion: Placement[] = [], fabric: Placement[] = [];
+ for (const item of items) {
+ const rand = lcg(seedOf(item.id));
+ const depth = item.maxX - item.minX, len = item.maxZ - item.minZ;
+ const cx = (item.minX + item.maxX) / 2, cz = (item.minZ + item.maxZ) / 2;
+ // The glass side: -1 (west) when the bench faces east, +1 when it faces west.
+ const out = item.facing === "east" ? -1 : 1;
+ const seatTop = BENCH_H - 0.1;
+ plinth.push({ position: [cx + out * 0.03, 0.04, cz], scale: [depth - 0.1, 0.08, len - 0.1] });
+ box.push({ position: [cx, 0.08 + (seatTop - 0.08) / 2, cz], scale: [depth, seatTop - 0.08, len] });
+ cushion.push({ position: [cx - out * 0.02, seatTop + 0.05, cz], scale: [depth - 0.06, 0.1, len - 0.06] });
+ // Back cushions, one per ~0.8 m, leaning back onto the glass.
+ const backs = Math.max(1, Math.round(len / 0.8));
+ const bw = (len - 0.1) / backs;
+ for (let b = 0; b < backs; b += 1) {
+ cushion.push({
+ position: [cx + out * (depth / 2 - 0.07), seatTop + 0.3, item.minZ + 0.05 + bw * (b + 0.5)],
+ scale: [0.1, 0.38, bw - 0.03], rotation: [0, 0, -out * 0.16],
+ });
+ }
+ // Two or three throw pillows in front of the back cushions.
+ const pillows = 2 + Math.floor(rand() * 2);
+ for (let p = 0; p < pillows; p += 1) {
+ const pz = item.minZ + 0.3 + rand() * (len - 0.6);
+ fabric.push({
+ position: [cx + out * (depth / 2 - 0.16), seatTop + 0.24, pz], scale: [0.1, 0.3, 0.32],
+ rotation: [(rand() - 0.5) * 0.3, 0, -out * 0.3], color: PILLOWS[Math.floor(rand() * PILLOWS.length)],
+ });
+ }
+ if (rand() < 0.5) {
+ fabric.push({
+ position: [cx - out * 0.06, seatTop + 0.115, item.minZ + len * (0.2 + rand() * 0.6)], scale: [0.16, 0.03, 0.22],
+ rotation: [0, rand() * 0.8, 0], color: PILLOWS[Math.floor(rand() * PILLOWS.length)],
+ });
+ }
+ }
+ return { plinth, box, cushion, fabric };
+ }, [items]);
+ return (
+ <group>
+ <Instances geometry={GEO.box} material={AMB.oakDark} items={parts.plinth} cast={false} />
+ <Instances geometry={GEO.box} material={AMB.oak} items={parts.box} />
+ <Instances geometry={GEO.box} material={AMB.linen} items={parts.cushion} />
+ <Instances geometry={GEO.box} material={AMB.fabric} items={parts.fabric} />
+ </group>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Slatted planters
+// ---------------------------------------------------------------------------
+
+/** Long oak planters wrapped in vertical slats, planted with tall grasses and a few pale feather-grass plumes. */
+function Planters({ items }: { items: readonly AgentsAmbienceItem[] }) {
+ const parts = useMemo(() => {
+ const liner: Placement[] = [], slats: Placement[] = [], cap: Placement[] = [], soil: Placement[] = [], plumes: Placement[] = [], stalks: Placement[] = [];
+ const grass: Placement[][] = GRASS.map(() => []);
+ for (const item of items) {
+ const rand = lcg(seedOf(item.id));
+ const depth = item.maxX - item.minX, len = item.maxZ - item.minZ;
+ const cx = (item.minX + item.maxX) / 2, cz = (item.minZ + item.maxZ) / 2;
+ const bodyH = PLANTER_H - 0.03;
+ liner.push({ position: [cx, bodyH / 2, cz], scale: [depth - 0.03, bodyH, len - 0.03] });
+ // Slats every 7 cm down both long faces, and across both ends.
+ for (let z = item.minZ + 0.035; z < item.maxZ - 0.02; z += 0.07) {
+ for (const x of [item.minX + 0.012, item.maxX - 0.012]) slats.push({ position: [x, bodyH / 2, z], scale: [0.024, bodyH, 0.045] });
+ }
+ for (let x = item.minX + 0.05; x < item.maxX - 0.03; x += 0.07) {
+ for (const z of [item.minZ + 0.012, item.maxZ - 0.012]) slats.push({ position: [x, bodyH / 2, z], scale: [0.045, bodyH, 0.024] });
+ }
+ cap.push({ position: [cx, PLANTER_H - 0.015, cz], scale: [depth + 0.01, 0.03, len + 0.01] });
+ soil.push({ position: [cx, PLANTER_H + 0.002, cz], scale: [depth - 0.06, 0.006, len - 0.06] });
+ // Clumps of fine blades fanning out of a low mound, and every so often a pale plume above them.
+ for (let z = item.minZ + 0.12; z < item.maxZ - 0.08; z += 0.11 + rand() * 0.05) {
+ const bx = cx + (rand() - 0.5) * 0.1, tone = Math.floor(rand() * GRASS.length);
+ grass[tone].push({ position: [bx, PLANTER_H + 0.03, z], scale: [0.07, 0.06, 0.07] });
+ let tallest = 0;
+ for (let k = 0; k < 6; k += 1) {
+ const h = 0.18 + rand() * 0.24, rx = (rand() - 0.5) * 0.9, rz = (rand() - 0.5) * 0.9;
+ tallest = Math.max(tallest, h);
+ grass[(tone + (k % 2)) % GRASS.length].push({
+ // A blade's local +y leans to (-sin rz, cos rz · cos rx, sin rx): its centre sits one half-length up that line.
+ position: [bx - Math.sin(rz) * h * 0.9, PLANTER_H + Math.cos(rz) * Math.cos(rx) * h * 0.9, z + Math.sin(rx) * h * 0.9],
+ scale: [0.018 + rand() * 0.01, h, 0.028], rotation: [rx, 0, rz],
+ });
+ }
+ if (rand() < 0.3) {
+ // A plume on a thin stalk rising just above the clump.
+ const top = tallest * 1.9 + 0.1;
+ plumes.push({ position: [bx, PLANTER_H + top, z], scale: [0.03, 0.12, 0.03] });
+ stalks.push({ position: [bx, PLANTER_H + top / 2, z], scale: [0.004, top, 0.004] });
+ }
+ }
+ }
+ return { liner, slats, cap, soil, grass, plumes, stalks };
+ }, [items]);
+ return (
+ <group>
+ <Instances geometry={GEO.box} material={AMB.oakDark} items={parts.liner} />
+ <Instances geometry={GEO.box} material={AMB.oak} items={parts.slats} cast={false} />
+ <Instances geometry={GEO.box} material={AMB.oak} items={parts.cap} />
+ <Instances geometry={GEO.box} material={MAT.soil} items={parts.soil} cast={false} />
+ {parts.grass.map((list, i) => <Instances key={i} geometry={GEO.blob} material={GRASS[i]} items={list} />)}
+ <Instances geometry={GEO.blob} material={AMB.plume} items={parts.plumes} />
+ <Instances geometry={GEO.cyl} material={AMB.stalk} items={parts.stalks} cast={false} />
+ </group>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Felt baffles over the benches
+// ---------------------------------------------------------------------------
+
+/** Top of the baffle rack, a baffle's height, thickness and length (across the bench), and their pitch along it. */
+const BAFFLE = { top: 3.3, h: 0.36, t: 0.035, len: 1.8, pitch: 0.4 } as const;
+/** The baffles fade out between these camera heights, so a close or low view never looks through them. */
+const BAFFLE_FADE = { from: 6.5, to: 9 } as const;
+
+let poolMaterial: MeshBasicMaterial | null = null;
+/** A soft oval of warm light, added onto the floor. */
+function pool(): MeshBasicMaterial {
+ if (!poolMaterial) {
+ const map = cachedCanvasTexture("agents:pool", 128, 128, (ctx, w, h) => {
+ const g = ctx.createRadialGradient(w / 2, h / 2, 0, w / 2, h / 2, w / 2);
+ g.addColorStop(0, "rgba(255,255,255,1)");
+ g.addColorStop(0.55, "rgba(255,255,255,0.4)");
+ g.addColorStop(1, "rgba(255,255,255,0)");
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, w, h);
+ });
+ poolMaterial = new MeshBasicMaterial({
+ color: AGENTS_SCENE.light.pool, map, transparent: true, opacity: map ? 0.13 : 0, blending: AdditiveBlending, depthWrite: false,
+ });
+ }
+ return poolMaterial;
+}
+const POOL_GEOMETRY = new PlaneGeometry(1, 1).rotateX(-Math.PI / 2);
+
+function Baffles({ departments }: { departments: readonly Department[] }) {
+ const lamps = useRef<Group>(null);
+ // Own materials, so fading them touches nothing else in the scene.
+ const mats = useMemo(() => ({
+ felt: matte("#ffffff", { roughness: 1, transparent: true }),
+ strip: new MeshStandardMaterial({
+ color: AGENTS_SCENE.light.glow, emissive: AGENTS_SCENE.light.glow, emissiveIntensity: 1.8, toneMapped: false, transparent: true,
+ }),
+ cable: matte("#2a2724", { roughness: 0.5, transparent: true }),
+ }), []);
+ useEffect(() => () => { mats.felt.dispose(); mats.strip.dispose(); mats.cable.dispose(); }, [mats]);
+ const parts = useMemo(() => {
+ const fins: Placement[] = [], rails: Placement[] = [], strips: Placement[] = [], cables: Placement[] = [], pools: Placement[] = [];
+ for (const dept of departments) {
+ const felt = agentsRug(dept.tint).felt;
+ for (const bench of benchesOf([dept])) {
+ // A rack of vertical felt fins across the bench: seen from above they are fine lines, so the desks stay visible.
+ const run = bench.length - 0.9, count = Math.max(2, Math.round(run / BAFFLE.pitch) + 1);
+ for (let i = 0; i < count; i += 1) {
+ const x = bench.x - run / 2 + (run * i) / (count - 1);
+ fins.push({ position: [x, BAFFLE.top - BAFFLE.h / 2, bench.z], scale: [BAFFLE.t, BAFFLE.h, BAFFLE.len], color: felt });
+ }
+ for (const dz of [-BAFFLE.len * 0.35, BAFFLE.len * 0.35]) {
+ rails.push({ position: [bench.x, BAFFLE.top + 0.012, bench.z + dz], scale: [run + 0.08, 0.024, 0.03], color: felt });
+ }
+ // Two linear lights under the fins, one over each desk row.
+ for (const dz of [-0.45, 0.45]) {
+ strips.push({ position: [bench.x, BAFFLE.top - BAFFLE.h - 0.05, bench.z + dz], scale: [run - 0.4, 0.025, 0.05] });
+ }
+ for (const dx of [-run * 0.4, run * 0.4]) {
+ for (const dz of [-BAFFLE.len * 0.35, BAFFLE.len * 0.35]) cables.push({ position: [bench.x + dx, BAFFLE.top + 0.6, bench.z + dz], scale: [0.005, 1.2, 0.005] });
+ // The light hangs from the rack on short drops.
+ for (const dz of [-0.45, 0.45]) cables.push({ position: [bench.x + dx, BAFFLE.top - (BAFFLE.h + 0.05) / 2, bench.z + dz], scale: [0.005, BAFFLE.h + 0.05, 0.005] });
+ }
+ pools.push({ position: [bench.x, 0.012, bench.z], scale: [bench.length + 1.4, 1, 3.4] });
+ }
+ }
+ return { fins, rails, strips, cables, pools };
+ }, [departments]);
+ const fade = useRef(-1);
+ useFrame(({ camera }) => {
+ const t = Math.min(1, Math.max(0, (camera.position.y - BAFFLE_FADE.from) / (BAFFLE_FADE.to - BAFFLE_FADE.from)));
+ if (t === fade.current) return;
+ fade.current = t;
+ for (const m of [mats.felt, mats.strip, mats.cable]) {
+ m.opacity = t;
+ // Opaque when fully shown, so the fins sort and shadow like any solid.
+ m.depthWrite = t >= 1;
+ }
+ if (lamps.current) lamps.current.visible = t > 0;
+ });
+ return (
+ <group>
+ <group ref={lamps}>
+ <Instances geometry={GEO.box} material={mats.felt} items={parts.fins} cast={false} />
+ <Instances geometry={GEO.box} material={mats.felt} items={parts.rails} cast={false} />
+ <Instances geometry={GEO.box} material={mats.strip} items={parts.strips} cast={false} />
+ <Instances geometry={GEO.box} material={mats.cable} items={parts.cables} cast={false} />
+ </group>
+ <Instances geometry={POOL_GEOMETRY} material={pool()} items={parts.pools} cast={false} />
+ </group>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// The floor's ambience
+// ---------------------------------------------------------------------------
+
+export function AgentsFloorAmbience({ layout }: { layout: OfficeLayout }) {
+ const items = useMemo(() => agentsAmbience(layout), [layout]);
+ const byKind = useMemo(() => ({
+ olive: items.filter((i) => i.kind === "olive"),
+ bench: items.filter((i) => i.kind === "bench"),
+ planter: items.filter((i) => i.kind === "planter"),
+ }), [items]);
+ const { minX, maxZ } = layout.bounds;
+ return (
+ <group>
+ {/* Soft warm daylight from the south-west, no shadows: the one extra light the floor pays for. */}
+ <directionalLight position={[minX - 12, 14, maxZ + 8]} intensity={0.35} color="#ffdcb4" />
+ <Olives items={byKind.olive} />
+ <Benches items={byKind.bench} />
+ <Planters items={byKind.planter} />
+ <Baffles departments={layout.departments} />
+ </group>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/AgentsFloorLook.tsx b/jarvis/ui/web/frontend/src/components/society/office/AgentsFloorLook.tsx
new file mode 100644
index 0000000000..8297ad7fc7
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/AgentsFloorLook.tsx
@@ -0,0 +1,520 @@
+/**
+ * The agents floor's own look — the same company as the coding floor above,
+ * but lighter and Scandinavian where that one is walnut and amber: wide
+ * pale-oak planks framed by a warm limestone band along the windows with a
+ * bronze inlay, a soft warm rim round the slab, and every department on a
+ * bordered linen rug in front of a pale-oak tambour wall with clean ink
+ * lettering and two floating shelves.
+ *
+ * Purely visual. The only solid part is the department wall, which stays
+ * inside the sign-wall footprint the layout already walks round.
+ */
+import { useEffect, useMemo } from "react";
+import type { ThreeEvent } from "@react-three/fiber";
+import { AdditiveBlending, MeshBasicMaterial, MeshStandardMaterial, RepeatWrapping, Shape, type Texture } from "three";
+import { useT } from "@/i18n";
+import { cachedCanvasTexture } from "./canvasMaterials";
+import { Box, GEO, MAT, matte, Railing } from "./OfficeFurniture";
+import type { Department, OfficeLayout } from "./officeLayout";
+
+/** The agents floor's surfaces and light. */
+export const AGENTS_SCENE = {
+ /** Warm daylight sky and a warm bounce off the oak. */
+ sky: "#fff3e4",
+ ground: "#8c7c6a",
+ slabEdge: "#2e2925",
+ rim: "#ffe2bd",
+ /** Wide plank light oak: the joint colour and the plank tones. */
+ oak: { seam: "#b39571", planks: ["#e4d0ae", "#dcc6a1", "#e9d8ba", "#d8bf98", "#e1caa5", "#ecdcc1"] },
+ /** The limestone band along the windows, and its bronze inlay. */
+ stone: { base: "#e7e0d4", cloud: ["#ddd5c7", "#efe9df", "#e2dace"], inlay: "#a8865a" },
+ /** Tambour oak walls behind each department. */
+ tambour: { flute: "#dec7a3", shade: "#b99d77", cap: "#cfb48d" },
+ ink: "#2b2926",
+ /** Felt clouds over the benches: their linear light and the pool it throws. */
+ light: { glow: "#fff0d8", pool: "#ffe1b3" },
+} as const;
+
+export type RugWeave = "boucle" | "pinstripe" | "basket" | "chevron" | "windowpane" | "rib";
+
+/** A department's rug: woven field, weave tone, border band, and the felt of its cloud and wall kick band. */
+export interface AgentsRug { weave: RugWeave; field: string; thread: string; border: string; felt: string }
+
+/**
+ * One rug per department, cycled: linen, sage, clay and friends, woven
+ * tone-on-tone, each in the hue family of its zone's desk screens and seats.
+ */
+export const AGENTS_RUGS: readonly AgentsRug[] = [
+ { weave: "boucle", field: "#c9d1bd", thread: "#bac4ac", border: "#86997c", felt: "#9fb094" },
+ { weave: "pinstripe", field: "#c8d0d8", thread: "#b9c3cd", border: "#74889c", felt: "#93a4b5" },
+ { weave: "basket", field: "#e5dac5", thread: "#d8cab0", border: "#b49a74", felt: "#cbb592" },
+ { weave: "chevron", field: "#e6d0c3", thread: "#dbc0b0", border: "#bb7f66", felt: "#cf9d88" },
+ { weave: "windowpane", field: "#d2ccdc", thread: "#c4bdd1", border: "#8c84a6", felt: "#aaa3c0" },
+ { weave: "rib", field: "#c5d7d0", thread: "#b5cbc3", border: "#6a988c", felt: "#8fb3a9" },
+];
+
+/** The rug a department lies on: cycles through the set by the department's tint index. */
+export function agentsRug(index: number): AgentsRug {
+ const n = AGENTS_RUGS.length;
+ return AGENTS_RUGS[((index % n) + n) % n];
+}
+
+/** Metres covered by one repeat of the plank tile and of a rug weave. */
+const OAK_METRES = 3.2;
+const WEAVE_METRES = 1.6;
+
+/** Deterministic pseudo-random numbers, so the planks never shimmer between loads. */
+function lcg(seed: number): () => number {
+ let state = seed >>> 0;
+ return () => {
+ state = (state * 1664525 + 1013904223) >>> 0;
+ return state / 0x1_0000_0000;
+ };
+}
+
+/**
+ * Wide oak planks running east–west, 20 cm by 1.0–2.0 m, staggered row by row.
+ * Each row's joints are laid round the tile's width, so the tile wraps.
+ */
+function drawPlanks(ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ const { seam, planks } = AGENTS_SCENE.oak;
+ const rand = lcg(0x0a4e75);
+ const rowH = 32;
+ ctx.fillStyle = seam;
+ ctx.fillRect(0, 0, w, h);
+ for (let y = 0; y < h; y += rowH) {
+ const start = rand() * w;
+ let x = start;
+ while (x < start + w) {
+ const len = Math.min(160 + rand() * 160, start + w - x);
+ const tone = planks[Math.floor(rand() * planks.length)];
+ const grainSeed = rand() * 1000, knot = rand();
+ // Drawn at its wrapped position and one tile to the left, so it continues past the edge.
+ for (const dx of [0, -w]) {
+ const px = x + dx;
+ if (px > w || px + len < 0) continue;
+ ctx.fillStyle = tone;
+ ctx.fillRect(px + 1, y + 1, len - 1.5, rowH - 1.5);
+ // Long, slightly wavy grain lines and now and then a small knot.
+ for (let g = 0; g < 4; g += 1) {
+ ctx.fillStyle = g % 2 === 0 ? "rgba(140,104,66,0.10)" : "rgba(255,248,232,0.16)";
+ const gy = y + 4 + ((g * 7 + grainSeed) % (rowH - 8));
+ for (let sx = 0; sx < len - 4; sx += 16) {
+ ctx.fillRect(px + 2 + sx, gy + Math.sin((sx + grainSeed) * 0.05) * 1.4, 16, 0.9);
+ }
+ }
+ if (knot < 0.18) {
+ ctx.fillStyle = "rgba(120,86,52,0.28)";
+ ctx.beginPath();
+ ctx.ellipse(px + len * (0.2 + knot * 3), y + rowH / 2, 4, 2, 0, 0, Math.PI * 2);
+ ctx.fill();
+ }
+ }
+ x += len;
+ }
+ }
+}
+
+/** Warm limestone: soft clouds of tone and a fine fossil grain, seamless on both axes. */
+function drawStone(ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ const { base, cloud } = AGENTS_SCENE.stone;
+ const rand = lcg(0x5701e);
+ ctx.fillStyle = base;
+ ctx.fillRect(0, 0, w, h);
+ for (let i = 0; i < 36; i += 1) {
+ const x = rand() * w, y = rand() * h, r = 18 + rand() * 46;
+ const tone = cloud[i % cloud.length];
+ for (const dx of [-w, 0, w]) {
+ for (const dy of [-h, 0, h]) {
+ const g = ctx.createRadialGradient(x + dx, y + dy, 0, x + dx, y + dy, r);
+ g.addColorStop(0, `${tone}aa`);
+ g.addColorStop(1, `${tone}00`);
+ ctx.fillStyle = g;
+ ctx.fillRect(x + dx - r, y + dy - r, r * 2, r * 2);
+ }
+ }
+ }
+ for (let i = 0; i < 1400; i += 1) {
+ ctx.fillStyle = rand() > 0.55 ? "rgba(255,255,255,0.16)" : "rgba(120,104,84,0.10)";
+ const s = rand() > 0.9 ? 2 : 1;
+ ctx.fillRect(Math.floor(rand() * w), Math.floor(rand() * h), s, s);
+ }
+}
+
+/** A cached base texture, cloned per surface with its own repeat. */
+function repeated(base: Texture | null, repeatX: number, repeatZ: number): Texture | null {
+ if (!base) return null;
+ const map = base.clone();
+ map.wrapS = map.wrapT = RepeatWrapping;
+ map.anisotropy = 8;
+ map.repeat.set(repeatX, repeatZ);
+ map.needsUpdate = true;
+ return map;
+}
+
+/** Width of the limestone band along the slab's edge, and of its bronze inlay. */
+const BAND_M = 1.35;
+const INLAY_M = 0.03;
+
+/**
+ * The slab, railing and floor of the agents floor: wide pale-oak planks,
+ * framed by a limestone band with a bronze inlay along the windows, a warm
+ * stone edge and a soft warm rim.
+ */
+export function AgentsSlab({ layout, onFloorClick }: { layout: OfficeLayout; onFloorClick: (event: ThreeEvent<MouseEvent>) => void }) {
+ const { minX, maxX, minZ, maxZ } = layout.bounds;
+ const w = maxX - minX, d = maxZ - minZ, cx = (minX + maxX) / 2, cz = (minZ + maxZ) / 2;
+ const innerW = w - BAND_M * 2, innerD = d - BAND_M * 2;
+ const floor = useMemo(() => {
+ const map = repeated(cachedCanvasTexture("agents:planks", 512, 512, drawPlanks), w / OAK_METRES, d / OAK_METRES);
+ return new MeshStandardMaterial({ color: map ? "#ffffff" : AGENTS_SCENE.oak.planks[0], map, roughness: 0.55 });
+ }, [w, d]);
+ // The band's strips: north and south run the full width, east and west fit between them; one repeat per 3 m.
+ const band = useMemo(() => {
+ const base = cachedCanvasTexture("agents:stone", 256, 256, drawStone);
+ const strip = (along: number, across: number) => {
+ const map = repeated(base, along / 3, across / 3);
+ return new MeshStandardMaterial({ color: map ? "#ffffff" : AGENTS_SCENE.stone.base, map, roughness: 0.45 });
+ };
+ return { ns: strip(w, BAND_M), ew: strip(BAND_M, innerD) };
+ }, [w, innerD]);
+ const inlay = useMemo(() => matte(AGENTS_SCENE.stone.inlay, { roughness: 0.4, metalness: 0.45 }), []);
+ const edge = useMemo(() => matte(AGENTS_SCENE.slabEdge, { roughness: 0.75 }), []);
+ const rim = useMemo(() => new MeshStandardMaterial({
+ color: AGENTS_SCENE.rim, emissive: AGENTS_SCENE.rim, emissiveIntensity: 0.9, roughness: 0.4, toneMapped: false,
+ }), []);
+ useEffect(() => () => {
+ for (const m of [floor, band.ns, band.ew]) { m.map?.dispose(); m.dispose(); }
+ inlay.dispose(); edge.dispose(); rim.dispose();
+ }, [floor, band, inlay, edge, rim]);
+ const glow = 0.05;
+ return (
+ <group>
+ <Box size={[w, 0.6, d]} position={[cx, -0.3, cz]} material={edge} cast={false} />
+ {/* The rim runs just below the floor's edge on all four sides. */}
+ <Box size={[w + glow, glow, glow]} position={[cx, -0.06, minZ]} material={rim} cast={false} />
+ <Box size={[w + glow, glow, glow]} position={[cx, -0.06, maxZ]} material={rim} cast={false} />
+ <Box size={[glow, glow, d + glow]} position={[minX, -0.06, cz]} material={rim} cast={false} />
+ <Box size={[glow, glow, d + glow]} position={[maxX, -0.06, cz]} material={rim} cast={false} />
+ <mesh position={[cx, 0.001, cz]} rotation={[-Math.PI / 2, 0, 0]} material={floor} receiveShadow onClick={onFloorClick}>
+ <planeGeometry args={[w, d]} />
+ </mesh>
+ {[minZ + BAND_M / 2, maxZ - BAND_M / 2].map((z) => (
+ <mesh key={`ns${z}`} position={[cx, 0.002, z]} rotation={[-Math.PI / 2, 0, 0]} material={band.ns} receiveShadow onClick={onFloorClick}>
+ <planeGeometry args={[w, BAND_M]} />
+ </mesh>
+ ))}
+ {[minX + BAND_M / 2, maxX - BAND_M / 2].map((x) => (
+ <mesh key={`ew${x}`} position={[x, 0.002, cz]} rotation={[-Math.PI / 2, 0, 0]} material={band.ew} receiveShadow onClick={onFloorClick}>
+ <planeGeometry args={[BAND_M, innerD]} />
+ </mesh>
+ ))}
+ {/* The bronze inlay where oak meets stone. */}
+ <Box size={[innerW + INLAY_M, 0.004, INLAY_M]} position={[cx, 0.002, minZ + BAND_M]} material={inlay} cast={false} />
+ <Box size={[innerW + INLAY_M, 0.004, INLAY_M]} position={[cx, 0.002, maxZ - BAND_M]} material={inlay} cast={false} />
+ <Box size={[INLAY_M, 0.004, innerD]} position={[minX + BAND_M, 0.002, cz]} material={inlay} cast={false} />
+ <Box size={[INLAY_M, 0.004, innerD]} position={[maxX - BAND_M, 0.002, cz]} material={inlay} cast={false} />
+ <Railing from={[minX + 0.2, minZ + 0.2]} to={[maxX - 0.2, minZ + 0.2]} />
+ <Railing from={[maxX - 0.2, minZ + 0.2]} to={[maxX - 0.2, maxZ - 0.2]} />
+ <Railing from={[maxX - 0.2, maxZ - 0.2]} to={[minX + 0.2, maxZ - 0.2]} />
+ <Railing from={[minX + 0.2, maxZ - 0.2]} to={[minX + 0.2, minZ + 0.2]} />
+ </group>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Rugs
+// ---------------------------------------------------------------------------
+
+/** A tone-on-tone weave, 256 px per WEAVE_METRES, seamless on both axes. */
+function drawWeave(rug: AgentsRug, ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ const rand = lcg(rug.weave.length * 977 + rug.field.charCodeAt(1));
+ ctx.fillStyle = rug.field;
+ ctx.fillRect(0, 0, w, h);
+ ctx.fillStyle = rug.thread;
+ ctx.strokeStyle = rug.thread;
+ switch (rug.weave) {
+ case "boucle":
+ // Small loops of yarn scattered evenly.
+ ctx.lineWidth = 1.6;
+ for (let i = 0; i < 520; i += 1) {
+ const x = rand() * w, y = rand() * h;
+ ctx.beginPath();
+ ctx.arc(x, y, 1.6 + rand() * 1.6, 0, Math.PI * 2);
+ ctx.stroke();
+ }
+ break;
+ case "pinstripe":
+ for (let y = 0; y < h; y += 16) ctx.fillRect(0, y, w, 3);
+ ctx.fillStyle = "rgba(255,255,255,0.18)";
+ for (let y = 8; y < h; y += 32) ctx.fillRect(0, y, w, 1.5);
+ break;
+ case "basket":
+ // 32-px squares of three threads, alternating direction like a basketweave.
+ for (let y = 0; y < h; y += 32) {
+ for (let x = 0; x < w; x += 32) {
+ const across = ((x + y) / 32) % 2 === 0;
+ for (let k = 0; k < 3; k += 1) {
+ if (across) ctx.fillRect(x + 2, y + 4 + k * 10, 28, 5);
+ else ctx.fillRect(x + 4 + k * 10, y + 2, 5, 28);
+ }
+ }
+ }
+ break;
+ case "chevron":
+ ctx.lineWidth = 6;
+ for (let y = -32; y < h + 32; y += 32) {
+ ctx.beginPath();
+ for (let x = 0; x <= w; x += 32) ctx.lineTo(x, y + ((x / 32) % 2 === 0 ? 0 : 16));
+ ctx.stroke();
+ }
+ break;
+ case "windowpane":
+ for (let at = 0; at < w; at += 64) { ctx.fillRect(at, 0, 3, h); ctx.fillRect(0, at, w, 3); }
+ ctx.fillStyle = "rgba(255,255,255,0.14)";
+ for (let at = 32; at < w; at += 64) { ctx.fillRect(at, 0, 1.5, h); ctx.fillRect(0, at, w, 1.5); }
+ break;
+ case "rib":
+ // Soft raised ribs: a shaded band per 16 px.
+ for (let x = 0; x < w; x += 16) {
+ const g = ctx.createLinearGradient(x, 0, x + 16, 0);
+ g.addColorStop(0, "rgba(255,255,255,0.20)");
+ g.addColorStop(0.5, `${rug.thread}00`);
+ g.addColorStop(1, "rgba(60,50,40,0.10)");
+ ctx.fillStyle = g;
+ ctx.fillRect(x, 0, 16, h);
+ }
+ break;
+ }
+ // A fine fibre grain over every weave.
+ for (let i = 0; i < 1600; i += 1) {
+ ctx.fillStyle = rand() > 0.5 ? "rgba(255,255,255,0.10)" : "rgba(60,50,40,0.06)";
+ ctx.fillRect(Math.floor(rand() * w), Math.floor(rand() * h), 1, 1);
+ }
+}
+
+/** Rug materials, one per style. Shape UVs are in metres, so one material fits every rug size. */
+const rugMaterials = new Map<AgentsRug, { field: MeshStandardMaterial; border: MeshStandardMaterial; line: MeshStandardMaterial; felt: MeshStandardMaterial }>();
+function rugKit(rug: AgentsRug) {
+ let kit = rugMaterials.get(rug);
+ if (!kit) {
+ const base = cachedCanvasTexture(`agents:weave:${rug.weave}:${rug.field}`, 256, 256, (ctx, w, h) => drawWeave(rug, ctx, w, h));
+ const map = repeated(base, 1 / WEAVE_METRES, 1 / WEAVE_METRES);
+ kit = {
+ field: new MeshStandardMaterial({ color: map ? "#ffffff" : rug.field, map, roughness: 0.97 }),
+ border: matte(rug.border, { roughness: 1 }),
+ line: matte("#f3ede2", { roughness: 1 }),
+ felt: matte(rug.felt, { roughness: 1 }),
+ };
+ rugMaterials.set(rug, kit);
+ }
+ return kit;
+}
+
+/** A flat rounded rectangle in the XY plane, laid on the floor by its mesh's rotation. */
+function roundedRect(w: number, d: number, r: number): Shape {
+ const x = -w / 2, y = -d / 2;
+ const shape = new Shape();
+ shape.moveTo(x + r, y);
+ shape.lineTo(x + w - r, y);
+ shape.quadraticCurveTo(x + w, y, x + w, y + r);
+ shape.lineTo(x + w, y + d - r);
+ shape.quadraticCurveTo(x + w, y + d, x + w - r, y + d);
+ shape.lineTo(x + r, y + d);
+ shape.quadraticCurveTo(x, y + d, x, y + d - r);
+ shape.lineTo(x, y + r);
+ shape.quadraticCurveTo(x, y, x + r, y);
+ return shape;
+}
+
+// ---------------------------------------------------------------------------
+// Department wall
+// ---------------------------------------------------------------------------
+
+const WALL_H = 1.9;
+const LETTERS = { w: 1024, h: 224 } as const;
+
+/** Tambour: half-round oak flutes, four per 64-px repeat, lit from the upper left. */
+function drawTambour(ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ const { flute, shade } = AGENTS_SCENE.tambour;
+ for (let x = 0; x < w; x += 16) {
+ const g = ctx.createLinearGradient(x, 0, x + 16, 0);
+ g.addColorStop(0, shade);
+ g.addColorStop(0.2, flute);
+ g.addColorStop(0.45, "#f1e2c8");
+ g.addColorStop(0.8, flute);
+ g.addColorStop(1, shade);
+ ctx.fillStyle = g;
+ ctx.fillRect(x, 0, 16, h);
+ }
+ // A faint vertical grain.
+ ctx.fillStyle = "rgba(140,104,66,0.08)";
+ for (let x = 3; x < w; x += 7) ctx.fillRect(x, 0, 0.8, h);
+}
+
+const tambourMaterials = new Map<string, MeshStandardMaterial>();
+/** Flutes about 4 cm wide: one texture repeat per 16 cm of wall. */
+function tambourMaterial(width: number): MeshStandardMaterial {
+ const key = width.toFixed(2);
+ let material = tambourMaterials.get(key);
+ if (!material) {
+ const map = repeated(cachedCanvasTexture("agents:tambour", 64, 64, drawTambour), width / 0.16, 1);
+ material = new MeshStandardMaterial({ color: map ? "#ffffff" : AGENTS_SCENE.tambour.flute, map, roughness: 0.7 });
+ tambourMaterials.set(key, material);
+ }
+ return material;
+}
+
+/** Ink letters on a transparent ground: the department's name, a short rule and "Department 0n" under it. */
+function drawLetters(label: string, number: number, accent: string, ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ ctx.clearRect(0, 0, w, h);
+ const tracked = (text: string, font: string, y: number, spacing: number, fill: string) => {
+ ctx.font = font;
+ const chars = [...text];
+ const widths = chars.map((ch) => ctx.measureText(ch).width);
+ const total = widths.reduce((sum, cw) => sum + cw, 0) + spacing * Math.max(0, chars.length - 1);
+ // Squeeze a long name to fit rather than cutting it off.
+ const scale = Math.min(1, (w - 60) / total);
+ ctx.save();
+ ctx.translate(w / 2, y);
+ ctx.scale(scale, 1);
+ let x = -total / 2;
+ ctx.fillStyle = fill;
+ chars.forEach((ch, i) => {
+ ctx.fillText(ch, x, 0);
+ x += widths[i] + spacing;
+ });
+ ctx.restore();
+ };
+ ctx.textAlign = "left";
+ ctx.textBaseline = "middle";
+ const name = label.length > 24 ? `${label.slice(0, 23)}…` : label;
+ tracked(name, "600 104px Inter, system-ui, -apple-system, 'Segoe UI', sans-serif", 84, 4, AGENTS_SCENE.ink);
+ ctx.fillStyle = accent;
+ ctx.fillRect(w / 2 - 44, 154, 88, 5);
+ tracked(`DEPARTMENT ${String(number).padStart(2, "0")}`, "600 32px Inter, system-ui, -apple-system, 'Segoe UI', sans-serif", 194, 10, "#5d564e");
+}
+
+const letterMaterials = new Map<string, MeshStandardMaterial>();
+function letterMaterial(label: string, number: number, accent: string): MeshStandardMaterial {
+ const key = `${number}:${accent}:${label}`;
+ let material = letterMaterials.get(key);
+ if (!material) {
+ const map = cachedCanvasTexture(`agents:letters:${key}`, LETTERS.w, LETTERS.h, (ctx, w, h) => drawLetters(label, number, accent, ctx, w, h));
+ material = new MeshStandardMaterial({ color: map ? "#ffffff" : AGENTS_SCENE.ink, map, transparent: true, alphaTest: 0.3, roughness: 0.6 });
+ letterMaterials.set(key, material);
+ }
+ return material;
+}
+
+let washCache: MeshBasicMaterial | null = null;
+/** Soft warm light grazing down the flutes from the strip under the cap. */
+function washMaterial(): MeshBasicMaterial {
+ if (!washCache) {
+ const map = cachedCanvasTexture("agents:wash", 64, 128, (ctx, w, h) => {
+ const g = ctx.createLinearGradient(0, 0, 0, h);
+ g.addColorStop(0, "rgba(255,236,206,0.9)");
+ g.addColorStop(1, "rgba(255,236,206,0)");
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, w, h);
+ ctx.globalCompositeOperation = "destination-in";
+ const sides = ctx.createLinearGradient(0, 0, w, 0);
+ sides.addColorStop(0, "rgba(0,0,0,0)");
+ sides.addColorStop(0.08, "rgba(0,0,0,1)");
+ sides.addColorStop(0.92, "rgba(0,0,0,1)");
+ sides.addColorStop(1, "rgba(0,0,0,0)");
+ ctx.fillStyle = sides;
+ ctx.fillRect(0, 0, w, h);
+ });
+ washCache = new MeshBasicMaterial({ color: "#ffffff", map, transparent: true, opacity: map ? 0.3 : 0, blending: AdditiveBlending, depthWrite: false });
+ }
+ return washCache;
+}
+
+const WALL_MAT = {
+ cap: matte(AGENTS_SCENE.tambour.cap, { roughness: 0.55 }),
+ oak: matte("#d9bf97", { roughness: 0.6 }),
+ strip: new MeshStandardMaterial({ color: AGENTS_SCENE.light.glow, emissive: AGENTS_SCENE.light.glow, emissiveIntensity: 1.4, toneMapped: false }),
+ ceramic: matte("#f2ece2", { roughness: 0.5 }),
+ clay: matte("#c2856a", { roughness: 0.7 }),
+ stone: matte("#8e8a84", { roughness: 0.6 }),
+ linen: [matte("#e8dcc6"), matte("#c9b79a"), matte("#9fb094"), matte("#7d8ea3"), matte("#bb7f66")],
+};
+
+/**
+ * A department's back wall, centred on its front face: a pale-oak tambour
+ * panel with an oak cap and a warm light strip under it, the department's
+ * name in ink letters, a felt kick band in the rug's colour, and on a wide
+ * wall two floating oak shelves with ceramics, books and a plant.
+ */
+function DepartmentWall({ label, number, width, position, rug }: {
+ label: string; number: number; width: number; position: [number, number, number]; rug: AgentsRug;
+}) {
+ const kit = rugKit(rug);
+ const plateW = Math.min(3.0, width * 0.5);
+ const plateH = (plateW * LETTERS.h) / LETTERS.w;
+ const shelfX = width / 2 - 0.9;
+ return (
+ <group position={position}>
+ <Box size={[width, WALL_H, 0.1]} position={[0, WALL_H / 2, -0.02]} material={WALL_MAT.cap} />
+ <mesh position={[0, WALL_H / 2 + 0.04, 0.031]} material={tambourMaterial(width - 0.06)} receiveShadow>
+ <planeGeometry args={[width - 0.06, WALL_H - 0.16]} />
+ </mesh>
+ <Box size={[width - 0.06, 0.12, 0.02]} position={[0, 0.08, 0.04]} material={kit.felt} cast={false} />
+ <Box size={[width + 0.04, 0.05, 0.16]} position={[0, WALL_H + 0.025, 0]} material={WALL_MAT.cap} />
+ {/* The light strip tucked under the cap, washing down the flutes. */}
+ <Box size={[width - 0.2, 0.012, 0.02]} position={[0, WALL_H - 0.012, 0.06]} material={WALL_MAT.strip} cast={false} />
+ <mesh position={[0, WALL_H - 0.42, 0.035]} material={washMaterial()}>
+ <planeGeometry args={[width - 0.1, 0.8]} />
+ </mesh>
+ <mesh position={[0, 1.34, 0.04]} material={letterMaterial(label, number, rug.border)}>
+ <planeGeometry args={[plateW, plateH]} />
+ </mesh>
+ {shelfX > plateW / 2 + 0.55 && [-shelfX, shelfX].map((x, side) => (
+ <group key={x} position={[x, 0, 0]}>
+ <Box size={[0.95, 0.04, 0.16]} position={[0, 1.1, 0.11]} material={WALL_MAT.oak} />
+ {/* A ribbed ceramic vase with a sprig, a stack of linen books, a clay pot with a trailing plant. */}
+ <mesh geometry={GEO.potCyl} material={WALL_MAT.ceramic} position={[-0.3, 1.21, 0.11]} scale={[0.05, 0.18, 0.05]} castShadow />
+ <mesh geometry={GEO.blob} material={MAT.leafLight} position={[-0.3, 1.36, 0.11]} scale={[0.06, 0.08, 0.06]} castShadow />
+ {[0, 1, 2].map((i) => (
+ <Box key={i} size={[0.24 - i * 0.02, 0.035, 0.13]} position={[-0.02, 1.1375 + i * 0.037, 0.11]}
+ material={WALL_MAT.linen[(i + number + side) % WALL_MAT.linen.length]} />
+ ))}
+ <mesh geometry={GEO.cyl} material={WALL_MAT.stone} position={[-0.02, 1.27, 0.11]} scale={[0.035, 0.04, 0.035]} castShadow />
+ <mesh geometry={GEO.potCyl} material={WALL_MAT.clay} position={[0.3, 1.18, 0.11]} scale={[0.065, 0.12, 0.065]} castShadow />
+ <mesh geometry={GEO.blob} material={MAT.leaf} position={[0.3, 1.28, 0.11]} scale={[0.11, 0.07, 0.11]} castShadow />
+ <mesh geometry={GEO.blob} material={MAT.leafDark} position={[0.36, 1.14, 0.17]} scale={[0.05, 0.1, 0.04]} castShadow />
+ </group>
+ ))}
+ </group>
+ );
+}
+
+/** One department's ground and back wall: a bordered, rounded linen rug and the tambour name wall. */
+export function AgentsDepartment({ dept }: { dept: Department }) {
+ const t = useT();
+ const rug = agentsRug(dept.tint);
+ const kit = rugKit(rug);
+ const w = dept.maxX - dept.minX, d = dept.maxZ - dept.minZ;
+ const cx = (dept.minX + dept.maxX) / 2, cz = (dept.minZ + dept.maxZ) / 2;
+ const shapes = useMemo(() => ({
+ border: roundedRect(w - 0.1, d - 0.1, 0.4),
+ line: roundedRect(w - 0.36, d - 0.36, 0.28),
+ field: roundedRect(w - 0.44, d - 0.44, 0.24),
+ }), [w, d]);
+ return (
+ <group>
+ <mesh position={[cx, 0.005, cz]} rotation={[-Math.PI / 2, 0, 0]} material={kit.border} receiveShadow>
+ <shapeGeometry args={[shapes.border, 6]} />
+ </mesh>
+ <mesh position={[cx, 0.006, cz]} rotation={[-Math.PI / 2, 0, 0]} material={kit.line} receiveShadow>
+ <shapeGeometry args={[shapes.line, 6]} />
+ </mesh>
+ <mesh position={[cx, 0.007, cz]} rotation={[-Math.PI / 2, 0, 0]} material={kit.field} receiveShadow>
+ <shapeGeometry args={[shapes.field, 6]} />
+ </mesh>
+ <DepartmentWall label={dept.label || t("society.office.open_space")} number={dept.tint + 1} width={w - 0.4}
+ position={[cx, 0, dept.minZ + 0.1]} rug={rug} />
+ </group>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx
index 68d5d24c7c..e38831acac 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx
@@ -27,7 +27,7 @@ import { CODING_SCENE } from "./officePalette";
// Instancing
// ---------------------------------------------------------------------------
-interface Placement {
+export interface Placement {
position: [number, number, number];
scale: [number, number, number];
/** Rotation (x, y, z) in radians; absent = none. */
@@ -37,8 +37,8 @@ interface Placement {
const _m = new Matrix4(), _q = new Quaternion(), _e = new Euler(), _p = new Vector3(), _s = new Vector3(), _c = new Color();
-/** One instanced mesh for every placement of a part. */
-function Instances({ geometry, material, items, cast = true }: {
+/** One instanced mesh for every placement of a part (the agents floor's ambience uses it too). */
+export function Instances({ geometry, material, items, cast = true }: {
geometry: BufferGeometry; material: Material; items: readonly Placement[]; cast?: boolean;
}) {
const ref = useRef<InstancedMesh>(null);
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
index 14ef3f4b21..09227e2e50 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
@@ -1,20 +1,23 @@
/**
- * The office floor: a microcement plate floating in a starry night behind
- * frameless glass, walled rooms in the north and south, one felt-zoned
- * department per provider family in between — and everybody in it.
+ * The office floor: an oak-floored plate floating in a starry night behind
+ * frameless glass, walled rooms in the north and south, one rug-zoned
+ * department per provider family in between — and everybody in it. Each
+ * floor dresses the shared plan in its own look (AgentsFloorLook /
+ * CodingFloorLook).
*/
import { useLayoutEffect, useMemo } from "react";
import { Stars } from "@react-three/drei";
import type { ThreeEvent } from "@react-three/fiber";
-import { CanvasTexture, Color, RepeatWrapping, Shape, SRGBColorSpace, type Texture } from "three";
+import { Color } from "three";
import { useT } from "@/i18n";
import type { SocietyAgent } from "../data";
import type { ToyLook } from "./toyFigureModel";
-import { Railing, SignWall } from "./OfficeFurniture";
import { DeskInstances } from "./DeskInstances";
import { DeskDressing } from "./DeskDressing";
import { CodingSlab, CodingStudio } from "./CodingFloorLook";
import { CodingFloorAmbience } from "./CodingFloorAmbience";
+import { AGENTS_SCENE, AgentsDepartment, AgentsSlab } from "./AgentsFloorLook";
+import { AgentsFloorAmbience } from "./AgentsFloorAmbience";
import { ExecutiveDesks, LeadOfficeLight } from "./LeadSuite";
import { LiveMonitors } from "./LiveMonitors";
import { TerminalMonitors } from "./TerminalMonitors";
@@ -35,9 +38,9 @@ import { OfficePlayer } from "./OfficePlayer";
import { OfficeDog } from "./OfficeDog";
import { PlayerBubble } from "./OfficeBubbles";
import { OfficeCameraRig } from "./OfficeCameraRig";
-import { allDesks, type Department, type OfficeLayout, type Point } from "./officeLayout";
+import { allDesks, type OfficeLayout, type Point } from "./officeLayout";
import { isWalkable, nearestWalkable, type NavGrid } from "./officeNav";
-import { CODING_SCENE, DEPARTMENT_ZONES, OFFICE } from "./officePalette";
+import { CODING_SCENE, OFFICE } from "./officePalette";
import { officeSession, player as playerBody, useOfficeStore, type OfficeFloor, type Selection } from "./officeStore";
import { arrivalPose } from "./officeFloors";
@@ -71,129 +74,6 @@ function GigiCompanion({ grid, awake, reduced }: { grid: NavGrid; awake: boolean
return <GigiFlyer owner={PLAYER_OWNER} mode="follow" speaking={speaking} paused={!awake} reduced={reduced} clear={clear} />;
}
-/** Metres covered by one repeat of the floor texture (one poured panel). */
-const FLOOR_PANEL_M = 4;
-
-/** Microcement drawn once: soft clouds of tone and faint panel seams; repeated across the floor. */
-let floorTexture: Texture | null | undefined;
-function microcement(): Texture | null {
- if (floorTexture !== undefined) return floorTexture;
- const canvas = typeof document !== "undefined" ? document.createElement("canvas") : null;
- let ctx: CanvasRenderingContext2D | null = null;
- try {
- ctx = canvas?.getContext("2d") ?? null;
- } catch {
- // jsdom without the canvas package: no texture, the flat floor colour is the right fallback.
- ctx = null;
- }
- floorTexture = null;
- if (canvas && ctx) {
- const size = 512;
- canvas.width = size;
- canvas.height = size;
- ctx.fillStyle = OFFICE.floor;
- ctx.fillRect(0, 0, size, size);
- // Deterministic clouds, drawn at every wrapped offset so the tile repeats seamlessly.
- let seed = 0x2f6e2b1;
- const rand = () => ((seed = (seed * 1664525 + 1013904223) >>> 0) / 0x1_0000_0000);
- for (let i = 0; i < 70; i += 1) {
- const x = rand() * size, y = rand() * size, r = 30 + rand() * 90;
- const tone = OFFICE.floorCloud[i % OFFICE.floorCloud.length];
- for (const dx of [-size, 0, size]) {
- for (const dy of [-size, 0, size]) {
- const g = ctx.createRadialGradient(x + dx, y + dy, 0, x + dx, y + dy, r);
- g.addColorStop(0, `${tone}66`);
- g.addColorStop(1, `${tone}00`);
- ctx.fillStyle = g;
- ctx.fillRect(x + dx - r, y + dy - r, r * 2, r * 2);
- }
- }
- }
- // Fine grain, then the panel seams on two edges (they meet the next tile's).
- for (let i = 0; i < 5000; i += 1) {
- ctx.fillStyle = rand() > 0.5 ? "rgba(255,255,255,0.10)" : "rgba(90,84,76,0.07)";
- ctx.fillRect(Math.floor(rand() * size), Math.floor(rand() * size), 1, 1);
- }
- ctx.fillStyle = OFFICE.floorSeam;
- ctx.fillRect(0, 0, size, 2);
- ctx.fillRect(0, 0, 2, size);
- const texture = new CanvasTexture(canvas);
- texture.colorSpace = SRGBColorSpace;
- texture.wrapS = texture.wrapT = RepeatWrapping;
- texture.anisotropy = 8;
- floorTexture = texture;
- }
- return floorTexture;
-}
-
-function Slab({ layout, onFloorClick }: { layout: OfficeLayout; onFloorClick: (event: ThreeEvent<MouseEvent>) => void }) {
- const { minX, maxX, minZ, maxZ } = layout.bounds;
- const w = maxX - minX, d = maxZ - minZ, cx = (minX + maxX) / 2, cz = (minZ + maxZ) / 2;
- const floorMap = useMemo(() => {
- const base = microcement();
- if (!base) return null;
- const map = base.clone();
- map.repeat.set(w / FLOOR_PANEL_M, d / FLOOR_PANEL_M);
- map.needsUpdate = true;
- return map;
- }, [w, d]);
- return (
- <group>
- <mesh position={[cx, -0.3, cz]} receiveShadow>
- <boxGeometry args={[w, 0.6, d]} />
- <meshStandardMaterial color={OFFICE.slabEdge} roughness={0.9} />
- </mesh>
- <mesh position={[cx, 0.001, cz]} rotation={[-Math.PI / 2, 0, 0]} receiveShadow onClick={onFloorClick}>
- <planeGeometry args={[w, d]} />
- <meshStandardMaterial color={floorMap ? "#ffffff" : OFFICE.walkway} map={floorMap} roughness={0.55} />
- </mesh>
- <Railing from={[minX + 0.2, minZ + 0.2]} to={[maxX - 0.2, minZ + 0.2]} />
- <Railing from={[maxX - 0.2, minZ + 0.2]} to={[maxX - 0.2, maxZ - 0.2]} />
- <Railing from={[maxX - 0.2, maxZ - 0.2]} to={[minX + 0.2, maxZ - 0.2]} />
- <Railing from={[minX + 0.2, maxZ - 0.2]} to={[minX + 0.2, minZ + 0.2]} />
- </group>
- );
-}
-
-/** A flat rounded rectangle in the XY plane, laid on the floor by its mesh's rotation. */
-function roundedRect(w: number, d: number, r: number): Shape {
- const x = -w / 2, y = -d / 2;
- const shape = new Shape();
- shape.moveTo(x + r, y);
- shape.lineTo(x + w - r, y);
- shape.quadraticCurveTo(x + w, y, x + w, y + r);
- shape.lineTo(x + w, y + d - r);
- shape.quadraticCurveTo(x + w, y + d, x + w - r, y + d);
- shape.lineTo(x + r, y + d);
- shape.quadraticCurveTo(x, y + d, x, y + d - r);
- shape.lineTo(x, y + r);
- shape.quadraticCurveTo(x, y, x + r, y);
- return shape;
-}
-
-/** A department zone: a rounded felt rug with a darker border band, and its fluted back wall. */
-function DepartmentArea({ dept }: { dept: Department }) {
- const t = useT();
- const w = dept.maxX - dept.minX, d = dept.maxZ - dept.minZ;
- const cx = (dept.minX + dept.maxX) / 2, cz = (dept.minZ + dept.maxZ) / 2;
- const zone = DEPARTMENT_ZONES[dept.tint % DEPARTMENT_ZONES.length];
- const outer = useMemo(() => roundedRect(w - 0.1, d - 0.1, 0.45), [w, d]);
- const inner = useMemo(() => roundedRect(w - 0.4, d - 0.4, 0.32), [w, d]);
- return (
- <group>
- <mesh position={[cx, 0.005, cz]} rotation={[-Math.PI / 2, 0, 0]} receiveShadow>
- <shapeGeometry args={[outer, 6]} />
- <meshStandardMaterial color={zone.panel} roughness={1} />
- </mesh>
- <mesh position={[cx, 0.007, cz]} rotation={[-Math.PI / 2, 0, 0]} receiveShadow>
- <shapeGeometry args={[inner, 6]} />
- <meshStandardMaterial color={zone.rug} roughness={1} />
- </mesh>
- <SignWall label={dept.label || t("society.office.open_space")} width={w - 0.4} position={[cx, 0, dept.minZ + 0.1]} zone={dept.tint} />
- </group>
- );
-}
-
export interface OfficeSceneProps {
floor: OfficeFloor;
/** The coding floor's figures by agent id (their IDE panes); empty on the agents floor. */
@@ -252,14 +132,14 @@ export function OfficeScene({ floor, occupants, ready, layout, grid, walkers, ag
<primitive attach="background" object={background} />
<fog attach="fog" args={[space, span * 2.2, span * 4.5]} />
<Stars radius={span * 3} depth={span} count={2500} factor={4} saturation={0} fade speed={reduced ? 0 : 0.3} />
- <hemisphereLight args={coding ? [CODING_SCENE.sky, CODING_SCENE.ground, 0.95] : ["#eef2ff", "#8a8279", 0.95]} />
+ <hemisphereLight args={coding ? [CODING_SCENE.sky, CODING_SCENE.ground, 0.95] : [AGENTS_SCENE.sky, AGENTS_SCENE.ground, 0.95]} />
<ambientLight intensity={0.25} />
<directionalLight position={[maxX + 10, 26, maxZ + 6]} intensity={1.55} color="#fff7ec" castShadow
shadow-mapSize={[2048, 2048]} shadow-bias={-0.0004} shadow-normalBias={0.03}
shadow-camera-left={-span * 0.7} shadow-camera-right={span * 0.7}
shadow-camera-top={span * 0.7} shadow-camera-bottom={-span * 0.7} shadow-camera-far={120} />
- {coding ? <CodingSlab layout={layout} onFloorClick={onFloorClick} /> : <Slab layout={layout} onFloorClick={onFloorClick} />}
- {coding && <CodingFloorAmbience layout={layout} />}
+ {coding ? <CodingSlab layout={layout} onFloorClick={onFloorClick} /> : <AgentsSlab layout={layout} onFloorClick={onFloorClick} />}
+ {coding ? <CodingFloorAmbience layout={layout} /> : <AgentsFloorAmbience layout={layout} />}
<RoomFloors rooms={layout.rooms} />
<RoomWalls walls={layout.walls} />
{layout.rooms.map((room) => <RoomSign key={room.id} room={room} label={t(`society.office.room_${room.kind}`)} />)}
@@ -269,7 +149,7 @@ export function OfficeScene({ floor, occupants, ready, layout, grid, walkers, ag
<DeskDressing desks={benchDesks} departments={layout.departments} />
</>
: <>
- {layout.departments.map((dept) => <DepartmentArea key={dept.id} dept={dept} />)}
+ {layout.departments.map((dept) => <AgentsDepartment key={dept.id} dept={dept} />)}
<DeskInstances desks={benchDesks} agents={agents} zones={zones} />
<DeskDressing desks={benchDesks} departments={layout.departments} floor="agents" />
</>}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/agentsAmbience.test.ts b/jarvis/ui/web/frontend/src/components/society/office/agentsAmbience.test.ts
new file mode 100644
index 0000000000..05d8e0e147
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/agentsAmbience.test.ts
@@ -0,0 +1,68 @@
+import { describe, expect, it } from "vitest";
+
+import { agentsRug, AGENTS_RUGS } from "./AgentsFloorLook";
+import { agentsAmbience } from "./agentsAmbience";
+import { buildOfficeLayout, type OfficeAgentInput, type Rect } from "./officeLayout";
+import { CODING_STUDIOS } from "./officePalette";
+
+const agent = (id: string, provider: string): OfficeAgentInput => ({
+ agentId: id, name: id, tier: "specialist", providerLabel: provider, state: "working", createdMs: 0,
+});
+
+const overlaps = (a: Rect, b: Rect) => a.minX < b.maxX && a.maxX > b.minX && a.minZ < b.maxZ && a.maxZ > b.minZ;
+
+describe("agents floor ambience", () => {
+ for (const count of [0, 12, 40]) {
+ const layout = buildOfficeLayout(Array.from({ length: count }, (_, i) => agent(`a${i}`, `P${i % 5}`)));
+ const items = agentsAmbience(layout);
+
+ it(`stands in the window strip, clear of every department, room and the railing (${count} agents)`, () => {
+ for (const kind of ["olive", "bench", "planter"] as const) expect(items.some((i) => i.kind === kind), kind).toBe(true);
+ for (const item of items) {
+ for (const area of [...layout.departments, ...layout.rooms]) expect(overlaps(item, area), item.id).toBe(false);
+ // The railing's base is 8 cm wide on a line 0.2 m in from the slab edge.
+ expect(item.minX, item.id).toBeGreaterThan(layout.bounds.minX + 0.24);
+ expect(item.maxX, item.id).toBeLessThan(layout.bounds.maxX - 0.24);
+ }
+ });
+
+ it(`is solid in the layout and leaves every window spot free (${count} agents)`, () => {
+ for (const item of items) {
+ expect(layout.obstacles.some((o) => o.minX === item.minX && o.maxZ === item.maxZ), item.id).toBe(true);
+ }
+ for (const spot of layout.spots.filter((s) => s.kind === "window")) {
+ expect(items.some((i) => spot.x >= i.minX - 0.3 && spot.x <= i.maxX + 0.3 && spot.z >= i.minZ - 0.3 && spot.z <= i.maxZ + 0.3), spot.id).toBe(false);
+ }
+ });
+ }
+
+ it("puts a bench and a planter beside each window, mirrored between west and east", () => {
+ const items = agentsAmbience(buildOfficeLayout([]));
+ const kindAt = (side: "west" | "east", run: number) => items.find((i) => i.id.endsWith(`-${side}-0-${run}`))?.kind;
+ expect(kindAt("west", 0)).toBe("bench");
+ expect(kindAt("west", 1)).toBe("planter");
+ expect(new Set(items.map((i) => i.id)).size).toBe(items.length);
+ });
+
+ it("adds nothing to the coding floor", () => {
+ const coding = buildOfficeLayout([], { variant: "coding" });
+ for (const item of agentsAmbience(coding)) {
+ expect(coding.obstacles.some((o) => o.minX === item.minX && o.maxZ === item.maxZ), item.id).toBe(false);
+ }
+ });
+});
+
+describe("agents floor rugs", () => {
+ it("gives the six departments a floor can hold six different rugs, none shared with the coding floor", () => {
+ const rugs = Array.from({ length: 6 }, (_, i) => agentsRug(i));
+ expect(new Set(rugs.map((r) => r.weave)).size).toBe(6);
+ expect(new Set(rugs.map((r) => r.field)).size).toBe(6);
+ const above = new Set(CODING_STUDIOS.map((s) => s.carpet));
+ for (const rug of AGENTS_RUGS) expect(above.has(rug.field)).toBe(false);
+ });
+
+ it("cycles for any tint index", () => {
+ expect(agentsRug(AGENTS_RUGS.length)).toBe(agentsRug(0));
+ expect(agentsRug(-1)).toBe(agentsRug(AGENTS_RUGS.length - 1));
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/office/agentsAmbience.ts b/jarvis/ui/web/frontend/src/components/society/office/agentsAmbience.ts
new file mode 100644
index 0000000000..bf0341b79d
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/agentsAmbience.ts
@@ -0,0 +1,99 @@
+/**
+ * The agents floor's window strip as data: olive trees in stone pots closing
+ * every cross aisle at the glass, and beside each outer department a
+ * cushioned oak window bench on one side of its window spot and a slatted oak
+ * planter of grasses on the other (swapped between west and east, so the two
+ * windows never mirror each other).
+ *
+ * Pure and shared: the layout adds every item to its obstacles, the renderer
+ * builds each piece inside the same box. Everything stands in the 1.6 m
+ * window strip between the departments and the railing, so no desk, room door
+ * or checkpoint loses its way in.
+ */
+import type { Rect } from "./officeLayout";
+
+export type AgentsAmbienceKind = "olive" | "bench" | "planter";
+
+export interface AgentsAmbienceItem extends Rect {
+ id: string;
+ kind: AgentsAmbienceKind;
+ /** The side the piece's front looks at: benches face into the office. */
+ facing: "east" | "west";
+ /** Height of the piece in metres (the olive's crown top). */
+ h: number;
+}
+
+/** An olive pot's square footprint, and how far its centre stands out from the department column. */
+export const OLIVE_BOX = 0.8;
+const OLIVE_OUT = 0.8;
+/** Benches and planters: depth, and how far their inner face stands out from the department column. */
+export const BENCH_DEPTH = 0.4;
+export const PLANTER_DEPTH = 0.34;
+const RUN_OUT = 0.95;
+/** Half the gap left round a department's window spot, and the margin at the department's ends. */
+const WINDOW_GAP = 0.85;
+const END_MARGIN = 0.4;
+const MIN_RUN = 1.2;
+
+export const OLIVE_H = 2.3;
+export const BENCH_H = 0.46;
+export const PLANTER_H = 0.52;
+
+/** Where the aisles are: the department rows and the room strips north and south of them. */
+export interface AgentsAmbienceFrame {
+ departments: readonly Rect[];
+ rooms: readonly Rect[];
+}
+
+/** Every window-strip piece of the agents floor, in a stable order. */
+export function agentsAmbience({ departments, rooms }: AgentsAmbienceFrame): AgentsAmbienceItem[] {
+ if (departments.length === 0) return [];
+ const colMinX = Math.min(...departments.map((d) => d.minX));
+ const colMaxX = Math.max(...departments.map((d) => d.maxX));
+ const firstZ = Math.min(...departments.map((d) => d.minZ));
+ const lastZ = Math.max(...departments.map((d) => d.maxZ));
+ const north = rooms.filter((r) => r.maxZ <= firstZ + 1e-6).map((r) => r.maxZ);
+ const south = rooms.filter((r) => r.minZ >= lastZ - 1e-6).map((r) => r.minZ);
+ const items: AgentsAmbienceItem[] = [];
+
+ // Cross aisles: in front of the north rooms, between department rows, in front of the south strip.
+ const rowStarts = [...new Set(departments.map((d) => d.minZ))].sort((a, b) => a - b);
+ const aisles: number[] = [];
+ if (north.length > 0) aisles.push((Math.max(...north) + firstZ) / 2);
+ for (let i = 1; i < rowStarts.length; i += 1) {
+ const above = Math.max(...departments.filter((d) => d.minZ === rowStarts[i - 1]).map((d) => d.maxZ));
+ aisles.push((above + rowStarts[i]) / 2);
+ }
+ if (south.length > 0) aisles.push((lastZ + Math.min(...south)) / 2);
+ aisles.forEach((z, i) => {
+ for (const [side, x] of [["west", colMinX - OLIVE_OUT], ["east", colMaxX + OLIVE_OUT]] as const) {
+ items.push({
+ id: `olive-${side}-${i}`, kind: "olive", facing: side === "west" ? "east" : "west", h: OLIVE_H,
+ minX: x - OLIVE_BOX / 2, maxX: x + OLIVE_BOX / 2, minZ: z - OLIVE_BOX / 2, maxZ: z + OLIVE_BOX / 2,
+ });
+ }
+ });
+
+ // Beside each outer department: two runs, one either side of its window spot.
+ departments.forEach((dept, index) => {
+ const zc = (dept.minZ + dept.maxZ) / 2;
+ const runs = [[dept.minZ + END_MARGIN, zc - WINDOW_GAP], [zc + WINDOW_GAP, dept.maxZ - END_MARGIN]] as const;
+ runs.forEach(([z0, z1], run) => {
+ if (z1 - z0 < MIN_RUN) return;
+ for (const side of ["west", "east"] as const) {
+ if (side === "west" ? dept.minX > colMinX + 1e-6 : dept.maxX < colMaxX - 1e-6) continue;
+ // West: bench north of the spot, planter south of it; the east window the other way round.
+ const kind: AgentsAmbienceKind = (run === 0) === (side === "west") ? "bench" : "planter";
+ const depth = kind === "bench" ? BENCH_DEPTH : PLANTER_DEPTH;
+ const [minX, maxX] = side === "west"
+ ? [colMinX - RUN_OUT - depth, colMinX - RUN_OUT]
+ : [colMaxX + RUN_OUT, colMaxX + RUN_OUT + depth];
+ items.push({
+ id: `${kind}-${side}-${index}-${run}`, kind, facing: side === "west" ? "east" : "west",
+ h: kind === "bench" ? BENCH_H : PLANTER_H, minX, maxX, minZ: z0, maxZ: z1,
+ });
+ }
+ });
+ });
+ return items;
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
index d47ac7fbff..7bb81332ee 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
@@ -21,6 +21,7 @@
* checkpoints there.
*/
import type { AgentRunState, AgentTier } from "../data";
+import { agentsAmbience } from "./agentsAmbience";
import { codingAmbience } from "./codingAmbience";
export interface OfficeAgentInput {
@@ -747,6 +748,8 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[], options:
...departments.flatMap(benchPlanters).map((p) => p.rect),
// The coding floor's tree planters, bookcases and troughs along the windows.
...(coding ? codingAmbience({ departments, rooms }) : []).map(({ minX, maxX, minZ, maxZ }) => ({ minX, maxX, minZ, maxZ })),
+ // The agents floor's olive trees, window benches and planters along the windows.
+ ...(coding ? [] : agentsAmbience({ departments, rooms })).map(({ minX, maxX, minZ, maxZ }) => ({ minX, maxX, minZ, maxZ })),
// The posts of an open room's name arch are solid too; nobody walks through them.
...rooms.filter((r) => !r.walled).flatMap(archPosts).map((p) => ({
minX: p.x - ARCH.post / 2, maxX: p.x + ARCH.post / 2, minZ: p.z - ARCH.post / 2, maxZ: p.z + ARCH.post / 2,