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): warm the coding floor's architecture and ambience

rubenluetke10-beepeffdfb9744af
diff --git a/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx
new file mode 100644
index 0000000000..68d5d24c7c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorAmbience.tsx
@@ -0,0 +1,354 @@
+/**
+ * The coding floor's ambience between the rooms: tree planters closing the
+ * cross aisles at the windows, a low library of walnut bookcases with reading
+ * lamps along the west glass, planter troughs along the east glass, slim
+ * linear pendants floating over every bench with warm 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 `codingAmbience`, which
+ * the layout also adds to its obstacles; the pendants and light pools are out
+ * of reach (overhead, or flat on the floor). The pendants hide whenever the
+ * camera comes down to their height, so they never block a close view.
+ */
+import { useLayoutEffect, useMemo, useRef } from "react";
+import { useFrame } from "@react-three/fiber";
+import {
+ AdditiveBlending, Color, Euler, Group, InstancedMesh, Matrix4, MeshBasicMaterial, PlaneGeometry, Quaternion, Vector3,
+ type BufferGeometry, type Material,
+} from "three";
+import { cachedCanvasTexture } from "./canvasMaterials";
+import { codingAmbience, LIBRARY_H, TROUGH_H, type AmbienceItem } from "./codingAmbience";
+import { GEO, MAT, matte } from "./OfficeFurniture";
+import type { Department, OfficeLayout } from "./officeLayout";
+import { CODING_SCENE } from "./officePalette";
+
+// ---------------------------------------------------------------------------
+// Instancing
+// ---------------------------------------------------------------------------
+
+interface Placement {
+ position: [number, number, number];
+ scale: [number, number, number];
+ /** Rotation (x, y, z) in radians; absent = none. */
+ rotation?: [number, number, number];
+ color?: string;
+}
+
+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 }: {
+ geometry: BufferGeometry; material: Material; items: readonly Placement[]; cast?: boolean;
+}) {
+ const ref = useRef<InstancedMesh>(null);
+ useLayoutEffect(() => {
+ const mesh = ref.current;
+ if (!mesh) return;
+ items.forEach((item, i) => {
+ _e.set(...(item.rotation ?? [0, 0, 0]));
+ _m.compose(_p.set(...item.position), _q.setFromEuler(_e), _s.set(...item.scale));
+ mesh.setMatrixAt(i, _m);
+ if (item.color) mesh.setColorAt(i, _c.set(item.color));
+ });
+ mesh.count = items.length;
+ mesh.instanceMatrix.needsUpdate = true;
+ if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;
+ }, [items]);
+ if (items.length === 0) return null;
+ return <instancedMesh key={items.length} ref={ref} args={[geometry, material, items.length]} castShadow={cast} receiveShadow frustumCulled={false} />;
+}
+
+// ---------------------------------------------------------------------------
+// Materials
+// ---------------------------------------------------------------------------
+
+const AMB = {
+ clay: matte("#b9694b", { roughness: 0.75 }),
+ cream: matte("#efe7da", { roughness: 0.6 }),
+ walnut: matte(CODING_SCENE.walnut.slat, { roughness: 0.6 }),
+ walnutDark: matte(CODING_SCENE.walnut.gap, { roughness: 0.7 }),
+ brass: matte(CODING_SCENE.brass, { roughness: 0.3, metalness: 0.55 }),
+ shade: matte("#fff1d6", { emissive: "#ffd79a", emissiveIntensity: 0.9, roughness: 0.6 }),
+ /** White, so each instance's colour is the book's colour. */
+ book: matte("#ffffff", { roughness: 0.8 }),
+ olive: matte("#6f8a58", { flatShading: true }),
+ pendant: matte(CODING_SCENE.pendant.body, { roughness: 0.4, metalness: 0.4 }),
+ pendantGlow: matte(CODING_SCENE.pendant.glow, { emissive: CODING_SCENE.pendant.glow, emissiveIntensity: 2, toneMapped: false }),
+};
+
+/** Book spines: muted cloth and paper tones, warm like an old library. */
+const SPINES = ["#8c3b2b", "#c8553d", "#e0b25c", "#3e5c76", "#5e7d5a", "#e9e0cf", "#2f2a26", "#b08a5a", "#7a5a8c", "#d9c7a4"];
+
+/** 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;
+}
+
+// ---------------------------------------------------------------------------
+// Trees
+// ---------------------------------------------------------------------------
+
+/** Crown clusters of a tree in its own space (x, y, z, radius) and which leaf tone each takes. */
+const CROWN: readonly [number, number, number, number, 0 | 1 | 2 | 3][] = [
+ [0, 1.95, 0, 0.36, 0], [0.24, 1.72, 0.1, 0.27, 1], [-0.22, 1.78, -0.08, 0.28, 2], [0.05, 2.18, 0.08, 0.26, 3],
+ [-0.1, 1.55, 0.2, 0.22, 1], [0.16, 2.02, -0.2, 0.24, 2], [-0.2, 2.06, 0.16, 0.22, 0], [0.12, 1.5, -0.14, 0.2, 3],
+];
+const LEAVES = [MAT.leaf, MAT.leafDark, MAT.leafLight, AMB.olive];
+
+/** A tall tree in a square clay planter with a cream rim, filling its TREE_BOX footprint. */
+function Trees({ items }: { items: readonly AmbienceItem[] }) {
+ const parts = useMemo(() => {
+ const planter: Placement[] = [], rim: Placement[] = [], soil: Placement[] = [], trunk: Placement[] = [];
+ const leaves: Placement[][] = LEAVES.map(() => []);
+ for (const item of items) {
+ const x = (item.minX + item.maxX) / 2, z = (item.minZ + item.maxZ) / 2, size = item.maxX - item.minX;
+ const rand = lcg(seedOf(item.id));
+ const turn = rand() * Math.PI * 2, s = 0.9 + rand() * 0.18;
+ planter.push({ position: [x, 0.27, z], scale: [size - 0.06, 0.54, size - 0.06] });
+ rim.push({ position: [x, 0.555, z], scale: [size, 0.03, size] });
+ soil.push({ position: [x, 0.572, z], scale: [size - 0.14, 0.006, size - 0.14] });
+ trunk.push({ position: [x, 1.1, z], scale: [0.045, 1.1, 0.045], rotation: [0.04, 0, -0.05] });
+ for (const [cx, cy, cz, r, tone] of CROWN) {
+ const lx = cx * Math.cos(turn) - cz * Math.sin(turn), lz = cx * Math.sin(turn) + cz * Math.cos(turn);
+ leaves[tone].push({ position: [x + lx * s, 0.1 + cy * s, z + lz * s], scale: [r * s, r * s * 0.9, r * s] });
+ }
+ }
+ return { planter, rim, soil, trunk, leaves };
+ }, [items]);
+ return (
+ <group>
+ <Instances geometry={GEO.box} material={AMB.clay} items={parts.planter} />
+ <Instances geometry={GEO.box} material={AMB.cream} items={parts.rim} />
+ <Instances geometry={GEO.box} material={MAT.soil} items={parts.soil} cast={false} />
+ <Instances geometry={GEO.cyl} material={MAT.trunk} items={parts.trunk} />
+ {parts.leaves.map((list, i) => <Instances key={i} geometry={GEO.blob} material={LEAVES[i]} items={list} />)}
+ </group>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Library along the west glass
+// ---------------------------------------------------------------------------
+
+/**
+ * Low walnut bookcases facing into the office: a carcass with two shelves of
+ * books, and on top a reading lamp, vases and small plants.
+ */
+function Library({ items }: { items: readonly AmbienceItem[] }) {
+ const parts = useMemo(() => {
+ const carcass: Placement[] = [], back: Placement[] = [], books: Placement[] = [];
+ const lampBrass: Placement[] = [], lampShade: Placement[] = [], vases: Placement[] = [], sprigs: Placement[] = [];
+ items.forEach((item, index) => {
+ const rand = lcg(seedOf(item.id));
+ const x0 = item.minX, x1 = item.maxX, depth = x1 - x0, cx = (x0 + x1) / 2;
+ const len = item.maxZ - item.minZ, cz = (item.minZ + item.maxZ) / 2;
+ // Back panel against the glass, then two ends, the plinth, one shelf and the top.
+ back.push({ position: [x0 + 0.015, LIBRARY_H / 2, cz], scale: [0.03, LIBRARY_H, len] });
+ for (const z of [item.minZ + 0.02, item.maxZ - 0.02]) carcass.push({ position: [cx, LIBRARY_H / 2, z], scale: [depth, LIBRARY_H, 0.04] });
+ carcass.push({ position: [cx, 0.05, cz], scale: [depth, 0.1, len] });
+ carcass.push({ position: [cx, 0.54, cz], scale: [depth - 0.02, 0.03, len - 0.06] });
+ carcass.push({ position: [cx, LIBRARY_H - 0.02, cz], scale: [depth + 0.02, 0.04, len + 0.02] });
+ // A vertical divider every ~0.8 m.
+ const bays = Math.max(1, Math.round(len / 0.8));
+ for (let b = 1; b < bays; b += 1) carcass.push({ position: [cx, LIBRARY_H / 2, item.minZ + (len * b) / bays], scale: [depth - 0.02, LIBRARY_H - 0.1, 0.025] });
+ // Books on both shelves: runs of upright spines, now and then a gap or a small stack lying flat.
+ for (const [floor, top] of [[0.1, 0.525], [0.555, LIBRARY_H - 0.04]] as const) {
+ let z = item.minZ + 0.06;
+ while (z < item.maxZ - 0.1) {
+ const roll = rand();
+ if (roll < 0.07) { z += 0.12 + rand() * 0.1; continue; }
+ if (roll < 0.14) {
+ // A stack lying flat.
+ let y = floor;
+ for (let k = 0; k < 3; k += 1) {
+ const t = 0.035 + rand() * 0.02;
+ books.push({ position: [cx + 0.01, y + t / 2, z + 0.11], scale: [0.2, t, 0.22 - k * 0.02], color: SPINES[Math.floor(rand() * SPINES.length)] });
+ y += t;
+ }
+ z += 0.26;
+ continue;
+ }
+ const w = 0.03 + rand() * 0.035, h = Math.min(top - floor - 0.03, 0.24 + rand() * 0.14);
+ const lean = rand() < 0.06 ? 0.18 : 0;
+ books.push({
+ position: [cx + 0.01, floor + h / 2, z + w / 2], scale: [0.2 + rand() * 0.04, h, w], rotation: [lean, 0, 0],
+ color: SPINES[Math.floor(rand() * SPINES.length)],
+ });
+ z += w + 0.004;
+ }
+ }
+ // On top: a brass reading lamp on every other case, vases and small plants.
+ const topY = LIBRARY_H;
+ if (index % 2 === 0) {
+ const lz = item.minZ + len * 0.22;
+ lampBrass.push({ position: [cx, topY + 0.01, lz], scale: [0.08, 0.02, 0.08] });
+ lampBrass.push({ position: [cx, topY + 0.2, lz], scale: [0.008, 0.38, 0.008] });
+ lampShade.push({ position: [cx, topY + 0.42, lz], scale: [0.11, 0.14, 0.11] });
+ }
+ vases.push({ position: [cx, topY + 0.1, item.minZ + len * 0.55], scale: [0.05, 0.2, 0.05] });
+ vases.push({ position: [cx - 0.02, topY + 0.07, item.minZ + len * 0.8], scale: [0.07, 0.14, 0.07] });
+ sprigs.push({ position: [cx - 0.02, topY + 0.2, item.minZ + len * 0.8], scale: [0.12, 0.1, 0.12] });
+ sprigs.push({ position: [cx, topY + 0.23, item.minZ + len * 0.55], scale: [0.06, 0.08, 0.06] });
+ });
+ return { carcass, back, books, lampBrass, lampShade, vases, sprigs };
+ }, [items]);
+ return (
+ <group>
+ <Instances geometry={GEO.box} material={AMB.walnut} items={parts.carcass} />
+ <Instances geometry={GEO.box} material={AMB.walnutDark} items={parts.back} />
+ <Instances geometry={GEO.box} material={AMB.book} items={parts.books} />
+ <Instances geometry={GEO.cyl} material={AMB.brass} items={parts.lampBrass} />
+ <Instances geometry={GEO.potCyl} material={AMB.shade} items={parts.lampShade} cast={false} />
+ <Instances geometry={GEO.cyl} material={AMB.cream} items={parts.vases} />
+ <Instances geometry={GEO.blob} material={MAT.leaf} items={parts.sprigs} />
+ </group>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Planter troughs along the east glass
+// ---------------------------------------------------------------------------
+
+/** Long cream troughs on a walnut plinth, planted with low foliage, kept low so they hide nothing. */
+function Troughs({ items }: { items: readonly AmbienceItem[] }) {
+ const parts = useMemo(() => {
+ const body: Placement[] = [], plinth: Placement[] = [], soil: Placement[] = [];
+ const leaves: Placement[][] = LEAVES.map(() => []);
+ for (const item of items) {
+ const rand = lcg(seedOf(item.id));
+ const cx = (item.minX + item.maxX) / 2, depth = item.maxX - item.minX;
+ const len = item.maxZ - item.minZ, cz = (item.minZ + item.maxZ) / 2;
+ plinth.push({ position: [cx, 0.03, cz], scale: [depth - 0.04, 0.06, len - 0.04] });
+ body.push({ position: [cx, 0.06 + (TROUGH_H - 0.06) / 2, cz], scale: [depth, TROUGH_H - 0.06, len] });
+ soil.push({ position: [cx, TROUGH_H + 0.003, cz], scale: [depth - 0.06, 0.006, len - 0.06] });
+ for (let z = item.minZ + 0.18; z < item.maxZ - 0.12; z += 0.2 + rand() * 0.08) {
+ const r = 0.13 + rand() * 0.08;
+ leaves[Math.floor(rand() * LEAVES.length)].push({ position: [cx + (rand() - 0.5) * 0.08, TROUGH_H + r * 0.7, z], scale: [r * 0.9, r * (1 + rand() * 0.6), r] });
+ }
+ }
+ return { body, plinth, soil, leaves };
+ }, [items]);
+ return (
+ <group>
+ <Instances geometry={GEO.box} material={AMB.walnut} items={parts.plinth} />
+ <Instances geometry={GEO.box} material={AMB.cream} items={parts.body} />
+ <Instances geometry={GEO.box} material={MAT.soil} items={parts.soil} cast={false} />
+ {parts.leaves.map((list, i) => <Instances key={i} geometry={GEO.blob} material={LEAVES[i]} items={list} />)}
+ </group>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Pendants over the benches
+// ---------------------------------------------------------------------------
+
+const PENDANT_Y = 3.0;
+/** Below this camera height the pendants hide, so a close or low view never looks through them. */
+const PENDANT_HIDE_BELOW = PENDANT_Y + 4;
+
+interface Bench { x: number; z: number; length: number }
+
+/** One bench per pair of desk rows: its centre and length from the desks it holds. */
+export function benchesOf(departments: readonly Pick<Department, "id" | "desks">[]): Bench[] {
+ const out: Bench[] = [];
+ for (const dept of departments) {
+ const groups = new Map<string, { xs: number[]; zs: number[] }>();
+ for (const desk of dept.desks) {
+ // Desk ids are "<dept>:<bench>:<facing>:<col>".
+ const key = desk.id.split(":").slice(0, -2).join(":");
+ const group = groups.get(key) ?? { xs: [], zs: [] };
+ group.xs.push(desk.x);
+ group.zs.push(desk.z);
+ groups.set(key, group);
+ }
+ for (const { xs, zs } of groups.values()) {
+ const minX = Math.min(...xs), maxX = Math.max(...xs);
+ out.push({ x: (minX + maxX) / 2, z: zs.reduce((s, v) => s + v, 0) / zs.length, length: maxX - minX + 1.2 });
+ }
+ }
+ return out;
+}
+
+let poolMaterial: MeshBasicMaterial | null = null;
+/** A soft oval of warm light, added onto the floor. */
+function pool(): MeshBasicMaterial {
+ if (!poolMaterial) {
+ const map = cachedCanvasTexture("coding: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.5, "rgba(255,255,255,0.45)");
+ g.addColorStop(1, "rgba(255,255,255,0)");
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, w, h);
+ });
+ poolMaterial = new MeshBasicMaterial({
+ color: CODING_SCENE.pendant.pool, map, transparent: true, opacity: map ? 0.16 : 0, blending: AdditiveBlending, depthWrite: false,
+ });
+ }
+ return poolMaterial;
+}
+const POOL_GEOMETRY = new PlaneGeometry(1, 1).rotateX(-Math.PI / 2);
+
+function Pendants({ departments }: { departments: readonly Department[] }) {
+ const lamps = useRef<Group>(null);
+ const parts = useMemo(() => {
+ const body: Placement[] = [], glow: Placement[] = [], cable: Placement[] = [], pools: Placement[] = [];
+ for (const bench of benchesOf(departments)) {
+ const len = bench.length - 0.4;
+ body.push({ position: [bench.x, PENDANT_Y, bench.z], scale: [len, 0.05, 0.07] });
+ glow.push({ position: [bench.x, PENDANT_Y - 0.027, bench.z], scale: [len - 0.06, 0.006, 0.045] });
+ for (const dx of [-len * 0.38, len * 0.38]) cable.push({ position: [bench.x + dx, PENDANT_Y + 0.6, bench.z], scale: [0.006, 1.2, 0.006] });
+ pools.push({ position: [bench.x, 0.012, bench.z], scale: [bench.length + 1.6, 1, 3.6] });
+ }
+ return { body, glow, cable, pools };
+ }, [departments]);
+ useFrame(({ camera }) => {
+ const group = lamps.current;
+ if (group) group.visible = camera.position.y > PENDANT_HIDE_BELOW;
+ });
+ return (
+ <group>
+ <group ref={lamps}>
+ <Instances geometry={GEO.box} material={AMB.pendant} items={parts.body} cast={false} />
+ <Instances geometry={GEO.box} material={AMB.pendantGlow} items={parts.glow} cast={false} />
+ <Instances geometry={GEO.box} material={AMB.pendant} items={parts.cable} cast={false} />
+ </group>
+ <Instances geometry={POOL_GEOMETRY} material={pool()} items={parts.pools} cast={false} />
+ </group>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// The floor's ambience
+// ---------------------------------------------------------------------------
+
+export function CodingFloorAmbience({ layout }: { layout: OfficeLayout }) {
+ const items = useMemo(() => codingAmbience(layout), [layout]);
+ const byKind = useMemo(() => ({
+ tree: items.filter((i) => i.kind === "tree"),
+ library: items.filter((i) => i.kind === "library"),
+ trough: items.filter((i) => i.kind === "trough"),
+ }), [items]);
+ const { minX, maxZ } = layout.bounds;
+ return (
+ <group>
+ {/* Warm late-afternoon fill from the south-west, no shadows: the one extra light the floor pays for. */}
+ <directionalLight position={[minX - 12, 12, maxZ + 6]} intensity={0.4} color="#ffc68a" />
+ <Trees items={byKind.tree} />
+ <Library items={byKind.library} />
+ <Troughs items={byKind.trough} />
+ <Pendants departments={layout.departments} />
+ </group>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/CodingFloorLook.tsx b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorLook.tsx
index 5b2742a3a1..e0e3ae963c 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/CodingFloorLook.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/CodingFloorLook.tsx
@@ -1,20 +1,21 @@
/**
* The coding floor's own look. It shares the agents office's plan — rooms,
- * desks, paths — but none of its surfaces: terrazzo instead of planks, a
- * glowing rim around the slab, and every workspace department furnished as a
- * studio of its own (carpet pattern, wall colour, desks and chairs).
+ * desks, paths — but none of its surfaces: honey-oak herringbone framed by a
+ * polished concrete band along the windows, a warm glowing rim around the
+ * slab, and every workspace department furnished as a studio of its own
+ * (bordered rug, a walnut slat wall with brass lettering, desks and chairs).
*
- * Purely visual. Nothing here is an obstacle: the carpet and rim are flat or
- * outside the railing, so navigation stays exactly the layout's.
+ * Purely visual. The only solid part is the studio 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 { MeshStandardMaterial, RepeatWrapping, type Texture } from "three";
+import { AdditiveBlending, MeshBasicMaterial, MeshStandardMaterial, RepeatWrapping, type Texture } from "three";
import { useT } from "@/i18n";
import type { SocietyAgent } from "../data";
import { cachedCanvasTexture } from "./canvasMaterials";
import { DeskInstances, type DeskTone } from "./DeskInstances";
-import { Box, matte, Railing, SignWall } from "./OfficeFurniture";
+import { Box, GEO, MAT, matte, Railing } from "./OfficeFurniture";
import type { Department, OfficeLayout } from "./officeLayout";
import { CODING_SCENE, CODING_STUDIOS, type CarpetPattern, type StudioStyle } from "./officePalette";
@@ -24,8 +25,8 @@ export function studioStyle(index: number): StudioStyle {
return CODING_STUDIOS[((index % n) + n) % n];
}
-/** Metres covered by one repeat of the terrazzo tile and of a carpet pattern. */
-const TERRAZZO_METRES = 2.4;
+/** Metres covered by one repeat of the herringbone tile and of a carpet pattern. */
+const OAK_METRES = 2.4;
const CARPET_METRES = 2.4;
/** The rug's border band around the patterned field. */
const BORDER_M = 0.22;
@@ -39,23 +40,66 @@ function lcg(seed: number): () => number {
};
}
-function drawTerrazzo(ctx: CanvasRenderingContext2D, w: number, h: number): void {
- const { base, seam, chips } = CODING_SCENE.terrazzo;
- const rand = lcg(0x7e22a);
+/**
+ * Herringbone oak blocks, 4:1, on an axis-aligned lattice: block n of strip m
+ * lies at (n + 4m, n - 4m) block widths, one horizontal and one vertical. The
+ * pattern repeats every 8 widths, so the 256-px tile (two periods) wraps.
+ */
+function drawHerringbone(ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ const { seam, planks } = CODING_SCENE.oak;
+ const u = 16, k = 4;
+ ctx.fillStyle = seam;
+ ctx.fillRect(0, 0, w, h);
+ const block = (x: number, y: number, bw: number, bh: number) => {
+ // The tone hashes the block's wrapped position, so every copy of it agrees.
+ const wx = ((x % w) + w) % w, wy = ((y % h) + h) % h;
+ const tone = planks[Math.floor((wx * 7 + wy * 13) / u) % planks.length];
+ for (const dx of [-w, 0, w]) {
+ for (const dy of [-h, 0, h]) {
+ const px = wx + dx, py = wy + dy;
+ if (px > w || py > h || px + bw < 0 || py + bh < 0) continue;
+ ctx.fillStyle = tone;
+ ctx.fillRect(px + 0.75, py + 0.75, bw - 1.5, bh - 1.5);
+ // A faint grain along the block's length.
+ ctx.fillStyle = "rgba(96,64,36,0.10)";
+ if (bw > bh) for (const gy of [0.3, 0.62]) ctx.fillRect(px + 2, py + bh * gy, bw - 4, 0.8);
+ else for (const gx of [0.3, 0.62]) ctx.fillRect(px + bw * gx, py + 2, 0.8, bh - 4);
+ }
+ }
+ };
+ const span = w / u;
+ for (let m = -span; m <= span; m += 1) {
+ for (let n = -span * 2; n <= span * 2; n += 1) {
+ const x = (n + k * m) * u, y = (n - k * m) * u;
+ if (x < -k * u * 2 || x > w + k * u || y < -k * u * 2 || y > h + k * u) continue;
+ block(x, y, k * u, u);
+ block(x, y + u, u, k * u);
+ }
+ }
+}
+
+/** Polished concrete: soft clouds of tone and a fine grain, seamless on both axes. */
+function drawConcrete(ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ const { base, cloud } = CODING_SCENE.concrete;
+ const rand = lcg(0xc0ffee);
ctx.fillStyle = base;
ctx.fillRect(0, 0, w, h);
- for (let i = 0; i < 1400; i += 1) {
- ctx.fillStyle = chips[Math.floor(rand() * chips.length)];
- const size = 0.8 + rand() * 1.8;
- ctx.beginPath();
- ctx.ellipse(rand() * w, rand() * h, size, size * (0.5 + rand() * 0.5), rand() * Math.PI, 0, Math.PI * 2);
- ctx.fill();
+ for (let i = 0; i < 40; i += 1) {
+ const x = rand() * w, y = rand() * h, r = 16 + rand() * 50;
+ 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}88`);
+ g.addColorStop(1, `${tone}00`);
+ ctx.fillStyle = g;
+ ctx.fillRect(x + dx - r, y + dy - r, r * 2, r * 2);
+ }
+ }
}
- // Four slabs per tile: seams on the tile's edges and centre lines, so it wraps seamlessly.
- ctx.fillStyle = seam;
- for (const at of [0, w / 2]) {
- ctx.fillRect(at, 0, 2, h);
- ctx.fillRect(0, at, w, 2);
+ for (let i = 0; i < 1800; i += 1) {
+ ctx.fillStyle = rand() > 0.5 ? "rgba(255,255,255,0.12)" : "rgba(80,70,60,0.08)";
+ ctx.fillRect(Math.floor(rand() * w), Math.floor(rand() * h), 1, 1);
}
}
@@ -118,7 +162,7 @@ function repeated(base: Texture | null, repeatX: number, repeatZ: number): Textu
}
/** Studio materials are shared by every department that cycles onto the same style. */
-const studioMaterials = new Map<StudioStyle, { tone: DeskTone; wall: MeshStandardMaterial; slat: MeshStandardMaterial; border: MeshStandardMaterial }>();
+const studioMaterials = new Map<StudioStyle, { tone: DeskTone; slat: MeshStandardMaterial; border: MeshStandardMaterial }>();
function studioKit(style: StudioStyle) {
let kit = studioMaterials.get(style);
if (!kit) {
@@ -127,7 +171,6 @@ function studioKit(style: StudioStyle) {
top: matte(style.deskTop), body: matte(style.deskBody), leg: matte(style.deskLeg),
chair: matte(style.chair), seat: matte(style.seat),
},
- wall: matte(style.wall),
slat: matte(style.slat),
border: matte(style.border, { roughness: 0.95 }),
};
@@ -136,31 +179,70 @@ function studioKit(style: StudioStyle) {
return kit;
}
-/** The slab, railing and floor of the coding floor: terrazzo, a dark edge and a glowing rim. */
+/** Width of the polished concrete band along the slab's edge, and of its brass inlay. */
+const BAND_M = 1.35;
+const INLAY_M = 0.035;
+
+/**
+ * The slab, railing and floor of the coding floor: herringbone oak, framed by
+ * a concrete band with a brass inlay along the windows, a dark edge and a
+ * warm glowing rim.
+ */
export function CodingSlab({ 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("coding:terrazzo", 256, 256, drawTerrazzo), w / TERRAZZO_METRES, d / TERRAZZO_METRES);
- return new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.terrazzo.base, map, roughness: 0.55 });
+ const map = repeated(cachedCanvasTexture("coding:herringbone", 256, 256, drawHerringbone), w / OAK_METRES, d / OAK_METRES);
+ return new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.oak.planks[0], map, roughness: 0.5 });
}, [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("coding:concrete", 256, 256, drawConcrete);
+ const strip = (along: number, across: number) => {
+ const map = repeated(base, along / 3, across / 3);
+ return new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.concrete.base, map, roughness: 0.4 });
+ };
+ return { ns: strip(w, BAND_M), ew: strip(BAND_M, innerD) };
+ }, [w, innerD]);
+ const inlay = useMemo(() => matte(CODING_SCENE.concrete.brass, {
+ roughness: 0.35, metalness: 0.5, emissive: CODING_SCENE.concrete.brass, emissiveIntensity: 0.15,
+ }), []);
const edge = useMemo(() => matte(CODING_SCENE.slabEdge, { roughness: 0.7 }), []);
const rim = useMemo(() => new MeshStandardMaterial({
color: CODING_SCENE.rim, emissive: CODING_SCENE.rim, emissiveIntensity: 1.4, roughness: 0.4, toneMapped: false,
}), []);
- useEffect(() => () => { floor.map?.dispose(); floor.dispose(); edge.dispose(); rim.dispose(); }, [floor, edge, rim]);
- const band = 0.06;
+ 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.06;
return (
<group>
<Box size={[w, 0.6, d]} position={[cx, -0.3, cz]} material={edge} cast={false} />
{/* The glowing rim runs just below the floor's edge on all four sides. */}
- <Box size={[w + band, band, band]} position={[cx, -0.06, minZ]} material={rim} cast={false} />
- <Box size={[w + band, band, band]} position={[cx, -0.06, maxZ]} material={rim} cast={false} />
- <Box size={[band, band, d + band]} position={[minX, -0.06, cz]} material={rim} cast={false} />
- <Box size={[band, band, d + band]} position={[maxX, -0.06, cz]} material={rim} cast={false} />
+ <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 brass inlay where oak meets concrete. */}
+ <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]} />
@@ -169,7 +251,176 @@ export function CodingSlab({ layout, onFloorClick }: { layout: OfficeLayout; onF
);
}
-/** One workspace department as a studio: bordered patterned rug, painted sign wall, desks in its own colours. */
+// ---------------------------------------------------------------------------
+// Studio wall
+// ---------------------------------------------------------------------------
+
+const WALL_H = 1.9;
+const LETTERS = { w: 1024, h: 224 } as const;
+
+/** Vertical walnut slats with dark reveals: four slats per 64-px repeat. */
+function drawSlats(ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ const { slat, gap } = CODING_SCENE.walnut;
+ ctx.fillStyle = gap;
+ ctx.fillRect(0, 0, w, h);
+ for (let x = 0; x < w; x += 16) {
+ ctx.fillStyle = slat;
+ ctx.fillRect(x + 3, 0, 11, h);
+ ctx.fillStyle = "rgba(255,220,180,0.08)";
+ ctx.fillRect(x + 4, 0, 3, h);
+ ctx.fillStyle = "rgba(0,0,0,0.12)";
+ ctx.fillRect(x + 12, 0, 2, h);
+ }
+}
+
+const slatMaterials = new Map<string, MeshStandardMaterial>();
+/** Slats about 5 cm apart: one texture repeat per 20 cm of wall. */
+function slatMaterial(width: number): MeshStandardMaterial {
+ const key = width.toFixed(2);
+ let material = slatMaterials.get(key);
+ if (!material) {
+ const map = repeated(cachedCanvasTexture("coding:slats", 64, 64, drawSlats), width / 0.2, 1);
+ material = new MeshStandardMaterial({ color: map ? "#ffffff" : CODING_SCENE.walnut.slat, map, roughness: 0.7 });
+ slatMaterials.set(key, material);
+ }
+ return material;
+}
+
+/** Brass letters on a transparent ground: the department's name, and "Studio 0n" in small caps under it. */
+function drawLetters(label: string, number: number, 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 | CanvasGradient) => {
+ 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;
+ chars.forEach((ch, i) => {
+ // A dark offset first: the raised letters cast a hairline shadow on the slats.
+ ctx.fillStyle = "rgba(20,12,6,0.6)";
+ ctx.fillText(ch, x + 3, 3);
+ ctx.fillStyle = fill;
+ ctx.fillText(ch, x, 0);
+ x += widths[i] + spacing;
+ });
+ ctx.restore();
+ };
+ ctx.textAlign = "left";
+ ctx.textBaseline = "middle";
+ const gold = ctx.createLinearGradient(0, 30, 0, 140);
+ gold.addColorStop(0, "#f7dc95");
+ gold.addColorStop(0.55, CODING_SCENE.brass);
+ gold.addColorStop(1, "#a97d2c");
+ const name = label.length > 24 ? `${label.slice(0, 23)}…` : label;
+ tracked(name.toUpperCase(), "600 100px Georgia, 'Times New Roman', serif", 86, 12, gold);
+ ctx.fillStyle = CODING_SCENE.brass;
+ ctx.fillRect(w / 2 - 70, 156, 140, 3);
+ tracked(`STUDIO ${String(number).padStart(2, "0")}`, "600 36px system-ui, -apple-system, 'Segoe UI', sans-serif", 194, 12, "#ecdcb9");
+}
+
+const letterMaterials = new Map<string, MeshStandardMaterial>();
+function letterMaterial(label: string, number: number): MeshStandardMaterial {
+ const key = `${number}:${label}`;
+ let material = letterMaterials.get(key);
+ if (!material) {
+ const map = cachedCanvasTexture(`coding:letters:${key}`, LETTERS.w, LETTERS.h, (ctx, w, h) => drawLetters(label, number, ctx, w, h));
+ material = new MeshStandardMaterial({
+ color: map ? "#ffffff" : CODING_SCENE.brass, map, transparent: true, alphaTest: 0.3, roughness: 0.35, metalness: 0.3,
+ // Lit by the picture light above: a faint glow keeps the brass readable in any light.
+ ...(map ? { emissive: "#ffffff", emissiveMap: map, emissiveIntensity: 0.35 } : {}),
+ });
+ letterMaterials.set(key, material);
+ }
+ return material;
+}
+
+let washCache: MeshBasicMaterial | null = null;
+/** Warm light washing down from the picture light, added over the slats. */
+function washMaterial(): MeshBasicMaterial {
+ if (!washCache) {
+ const map = cachedCanvasTexture("coding:wash", 64, 128, (ctx, w, h) => {
+ const g = ctx.createLinearGradient(0, 0, 0, h);
+ g.addColorStop(0, "rgba(255,214,150,0.8)");
+ g.addColorStop(1, "rgba(255,214,150,0)");
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, w, h);
+ // Fade the sides too, so the wash has no hard vertical edge.
+ ctx.globalCompositeOperation = "destination-in";
+ const sides = ctx.createLinearGradient(0, 0, w, 0);
+ sides.addColorStop(0, "rgba(0,0,0,0)");
+ sides.addColorStop(0.25, "rgba(0,0,0,1)");
+ sides.addColorStop(0.75, "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.45 : 0, blending: AdditiveBlending, depthWrite: false });
+ }
+ return washCache;
+}
+
+const STUDIO_MAT = {
+ frame: matte(CODING_SCENE.walnut.cap, { roughness: 0.45, metalness: 0.3 }),
+ brass: matte(CODING_SCENE.brass, { roughness: 0.3, metalness: 0.55, emissive: CODING_SCENE.brass, emissiveIntensity: 0.12 }),
+ lamp: new MeshStandardMaterial({ color: CODING_SCENE.pendant.glow, emissive: CODING_SCENE.pendant.glow, emissiveIntensity: 1.6, toneMapped: false }),
+ walnut: matte(CODING_SCENE.walnut.slat, { roughness: 0.6 }),
+};
+
+/**
+ * A studio's back wall, centred on its front face: a walnut slat wall in a
+ * black steel frame, the department's name in brass letters under a brass
+ * picture light, a kick band in the studio's colour, and two walnut ledges
+ * with books and small planters. It stays inside the layout's sign-wall footprint.
+ */
+function StudioWall({ label, number, width, position, accent }: {
+ label: string; number: number; width: number; position: [number, number, number]; accent: MeshStandardMaterial;
+}) {
+ const plateW = Math.min(3.2, width * 0.52);
+ const plateH = (plateW * LETTERS.h) / LETTERS.w;
+ const ledgeX = width / 2 - 0.9;
+ return (
+ <group position={position}>
+ <Box size={[width, WALL_H, 0.1]} position={[0, WALL_H / 2, -0.02]} material={STUDIO_MAT.frame} />
+ <mesh position={[0, WALL_H / 2 + 0.05, 0.031]} material={slatMaterial(width - 0.08)} receiveShadow>
+ <planeGeometry args={[width - 0.08, WALL_H - 0.18]} />
+ </mesh>
+ <Box size={[width - 0.08, 0.1, 0.02]} position={[0, 0.07, 0.04]} material={accent} cast={false} />
+ <Box size={[width + 0.02, 0.035, 0.13]} position={[0, WALL_H + 0.0175, -0.02]} material={STUDIO_MAT.frame} />
+ <mesh position={[0, 1.36, 0.035]} material={washMaterial()}>
+ <planeGeometry args={[plateW * 1.1, 0.6]} />
+ </mesh>
+ <mesh position={[0, 1.34, 0.04]} material={letterMaterial(label, number)}>
+ <planeGeometry args={[plateW, plateH]} />
+ </mesh>
+ {/* The brass picture light on two short arms, its lit underside facing the letters. */}
+ <Box size={[plateW * 0.7, 0.035, 0.06]} position={[0, 1.7, 0.1]} material={STUDIO_MAT.brass} cast={false} />
+ <Box size={[plateW * 0.66, 0.006, 0.03]} position={[0, 1.68, 0.1]} material={STUDIO_MAT.lamp} cast={false} />
+ {[-plateW * 0.25, plateW * 0.25].map((x) => (
+ <Box key={x} size={[0.015, 0.015, 0.08]} position={[x, 1.71, 0.06]} material={STUDIO_MAT.brass} cast={false} />
+ ))}
+ {ledgeX > plateW / 2 + 0.55 && [-ledgeX, ledgeX].map((x) => (
+ <group key={x} position={[x, 0, 0]}>
+ <Box size={[0.9, 0.035, 0.13]} position={[0, 1.12, 0.1]} material={STUDIO_MAT.walnut} />
+ <mesh geometry={GEO.cyl} material={MAT.planterLight} position={[-0.22, 1.2, 0.1]} scale={[0.055, 0.13, 0.055]} castShadow />
+ <mesh geometry={GEO.blob} material={MAT.leaf} position={[-0.22, 1.33, 0.1]} scale={[0.1, 0.09, 0.1]} castShadow />
+ {[0.02, 0.085, 0.15].map((bx, i) => (
+ <Box key={bx} size={[0.055, 0.2 + i * 0.025, 0.1]} position={[bx, 1.1375 + (0.2 + i * 0.025) / 2, 0.1]}
+ material={MAT.books[(i * 2 + number) % MAT.books.length]} />
+ ))}
+ <mesh geometry={GEO.cyl} material={MAT.pot} position={[0.32, 1.18, 0.1]} scale={[0.045, 0.09, 0.045]} castShadow />
+ <mesh geometry={GEO.blob} material={MAT.leafDark} position={[0.32, 1.27, 0.1]} scale={[0.075, 0.065, 0.075]} castShadow />
+ </group>
+ ))}
+ </group>
+ );
+}
+
+/** One workspace department as a studio: bordered patterned rug, walnut studio wall, desks in its own colours. */
export function CodingStudio({ dept, agents }: { dept: Department; agents: ReadonlyMap<string, SocietyAgent> }) {
const t = useT();
const style = studioStyle(dept.tint);
@@ -192,8 +443,8 @@ export function CodingStudio({ dept, agents }: { dept: Department; agents: Reado
<mesh position={[cx, 0.007, cz]} rotation={[-Math.PI / 2, 0, 0]} material={carpet} receiveShadow>
<planeGeometry args={[fieldW, fieldD]} />
</mesh>
- <SignWall label={dept.label || t("society.office.open_space")} width={w - 0.4} position={[cx, 0, dept.minZ + 0.1]}
- tone={{ wall: kit.wall, slat: kit.slat }} />
+ <StudioWall label={dept.label || t("society.office.open_space")} number={dept.tint + 1} width={w - 0.4}
+ position={[cx, 0, dept.minZ + 0.1]} accent={kit.slat} />
<DeskInstances desks={dept.desks} agents={agents} tone={kit.tone} />
</group>
);
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx
index 807f123cbe..ddef15092d 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx
@@ -4,7 +4,7 @@
* Pattern textures and sign textures are drawn once and cached.
*/
import { useEffect, useMemo } from "react";
-import { MeshStandardMaterial, RepeatWrapping, type Texture } from "three";
+import { DoubleSide, MeshStandardMaterial, RepeatWrapping, type Texture } from "three";
import { Box, MAT, Rounded } from "./OfficeFurniture";
import { cachedCanvasTexture } from "./canvasMaterials";
import { ARCH, archPosts, type Door, type Room, type RoomKind, type WallSegment } from "./officeLayout";
@@ -163,7 +163,16 @@ export const WALL_HEIGHT = 2.1;
const BASE_HEIGHT = 0.12;
const POST_SPACING = 1.8;
-/** One glass wall run: slim black steel base, mullions and top rail around a clear pane. */
+/** Frosted manifestation on the glass at eye level: a broad band and a pinstripe above it. */
+const FROST = { y: 1.05, h: 0.18, stripeY: 1.22, stripeH: 0.025 } as const;
+const frostMaterial = new MeshStandardMaterial({
+ color: "#f4f1ec", transparent: true, opacity: 0.55, roughness: 0.95, side: DoubleSide, depthWrite: false,
+});
+
+/**
+ * One glass wall run: slim black steel base, mullions and top rail around a
+ * clear pane with a frosted band at eye level, so the glass reads as glass.
+ */
function GlassWall({ wall }: { wall: WallSegment }) {
// The lead office is framed in brass on a walnut base, behind warm-tinted glass.
const lead = wall.room === "lead";
@@ -174,12 +183,16 @@ function GlassWall({ wall }: { wall: WallSegment }) {
if (length < 0.05) return null;
const angle = Math.atan2(wall.z2 - wall.z1, wall.x2 - wall.x1);
const posts = Math.max(2, Math.ceil(length / POST_SPACING) + 1);
- const post = lead ? 0.05 : 0.035;
+ const post = lead ? 0.05 : 0.03;
return (
<group position={[(wall.x1 + wall.x2) / 2, 0, (wall.z1 + wall.z2) / 2]} rotation={[0, -angle, 0]}>
<Box size={[length, lead ? BASE_HEIGHT : 0.06, lead ? 0.1 : 0.06]} position={[0, lead ? BASE_HEIGHT / 2 : 0.03, 0]} material={base} />
<Box size={[length, WALL_HEIGHT - BASE_HEIGHT - 0.04, 0.02]} position={[0, (WALL_HEIGHT + BASE_HEIGHT - 0.04) / 2, 0]}
material={glass} cast={false} />
+ {!lead && <>
+ <Box size={[length, FROST.h, 0.024]} position={[0, FROST.y, 0]} material={frostMaterial} cast={false} />
+ <Box size={[length, FROST.stripeH, 0.024]} position={[0, FROST.stripeY, 0]} material={frostMaterial} cast={false} />
+ </>}
<Box size={[length, 0.04, lead ? 0.07 : 0.05]} position={[0, WALL_HEIGHT - 0.02, 0]} material={frame} />
{Array.from({ length: posts }, (_, i) => (
<Box key={i} size={[post, WALL_HEIGHT, lead ? 0.07 : 0.05]} position={[-length / 2 + (length * i) / (posts - 1), WALL_HEIGHT / 2, 0]}
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 db7148e7da..968a521fb4 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
@@ -14,6 +14,7 @@ import { Railing, SignWall } from "./OfficeFurniture";
import { DeskInstances } from "./DeskInstances";
import { DeskDressing } from "./DeskDressing";
import { CodingSlab, CodingStudio } from "./CodingFloorLook";
+import { CodingFloorAmbience } from "./CodingFloorAmbience";
import { ExecutiveDesks, LeadOfficeLight } from "./LeadSuite";
import { LiveMonitors } from "./LiveMonitors";
import { TerminalMonitors } from "./TerminalMonitors";
@@ -254,6 +255,7 @@ export function OfficeScene({ floor, occupants, ready, layout, grid, walkers, ag
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} />}
<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}`)} />)}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.test.ts b/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.test.ts
new file mode 100644
index 0000000000..d59355d85f
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.test.ts
@@ -0,0 +1,46 @@
+import { describe, expect, it } from "vitest";
+
+import { codingAmbience } from "./codingAmbience";
+import { buildOfficeLayout, type OfficeAgentInput, type Rect } from "./officeLayout";
+
+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("coding floor ambience", () => {
+ for (const count of [0, 12, 40]) {
+ const layout = buildOfficeLayout(Array.from({ length: count }, (_, i) => agent(`a${i}`, `P${i % 5}`)), { variant: "coding" });
+ const items = codingAmbience(layout);
+
+ it(`stands in the window strip, clear of every department and room (${count} agents)`, () => {
+ expect(items.some((i) => i.kind === "tree")).toBe(true);
+ expect(items.some((i) => i.kind === "library")).toBe(true);
+ expect(items.some((i) => i.kind === "trough")).toBe(true);
+ for (const item of items) {
+ for (const area of [...layout.departments, ...layout.rooms]) expect(overlaps(item, area), item.id).toBe(false);
+ expect(item.minX, item.id).toBeGreaterThan(layout.bounds.minX + 0.2);
+ expect(item.maxX, item.id).toBeLessThan(layout.bounds.maxX - 0.2);
+ }
+ });
+
+ 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("adds nothing to the agents office and keeps ids unique", () => {
+ const agents = buildOfficeLayout([]);
+ for (const item of codingAmbience(agents)) {
+ expect(agents.obstacles.some((o) => o.minX === item.minX && o.maxZ === item.maxZ), item.id).toBe(false);
+ }
+ const items = codingAmbience(buildOfficeLayout([], { variant: "coding" }));
+ expect(new Set(items.map((i) => i.id)).size).toBe(items.length);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.ts b/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.ts
new file mode 100644
index 0000000000..afdd19775c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/codingAmbience.ts
@@ -0,0 +1,94 @@
+/**
+ * The coding floor's open-plan dressing as data: tree planters closing every
+ * cross aisle at the windows, a low library of bookcases along the west glass
+ * and planter troughs along the east glass, each beside a department and
+ * split round its window spot.
+ *
+ * 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 AmbienceKind = "tree" | "library" | "trough";
+
+export interface AmbienceItem extends Rect {
+ id: string;
+ kind: AmbienceKind;
+ /** The side the piece's front looks at: bookcases face into the office. */
+ facing: "east" | "west";
+ /** Height of the piece in metres (the tree's crown top). */
+ h: number;
+}
+
+/** A tree planter's square footprint, and how far its centre stands out from the department column. */
+export const TREE_BOX = 0.84;
+const TREE_OUT = 0.8;
+/** Bookcases and troughs: depth, and the band they stand in, measured out from the department column. */
+const SHELF_DEPTH = 0.32;
+const SHELF_OUT = 1.04;
+/** 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.35;
+const MIN_RUN = 1.2;
+
+export const LIBRARY_H = 1.02;
+export const TROUGH_H = 0.46;
+export const TREE_H = 2.35;
+
+/** Where the aisles are: the department rows and the room strips north and south of them. */
+export interface AmbienceFrame {
+ departments: readonly Rect[];
+ rooms: readonly Rect[];
+}
+
+/** Every ambience piece of a coding floor, in a stable order. */
+export function codingAmbience({ departments, rooms }: AmbienceFrame): AmbienceItem[] {
+ 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: AmbienceItem[] = [];
+
+ // 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 - TREE_OUT], ["east", colMaxX + TREE_OUT]] as const) {
+ items.push({
+ id: `tree-${side}-${i}`, kind: "tree", facing: side === "west" ? "east" : "west", h: TREE_H,
+ minX: x - TREE_BOX / 2, maxX: x + TREE_BOX / 2, minZ: z - TREE_BOX / 2, maxZ: z + TREE_BOX / 2,
+ });
+ }
+ });
+
+ // Beside each outer department: two runs, one either side of its window spot.
+ departments.forEach((dept, index) => {
+ const west = dept.minX <= colMinX + 1e-6;
+ const east = dept.maxX >= colMaxX - 1e-6;
+ 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;
+ if (west) {
+ items.push({ id: `library-${index}-${run}`, kind: "library", facing: "east", h: LIBRARY_H,
+ minX: colMinX - SHELF_OUT - SHELF_DEPTH, maxX: colMinX - SHELF_OUT, minZ: z0, maxZ: z1 });
+ }
+ if (east) {
+ items.push({ id: `trough-${index}-${run}`, kind: "trough", facing: "west", h: TROUGH_H,
+ minX: colMaxX + SHELF_OUT, maxX: colMaxX + SHELF_OUT + SHELF_DEPTH, minZ: z0, maxZ: z1 });
+ }
+ });
+ });
+ return items;
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/codingFloorLook.test.ts b/jarvis/ui/web/frontend/src/components/society/office/codingFloorLook.test.ts
index d259d7069d..93b87da73b 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/codingFloorLook.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/codingFloorLook.test.ts
@@ -9,7 +9,7 @@ describe("coding floor look", () => {
expect(new Set(styles).size).toBe(6);
expect(new Set(styles.map((s) => s.pattern)).size).toBe(6);
expect(new Set(styles.map((s) => s.carpet)).size).toBe(6);
- expect(new Set(styles.map((s) => s.wall)).size).toBe(6);
+ expect(new Set(styles.map((s) => s.slat)).size).toBe(6);
});
it("cycles the studios for any tint index, never failing on one past the set", () => {
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 7735847780..bbef08c239 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 { codingAmbience } from "./codingAmbience";
export interface OfficeAgentInput {
agentId: string;
@@ -702,6 +703,8 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[], options:
...(coding ? commandDeskObstacles(commandDeskAt) : []),
// Planter boxes at the bench ends on the coding floor.
...(coding ? 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 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,
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts b/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts
index 60b141084b..2ec0040a27 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts
@@ -69,16 +69,24 @@ export const DEPARTMENT_TINTS = DEPARTMENT_ZONES.map((z) => z.rug);
/**
* The coding floor's own look, so the two floors never read as copies: a
- * violet night instead of navy, cool terrazzo instead of warm planks, a glowing
- * rim around the slab, and a studio style per department.
+ * plum night instead of navy, honey-oak herringbone instead of microcement,
+ * a warm amber rim round the slab, and a studio style per department.
*/
export const CODING_SCENE = {
- space: "#140e2e",
- slabEdge: "#2a2542",
- rim: "#5eead4",
- sky: "#d9e2ff",
- ground: "#4d4868",
- terrazzo: { base: "#dde1e8", seam: "rgba(120,128,145,0.3)", chips: ["#c3c9d4", "#efcdbf", "#c2dcd5", "#d2cae6", "#a6adbb", "#f6f7f9"] },
+ space: "#170f2a",
+ slabEdge: "#2b2233",
+ rim: "#f3b16b",
+ sky: "#fff1de",
+ ground: "#5e4c44",
+ /** Herringbone oak: the seam between blocks and the block tones. */
+ oak: { seam: "#8a6848", planks: ["#cfab80", "#c7a176", "#d6b58b", "#c09a6f", "#dcbb92", "#caa47a"] },
+ /** The polished concrete band along the windows, and its brass inlay. */
+ concrete: { base: "#cfc6ba", cloud: ["#c6bcaf", "#d8d0c5", "#c9c0b4"], brass: "#c9a24a" },
+ /** Walnut slat walls behind each studio, with brass lettering. */
+ walnut: { slat: "#5d3d28", gap: "#2e1d13", cap: "#1f1a17" },
+ brass: "#d8ae52",
+ /** Linear pendants over the desks: body, lit underside and the pool of light below. */
+ pendant: { body: "#1d1b1a", glow: "#ffd9a0", pool: "#ffcf8f" },
} as const;
export type CarpetPattern = "grid" | "stripes" | "checker" | "dots" | "diagonal" | "zigzag";
@@ -89,8 +97,7 @@ export interface StudioStyle {
carpet: string;
weave: string;
border: string;
- /** The department's back wall and its acoustic felt panel. */
- wall: string;
+ /** The studio's accent: the kick band along its walnut wall. */
slat: string;
/** Desk top, cabinet, leg, chair base and seat. */
deskTop: string;
@@ -107,17 +114,17 @@ export interface StudioStyle {
* graphite chairs), so a studio reads as a team's corner, not a theme park.
*/
export const CODING_STUDIOS: readonly StudioStyle[] = [
- { pattern: "grid", carpet: "#39424f", weave: "#424c5a", border: "#5eead4", wall: "#2c333d", slat: "#3d4a58",
+ { pattern: "grid", carpet: "#4a403a", weave: "#544841", border: "#c77b58", slat: "#c77b58",
deskTop: "#c9ab81", deskBody: "#2b2f36", deskLeg: "#1f2226", chair: "#1d2025", seat: "#3aa99a" },
- { pattern: "stripes", carpet: "#b7c4ae", weave: "#aebba5", border: "#8aa391", wall: "#eef1ea", slat: "#8aa391",
+ { pattern: "stripes", carpet: "#b3bda2", weave: "#a9b398", border: "#7f9471", slat: "#7f9471",
deskTop: "#dcc39d", deskBody: "#f3f2ef", deskLeg: "#1f2226", chair: "#1d2025", seat: "#6f8b77" },
- { pattern: "checker", carpet: "#e0c7bb", weave: "#dac0b3", border: "#c48e7a", wall: "#f6efe9", slat: "#c48e7a",
+ { pattern: "checker", carpet: "#dcbfae", weave: "#d4b5a3", border: "#bf7a5e", slat: "#bf7a5e",
deskTop: "#f2f0ec", deskBody: "#f3f2ef", deskLeg: "#1f2226", chair: "#1d2025", seat: "#b0705b" },
- { pattern: "dots", carpet: "#c9c3d9", weave: "#bfb9cf", border: "#918aad", wall: "#f1eff6", slat: "#918aad",
+ { pattern: "dots", carpet: "#cbbfc6", weave: "#c0b3bb", border: "#8f7a8a", slat: "#8f7a8a",
deskTop: "#dcc39d", deskBody: "#e9e7ef", deskLeg: "#e9e7ef", chair: "#2b2f36", seat: "#766e96" },
- { pattern: "diagonal", carpet: "#bccadb", weave: "#b3c1d1", border: "#7b91ab", wall: "#eef2f6", slat: "#7b91ab",
+ { pattern: "diagonal", carpet: "#b9c3c9", weave: "#afb9c0", border: "#6f8694", slat: "#6f8694",
deskTop: "#c9ab81", deskBody: "#f3f2ef", deskLeg: "#1f2226", chair: "#1d2025", seat: "#5f7894" },
- { pattern: "zigzag", carpet: "#d9ccb3", weave: "#d1c3a9", border: "#bfa07a", wall: "#f5efe3", slat: "#bfa07a",
+ { pattern: "zigzag", carpet: "#dccaa6", weave: "#d3c09a", border: "#b8955e", slat: "#b8955e",
deskTop: "#8a6446", deskBody: "#2b2f36", deskLeg: "#1f2226", chair: "#1d2025", seat: "#c79a3a" },
];