Prompt specification
Build or customize the Three.js 3D scene "Accessible community reception" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Accessible community reception
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/accessible-community-reception-x0419
Scene Description Prompt:
Please use Three.js from cdnjs for a stylized scene based on this idea: accessible community reception. Build a public reception area with dual-height desk, queue space, signs, and seating; service interactions occur at the appropriate section without separating visitors into isolated entrances. Return one self-contained HTML file.
Working Three.js Starter (accessible-community-reception-x0419):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Community Reception — Accessible Public Space</title>
<style>
:root {
--ink: #17343b;
--teal: #176f73;
--teal-soft: #d8eee7;
--coral: #e98568;
--gold: #d5a64a;
--paper: #fffaf0;
--glass: rgba(255, 250, 240, 0.88);
--line: rgba(23, 52, 59, 0.14);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #dce9e6;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#stage {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
touch-action: none;
}
canvas:focus-visible {
outline: 3px solid var(--gold);
outline-offset: -4px;
}
.ui {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 10;
}
.brand,
.controls,
.detail,
.hint {
position: absolute;
background: var(--glass);
border: 1px solid rgba(255, 255, 255, 0.75);
box-shadow: 0 14px 40px rgba(36, 62, 61, 0.14);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
}
.brand {
top: 22px;
left: 22px;
width: min(430px, calc(100vw - 44px));
padding: 20px 22px 18px;
border-radius: 22px;
}
.kicker {
display: block;
margin-bottom: 7px;
color: var(--teal);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(25px, 3vw, 36px);
line-height: 1.02;
letter-spacing: -0.035em;
}
.brand p {
margin: 10px 0 14px;
max-width: 370px;
color: rgba(23, 52, 59, 0.74);
font-size: 14px;
line-height: 1.5;
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.legend span {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 6px 9px;
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(255, 255, 255, 0.48);
font-size: 11px;
font-weight: 700;
}
.dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
.controls {
top: 22px;
right: 22px;
padding: 8px;
border-radius: 16px;
pointer-events: auto;
}
.controls-title {
padding: 5px 8px 8px;
color: rgba(23, 52, 59, 0.58);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.controls-row {
display: flex;
gap: 6px;
}
button {
appearance: none;
border: 0;
border-radius: 10px;
padding: 10px 12px;
background: transparent;
color: var(--ink);
font: inherit;
font-size: 12px;
font-weight: 750;
cursor: pointer;
transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
button:hover,
button:focus-visible {
background: var(--teal-soft);
color: var(--teal);
outline: none;
}
button:active { transform: translateY(1px); }
button.primary {
background: var(--teal);
color: white;
}
button.primary:hover,
button.primary:focus-visible {
background: #115b60;
color: white;
}
.detail {
left: 22px;
bottom: 22px;
width: min(365px, calc(100vw - 44px));
padding: 16px 18px 17px;
border-radius: 18px;
border-left: 5px solid var(--gold);
}
.detail-label {
display: block;
margin-bottom: 4px;
color: var(--teal);
font-size: 10px;
font-weight: 850;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.detail h2 {
margin: 0 0 5px;
font-size: 18px;
letter-spacing: -0.02em;
}
.detail p {
margin: 0;
color: rgba(23, 52, 59, 0.72);
font-size: 13px;
line-height: 1.48;
}
.hint {
right: 22px;
bottom: 22px;
padding: 10px 13px;
border-radius: 999px;
color: rgba(23, 52, 59, 0.66);
font-size: 11px;
font-weight: 650;
}
#loading {
position: fixed;
inset: 0;
z-index: 100;
display: grid;
place-items: center;
background: #e4eeeb;
transition: opacity 350ms ease, visibility 350ms ease;
}
#loading.hidden {
opacity: 0;
visibility: hidden;
}
.loader {
display: flex;
align-items: center;
gap: 12px;
color: var(--ink);
font-size: 13px;
font-weight: 750;
}
.loader-ring {
width: 24px;
height: 24px;
border: 3px solid rgba(23, 111, 115, 0.2);
border-top-color: var(--teal);
border-radius: 50%;
animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
@media (max-width: 760px) {
.brand {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 15px 17px;
}
.brand p { display: none; }
.legend { margin-top: 10px; }
.legend span { padding: 5px 8px; font-size: 10px; }
.controls {
top: auto;
right: 12px;
bottom: 12px;
}
.controls-title { display: none; }
.controls-row { flex-direction: column; }
.detail {
left: 12px;
bottom: 12px;
width: calc(100vw - 154px);
padding: 12px 13px;
}
.detail p { font-size: 11px; }
.detail h2 { font-size: 15px; }
.hint { display: none; }
}
</style>
</head>
<body>
<div id="stage"></div>
<div class="ui">
<header class="brand">
<span class="kicker">Inclusive public realm</span>
<h1>Community reception</h1>
<p>
One open entrance and one shared queue, with a lower service point
and a standard-height counter within the same welcoming space.
</p>
<div class="legend" aria-label="Space key">
<span><i class="dot" style="background:#176f73"></i>Step-free service</span>
<span><i class="dot" style="background:#d5a64a"></i>Shared approach</span>
<span><i class="dot" style="background:#e98568"></i>Standard service</span>
</div>
</header>
<nav class="controls" aria-label="Camera views">
<div class="controls-title">Explore the space</div>
<div class="controls-row">
<button class="primary" data-view="overview">Overview</button>
<button data-view="queue">Shared queue</button>
<button data-view="accessible">Lower desk</button>
</div>
</nav>
<section class="detail" aria-live="polite">
<span class="detail-label">Design feature</span>
<h2 id="detail-title">A shared welcome</h2>
<p id="detail-text">
The wide, step-free threshold feeds a single shared queue. Visitors
choose the service point that meets their needs without entering a
separate or segregated route.
</p>
</section>
<div class="hint">Drag to orbit · Scroll to zoom · Shift-drag to pan</div>
</div>
<p id="scene-description" class="sr-only">
A stylized three-dimensional community reception lobby. A single wide entrance
opens into a shared queue. A connected desk has a lower accessible section
on the left and a standard section on the right. A wheelchair user is being
served at the lower desk while another visitor stands at the standard desk.
Signs, a turning area, stanchions and seating are visible.
</p>
<div id="loading" role="status" aria-live="polite">
<div class="loader"><span class="loader-ring"></span>Building the reception space…</div>
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const stage = document.getElementById("stage");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xdce9e6);
scene.fog = new THREE.Fog(0xdce9e6, 31, 62);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute("aria-label", "Interactive 3D community reception scene");
renderer.domElement.setAttribute("aria-describedby", "scene-description");
stage.appendChild(renderer.domElement);
const camera = new THREE.PerspectiveCamera(
39,
window.innerWidth / window.innerHeight,
0.1,
100
);
const palette = {
ink: 0x17343b,
teal: 0x176f73,
tealLight: 0x9ccfc0,
tealPale: 0xd8eee7,
coral: 0xe98568,
gold: 0xd5a64a,
cream: 0xf4efe4,
paper: 0xfffaf0,
peach: 0xeac3a8,
wood: 0xb97850,
woodLight: 0xd4a27b,
floor: 0xe9e2d4,
floorDark: 0xd8d0c0,
white: 0xffffff,
skin: 0xc98f6b,
skinLight: 0xe1b293,
hair: 0x40322d,
blue: 0x537b91,
green: 0x548b67
};
const standard = (color, extra = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.78,
metalness: 0.02,
...extra
});
const mat = {
ink: standard(palette.ink),
teal: standard(palette.teal),
tealLight: standard(palette.tealLight),
tealPale: standard(palette.tealPale),
coral: standard(palette.coral),
gold: standard(palette.gold, { metalness: 0.18, roughness: 0.5 }),
cream: standard(palette.cream),
paper: standard(palette.paper),
peach: standard(palette.peach),
wood: standard(palette.wood),
woodLight: standard(palette.woodLight),
floor: standard(palette.floor),
white: standard(palette.white),
blue: standard(palette.blue),
green: standard(palette.green),
darkRubber: standard(0x253236, { roughness: 0.92 }),
glass: standard(0x6fa6a7, { roughness: 0.22, metalness: 0.08 }),
screen: new THREE.MeshStandardMaterial({
color: 0x9bd9d4,
emissive: 0x174c50,
emissiveIntensity: 0.35,
roughness: 0.35
})
};
function box(parent, size, position, material, cast = true, receive = true) {
const mesh = new THREE.Mesh(new THREE.BoxGeometry(...size), material);
mesh.position.set(...position);
mesh.castShadow = cast;
mesh.receiveShadow = receive;
parent.add(mesh);
return mesh;
}
function cylinder(parent, top, bottom, height, position, material, segments = 24) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(top, bottom, height, segments),
material
);
mesh.position.set(...position);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function sphere(parent, radius, position, material, scale = [1, 1, 1]) {
const mesh = new THREE.Mesh(new THREE.SphereGeometry(radius, 24, 16), material);
mesh.position.set(...position);
mesh.scale.set(...scale);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
const up = new THREE.Vector3(0, 1, 0);
function cylinderBetween(parent, a, b, radius, material, segments = 12) {
const start = new THREE.Vector3(...a);
const end = new THREE.Vector3(...b);
const direction = end.clone().sub(start);
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(radius, radius, direction.length(), segments),
material
);
mesh.position.copy(start).add(end).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(up, direction.normalize());
mesh.castShadow = true;
parent.add(mesh);
return mesh;
}
function roundedRect(ctx, x, y, w, h, r) {
r = Math.min(r, w / 2, h / 2);
ctx.beginPath();
ctx.moveTo(x + r, y);
ctx.arcTo(x + w, y, x + w, y + h, r);
ctx.arcTo(x + w, y + h, x, y + h, r);
ctx.arcTo(x, y + h, x, y, r);
ctx.arcTo(x, y, x + w, y, r);
ctx.closePath();
}
function makeSign(
title,
subtitle = "",
width = 3,
height = 0.75,
options = {}
) {
const accent = options.accent || palette.teal;
const background = options.background || palette.paper;
const foreground = options.foreground || palette.ink;
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = Math.max(180, Math.round(1024 * height / width));
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.shadowColor = "rgba(23,52,59,0.15)";
ctx.shadowBlur = 24;
ctx.shadowOffsetY = 9;
roundedRect(ctx, 12, 12, 1000, canvas.height - 24, 34);
ctx.fillStyle = background;
ctx.fill();
ctx.shadowColor = "transparent";
ctx.fillStyle = accent;
roundedRect(ctx, 36, 34, 13, canvas.height - 68, 7);
ctx.fill();
let titleSize = options.titleSize || 58;
ctx.font = `750 ${titleSize}px system-ui, sans-serif`;
while (ctx.measureText(title).width > 885 && titleSize > 29) {
titleSize -= 2;
ctx.font = `750 ${titleSize}px system-ui, sans-serif`;
}
ctx.fillStyle = foreground;
ctx.textBaseline = "middle";
ctx.fillText(title, 76, subtitle ? canvas.height * 0.39 : canvas.height * 0.5, 885);
if (subtitle) {
ctx.fillStyle = options.subtitleColor || "rgba(23,52,59,0.68)";
ctx.font = `600 ${options.subtitleSize || 27}px system-ui, sans-serif`;
ctx.fillText(subtitle, 78, canvas.height * 0.70, 875);
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
const material = new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
toneMapped: false,
depthWrite: false
});
const mesh = new THREE.Mesh(new THREE.PlaneGeometry(width, height), material);
mesh.renderOrder = 2;
return mesh;
}
function makeFloorLabel(text, width, depth, color = "#176f73") {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 180;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.font = "800 54px system-ui, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = color;
ctx.fillText(text, 512, 90, 960);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(width, depth),
new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
depthWrite: false,
toneMapped: false
})
);
mesh.rotation.x = -Math.PI / 2;
mesh.position.y = 0.027;
mesh.renderOrder = 3;
return mesh;
}
function makeFloorSymbol(x, z, size = 2.5) {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 512;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, 512, 512);
ctx.strokeStyle = "#176f73";
ctx.lineWidth = 13;
ctx.beginPath();
ctx.arc(255, 283, 133, 0, Math.PI * 2);
ctx.stroke();
ctx.fillStyle = "#176f73";
ctx.beginPath();
ctx.arc(248, 128, 30, 0, Math.PI * 2);
ctx.fill();
ctx.lineCap = "round";
ctx.lineJoin = "round";
ctx.lineWidth = 25;
ctx.beginPath();
ctx.moveTo(245, 176);
ctx.lineTo(232, 286);
ctx.lineTo(327, 286);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(267, 221);
ctx.lineTo(357, 221);
ctx.stroke();
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(size, size),
new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
depthWrite: false,
toneMapped: false
})
);
mesh.rotation.x = -Math.PI / 2;
mesh.position.set(x, 0.03, z);
mesh.renderOrder = 4;
return mesh;
}
function makeArrow(x, z, color, rotation = 0) {
const shape = new THREE.Shape();
shape.moveTo(-0.23, -0.7);
shape.lineTo(0.23, -0.7);
shape.lineTo(0.23, 0.18);
shape.lineTo(0.64, 0.18);
shape.lineTo(0, 0.88);
shape.lineTo(-0.64, 0.18);
shape.lineTo(-0.23, 0.18);
shape.closePath();
const mesh = new THREE.Mesh(
new THREE.ShapeGeometry(shape),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.8,
depthWrite: false,
side: THREE.DoubleSide
})
);
mesh.rotation.x = -Math.PI / 2;
mesh.rotation.z = rotation;
mesh.position.set(x, 0.032, z);
mesh.renderOrder = 3;
return mesh;
}
function makePlant(x, z, scale = 1, parent = scene) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.scale.setScalar(scale);
parent.add(group);
cylinder(group, 0.47, 0.35, 0.58, [0, 0.29, 0], mat.peach);
cylinder(group, 0.43, 0.43, 0.055, [0, 0.59, 0], mat.wood);
const stemMaterial = standard(palette.green, { roughness: 0.9 });
for (let i = 0; i < 9; i++) {
const angle = (i / 9) * Math.PI * 2;
const height = 0.75 + (i % 3) * 0.17;
const reach = 0.30 + (i % 2) * 0.12;
const tip = [
Math.cos(angle) * reach,
height,
Math.sin(angle) * reach
];
cylinderBetween(group, [0, 0.58, 0], tip, 0.018, stemMaterial);
const leaf = sphere(group, 0.25, tip, stemMaterial, [0.44, 1.25, 0.22]);
leaf.rotation.set(
Math.sin(angle) * 0.55,
-angle,
Math.cos(angle) * 0.55
);
}
return group;
}
function makeDeskPlant(parent, x, y, z) {
const group = new THREE.Group();
group.position.set(x, y, z);
parent.add(group);
cylinder(group, 0.16, 0.12, 0.23, [0, 0.115, 0], mat.peach, 20);
cylinder(group, 0.035, 0.035, 0.45, [0, 0.38, 0], mat.green, 10);
const leafA = sphere(group, 0.20, [0.08, 0.48, 0], mat.green, [0.45, 1.1, 0.25]);
leafA.rotation.z = -0.45;
const leafB = sphere(group, 0.18, [-0.08, 0.37, 0.02], mat.tealLight, [0.4, 1.0, 0.25]);
leafB.rotation.z = 0.55;
}
// Lighting
scene.add(new THREE.HemisphereLight(0xf8fcff, 0xb39d82, 2.25));
const sun = new THREE.DirectionalLight(0xfff1d8, 3.2);
sun.position.set(7, 13, 10);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -16;
sun.shadow.camera.right = 16;
sun.shadow.camera.top = 15;
sun.shadow.camera.bottom = -13;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 45;
sun.shadow.normalBias = 0.035;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xbde9ed, 1.15);
fill.position.set(-10, 8, 2);
scene.add(fill);
// Room shell
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(70, 70),
standard(0xd7e5e1, { roughness: 1 })
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.31;
ground.receiveShadow = true;
scene.add(ground);
box(scene, [22, 0.28, 16], [0, -0.14, 0.5], mat.floor, false, true);
box(scene, [22, 6.1, 0.25], [0, 3.05, -7.55], mat.cream, false, true);
box(scene, [0.25, 6.1, 15], [-11, 3.05, -0.2], mat.cream, false, true);
box(scene, [22, 1.05, 0.07], [0, 0.53, -7.38], mat.teal, false, true);
box(scene, [0.07, 1.05, 14.8], [-10.83, 0.53, -0.2], mat.teal, false, true);
box(scene, [22, 0.12, 0.08], [0, 0.12, -7.32], mat.gold, false, true);
// Decorative vertical wall rhythm
for (let i = -5; i <= 5; i++) {
box(
scene,
[0.17, 4.45, 0.11],
[i * 1.06, 2.85, -7.31],
i % 2 === 0 ? mat.peach : mat.tealPale,
false,
true
);
}
// Subtle tile joints
const tileVertices = [];
for (let x = -10; x <= 10; x += 2) {
tileVertices.push(x, 0.008, -7, x, 0.008, 8);
}
for (let z = -7; z <= 8; z += 2) {
tileVertices.push(-10.8, 0.008, z, 10.8, 0.008, z);
}
const tileGeometry = new THREE.BufferGeometry();
tileGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(tileVertices, 3)
);
const tileLines = new THREE.LineSegments(
tileGeometry,
new THREE.LineBasicMaterial({
color: 0xc8c0b2,
transparent: true,
opacity: 0.46
})
);
scene.add(tileLines);
// Shared floor zones
const sharedZone = new THREE.Mesh(
new THREE.PlaneGeometry(8.6, 4.0),
new THREE.MeshBasicMaterial({
color: palette.gold,
transparent: true,
opacity: 0.10,
depthWrite: false
})
);
sharedZone.rotation.x = -Math.PI / 2;
sharedZone.position.set(0, 0.012, 3.25);
scene.add(sharedZone);
const accessibleZone = new THREE.Mesh(
new THREE.PlaneGeometry(2.8, 3.2),
new THREE.MeshBasicMaterial({
color: palette.teal,
transparent: true,
opacity: 0.10,
depthWrite: false
})
);
accessibleZone.rotation.x = -Math.PI / 2;
accessibleZone.position.set(-2, 0.015, -0.15);
scene.add(accessibleZone);
const standardZone = new THREE.Mesh(
new THREE.PlaneGeometry(2.8, 3.2),
new THREE.MeshBasicMaterial({
color: palette.coral,
transparent: true,
opacity: 0.09,
depthWrite: false
})
);
standardZone.rotation.x = -Math.PI / 2;
standardZone.position.set(2, 0.015, -0.15);
scene.add(standardZone);
scene.add(makeArrow(0, 4.8, palette.gold));
scene.add(makeArrow(0, 3.2, palette.gold));
scene.add(makeArrow(-1.1, 1.3, palette.teal, -0.12));
scene.add(makeArrow(1.1, 1.3, palette.coral, 0.12));
const sharedLabel = makeFloorLabel("SHARED QUEUE", 4.0, 0.66, "#a87a25");
sharedLabel.position.set(0, 0.029, 5.75);
scene.add(sharedLabel);
const stepFreeLabel = makeFloorLabel("STEP-FREE", 2.4, 0.52, "#176f73");
stepFreeLabel.position.set(-2, 0.029, 1.2);
scene.add(stepFreeLabel);
const standardLabel = makeFloorLabel("GENERAL SERVICE", 2.8, 0.52, "#c7654d");
standardLabel.position.set(2, 0.029, 1.2);
scene.add(standardLabel);
const turningRing = new THREE.Mesh(
new THREE.RingGeometry(1.17, 1.22, 64),
new THREE.MeshBasicMaterial({
color: palette.teal,
transparent: true,
opacity: 0.55,
side: THREE.DoubleSide
})
);
turningRing.rotation.x = -Math.PI / 2;
turningRing.position.set(-2, 0.025, 0.1);
scene.add(turningRing);
scene.add(makeFloorSymbol(-2, 0.1, 2.25));
// One broad, step-free entrance with paired markers rather than separate doors
box(scene, [0.42, 3.25, 0.42], [-9.15, 1.62, 7.15], mat.teal);
box(scene, [0.42, 3.25, 0.42], [9.15, 1.62, 7.15], mat.teal);
box(scene, [8.6, 0.035, 1.35], [0, 0.023, 6.65], mat.tealPale, false, true);
const welcomeLabel = makeFloorLabel("WELCOME • STEP-FREE ENTRY", 7.2, 0.72, "#176f73");
welcomeLabel.position.set(0, 0.045, 6.65);
scene.add(welcomeLabel);
// Entrance sign on a modest stand
cylinder(scene, 0.045, 0.055, 1.7, [-6.7, 0.85, 5.5], mat.gold, 16);
cylinder(scene, 0.35, 0.35, 0.08, [-6.7, 0.04, 5.5], mat.gold, 24);
const entranceSign = makeSign(
"ONE SHARED ENTRANCE",
"Step-free access • no separate queues",
3.7,
0.9,
{ accent: palette.gold }
);
entranceSign.position.set(-6.7, 1.65, 5.5);
scene.add(entranceSign);
// Queue stanchions: a generous shared bay, open across its full width
function stanchion(x, z) {
cylinder(scene, 0.30, 0.34, 0.07, [x, 0.035, z], mat.ink, 24);
cylinder(scene, 0.045, 0.055, 1.02, [x, 0.55, z], mat.gold, 18);
sphere(scene, 0.085, [x, 1.09, z], mat.gold);
}
[-4.65, 4.65].forEach((x) => {
stanchion(x, 4.55);
stanchion(x, 2.0);
cylinderBetween(scene, [x, 1.0, 4.55], [x, 1.0, 2.0], 0.025, mat.ink);
});
const waitSign = makeSign(
"PLEASE WAIT HERE",
"Staff will invite each visitor forward",
2.2,
0.62,
{ accent: palette.gold }
);
waitSign.position.set(4.6, 1.53, 3.25);
waitSign.rotation.y = -0.12;
scene.add(waitSign);
cylinder(scene, 0.035, 0.045, 1.35, [4.6, 0.68, 3.27], mat.gold, 16);
// Connected dual-height service desk
const desk = new THREE.Group();
scene.add(desk);
// Lower, accessible section: open knee space below the worktop
box(desk, [4.0, 0.12, 1.18], [-2.0, 0.79, -3.1], mat.woodLight);
box(desk, [0.24, 0.73, 1.08], [-3.88, 0.365, -3.12], mat.teal);
box(desk, [0.24, 0.73, 1.08], [-0.12, 0.365, -3.12], mat.teal);
box(desk, [3.72, 0.54, 0.10], [-2.0, 0.35, -3.60], mat.tealPale);
box(desk, [4.0, 0.055, 1.20], [-2.0, 0.715, -3.1], mat.gold);
// Standard section, attached to the lower section at the center seam
box(desk, [4.0, 0.14, 1.18], [2.0, 1.06, -3.1], mat.woodLight);
box(desk, [3.96, 1.0, 1.08], [2.0, 0.5, -3.12], mat.teal);
box(desk, [3.72, 0.045, 1.19], [2.0, 1.005, -3.1], mat.coral);
box(desk, [0.06, 0.78, 1.14], [0.03, 0.47, -3.1], mat.gold);
// Counter sign stands
cylinder(desk, 0.025, 0.025, 0.48, [-3.2, 1.05, -3.14], mat.gold, 12);
cylinder(desk, 0.025, 0.025, 0.48, [-0.8, 1.05, -3.14], mat.gold, 12);
const lowerSign = makeSign(
"LOWER COUNTER",
"Step-free service • open knee clearance",
2.9,
0.72,
{ accent: palette.teal }
);
lowerSign.position.set(-2, 1.38, -3.08);
desk.add(lowerSign);
cylinder(desk, 0.025, 0.025, 0.57, [0.85, 1.40, -3.14], mat.gold, 12);
cylinder(desk, 0.025, 0.025, 0.57, [3.15, 1.40, -3.14], mat.gold, 12);
const higherSign = makeSign(
"STANDARD COUNTER",
"General reception service",
2.9,
0.72,
{ accent: palette.coral }
);
higherSign.position.set(2, 1.76, -3.08);
desk.add(higherSign);
// Main wall identity
const mainSign = makeSign(
"COMMUNITY RECEPTION",
"One welcome • accessible to everyone",
8.2,
1.55,
{ accent: palette.teal, titleSize: 66 }
);
mainSign.position.set(0, 4.55, -7.17);
scene.add(mainSign);
// Notice board on side wall
const notice = makeSign(
"EVERYONE BELONGS HERE",
"Ask us how we can help",
3.5,
1.35,
{ accent: palette.coral }
);
notice.position.set(-10.81, 2.45, -0.8);
notice.rotation.y = Math.PI / 2;
scene.add(notice);
// Community emblem on standard counter front
function makeBadge() {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 512;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, 512, 512);
ctx.fillStyle = "#fffaf0";
ctx.beginPath();
ctx.arc(256, 256, 220, 0, Math.PI * 2);
ctx.fill();
const colors = ["#176f73", "#d5a64a", "#e98568"];
for (let i = 0; i < 3; i++) {
ctx.save();
ctx.translate(256, 256);
ctx.rotate((i * Math.PI * 2) / 3 - Math.PI / 2);
ctx.fillStyle = colors[i];
roundedRect(ctx, -34, -155, 68, 125, 28);
ctx.fill();
ctx.restore();
}
ctx.fillStyle = "#17343b";
ctx.beginPath();
ctx.arc(256, 256, 48, 0, Math.PI * 2);
ctx.fill();
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
return new THREE.Mesh(
new THREE.PlaneGeometry(0.72, 0.72),
new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
toneMapped: false,
depthWrite: false
})
);
}
const badge = makeBadge();
badge.position.set(2, 0.54, -2.565);
desk.add(badge);
// Counter monitors, task lights, bell and forms
function makeMonitor(parent, x, y, z, accent) {
const group = new THREE.Group();
group.position.set(x, y, z);
parent.add(group);
box(group, [0.62, 0.045, 0.30], [0, 0.025, 0], mat.ink);
cylinder(group, 0.035, 0.045, 0.35, [0, 0.20, -0.02], mat.ink, 14);
box(group, [0.64, 0.42, 0.075], [0, 0.56, -0.02], mat.ink);
box(group, [0.55, 0.32, 0.012], [0, 0.56, 0.025], mat.screen);
box(group, [0.48, 0.025, 0.015], [0, 0.61, 0.035], accent, false, false);
box(group, [0.34, 0.025, 0.015], [-0.04, 0.52, 0.035], mat.white, false, false);
}
makeMonitor(desk, -3.2, 0.85, -3.46, mat.tealLight);
makeMonitor(desk, 3.0, 1.13, -3.48, mat.coral);
function makeTaskLamp(parent, x, y, z) {
cylinder(parent, 0.14, 0.16, 0.05, [x, y + 0.025, z], mat.ink, 20);
cylinderBetween(
parent,
[x, y + 0.05, z],
[x + 0.05, y + 0.62, z],
0.025,
mat.ink
);
cylinderBetween(
parent,
[x + 0.05, y + 0.62, z],
[x + 0.35, y + 0.78, z + 0.05],
0.025,
mat.ink
);
const shade = sphere(parent, 0.15, [x + 0.38, y + 0.76, z + 0.05], mat.coral, [1, 0.55, 1]);
}
makeTaskLamp(desk, -0.55, 0.85, -3.37);
makeTaskLamp(desk, 0.65, 1.13, -3.35);
makeDeskPlant(desk, -3.55, 0.85, -3.12);
makeDeskPlant(desk, 3.65, 1.13, -3.14);
cylinder(desk, 0.13, 0.15, 0.05, [1.15, 1.165, -2.92], mat.gold, 24);
sphere(desk, 0.10, [1.15, 1.215, -2.92], mat.gold, [1, 0.65, 1]);
box(desk, [0.44, 0.035, 0.32], [0.45, 1.15, -2.92], mat.paper);
box(desk, [0.39, 0.025, 0.28], [0.47, 1.185, -2.92], mat.white);
// People and service interactions
const skinMat = standard(palette.skin);
const skinLightMat = standard(palette.skinLight);
const hairMat = standard(palette.hair);
const shirtTeal = standard(palette.teal);
const shirtCoral = standard(palette.coral);
const shirtGold = standard(palette.gold);
const trousers = standard(0x3f5660);
function makeStandingPerson({
position,
rotation = 0,
shirt,
skin = skinMat,
hair = hairMat,
reaching = false,
scale = 1
}) {
const group = new THREE.Group();
group.position.set(...position);
group.rotation.y = rotation;
group.scale.setScalar(scale);
scene.add(group);
box(group, [0.23, 0.15, 0.40], [-0.17, 0.08, 0.05], mat.ink);
box(group, [0.23, 0.15, 0.40], [0.17, 0.08, 0.05], mat.ink);
cylinderBetween(group, [-0.17, 0.14, 0], [-0.16, 0.84, 0], 0.105, trousers);
cylinderBetween(group, [0.17, 0.14, 0], [0.16, 0.84, 0], 0.105, trousers);
const torso = new THREE.Mesh(new THREE.CapsuleGeometry(0.29, 0.46, 5, 12), shirt);
torso.position.y = 1.16;
torso.castShadow = true;
group.add(torso);
cylinder(group, 0.10, 0.11, 0.16, [0, 1.61, 0], skin, 16);
sphere(group, 0.235, [0, 1.83, 0], skin, [1, 1.08, 0.96]);
const hairCap = new THREE.Mesh(
new THREE.SphereGeometry(0.242, 24, 14, 0, Math.PI * 2, 0, Math.PI * 0.56),
hair
);
hairCap.position.set(0, 1.86, -0.012);
hairCap.castShadow = true;
group.add(hairCap);
sphere(group, 0.045, [0, 1.82, 0.225], skin, [0.8, 0.9, 1.1]);
sphere(group, 0.024, [-0.077, 1.88, 0.207], mat.ink);
sphere(group, 0.024, [0.077, 1.88, 0.207], mat.ink);
if (reaching) {
cylinderBetween(group, [-0.31, 1.40, 0], [-0.30, 1.13, 0.43], 0.082, shirt);
cylinderBetween(group, [-0.30, 1.13, 0.43], [-0.29, 1.01, 0.61], 0.068, skin);
sphere(group, 0.085, [-0.29, 1.00, 0.63], skin);
cylinderBetween(group, [0.31, 1.40, 0], [0.34, 1.04, 0.06], 0.082, shirt);
sphere(group, 0.085, [0.35, 1.00, 0.08], skin);
} else {
cylinderBetween(group, [-0.31, 1.40, 0], [-0.38, 0.98, 0.04], 0.082, shirt);
cylinderBetween(group, [0.31, 1.40, 0], [0.38, 0.98, 0.04], 0.082, shirt);
sphere(group, 0.085, [-0.39, 0.94, 0.05], skin);
sphere(group, 0.085, [0.39, 0.94, 0.05], skin);
}
// Small name badge
box(group, [0.19, 0.10, 0.018], [-0.13, 1.26, 0.286], mat.paper, false, false);
return group;
}
// Staff behind each section
makeStandingPerson({
position: [-2.0, 0, -4.35],
rotation: 0,
shirt: shirtTeal,
skin: skinLightMat,
reaching: true
});
makeStandingPerson({
position: [2.0, 0, -4.35],
rotation: 0,
shirt: shirtCoral,
skin: skinMat,
reaching: true
});
// Standard-height visitor
makeStandingPerson({
position: [2.0, 0, -1.52],
rotation: Math.PI,
shirt: shirtGold,
skin: skinLightMat,
reaching: true
});
// Wheelchair user at the lower service point
function makeWheelchairUser() {
const group = new THREE.Group();
group.position.set(-2.0, 0, -1.35);
group.rotation.y = Math.PI;
scene.add(group);
const wheelMaterial = mat.darkRubber;
const metalMaterial = mat.ink;
[-0.52, 0.52].forEach((x) => {
const wheel = new THREE.Mesh(
new THREE.TorusGeometry(0.38, 0.055, 12, 32),
wheelMaterial
);
wheel.position.set(x, 0.42, -0.03);
wheel.rotation.y = Math.PI / 2;
wheel.castShadow = true;
group.add(wheel);
const hub = new THREE.Mesh(
new THREE.CylinderGeometry(0.065, 0.065, 0.13, 16),
metalMaterial
);
hub.position.set(x, 0.42, -0.03);
hub.rotation.z = Math.PI / 2;
group.add(hub);
cylinderBetween(group, [x * 0.76, 0.39, -0.02], [x * 0.76, 0.64, -0.25], 0.018, metalMaterial);
const caster = new THREE.Mesh(
new THREE.TorusGeometry(0.105, 0.027, 10, 20),
wheelMaterial
);
caster.position.set(x * 0.77, 0.14, 0.43);
caster.rotation.y = Math.PI / 2;
group.add(caster);
});
box(group, [0.72, 0.12, 0.70], [0, 0.61, 0.02], mat.teal);
box(group, [0.74, 0.70, 0.10], [0, 0.93, -0.30], mat.teal);
cylinderBetween(group, [-0.39, 0.85, -0.28], [-0.39, 1.12, -0.28], 0.025, metalMaterial);
cylinderBetween(group, [0.39, 0.85, -0.28], [0.39, 1.12, -0.28], 0.025, metalMaterial);
box(group, [0.82, 0.045, 0.40], [0, 0.53, 0.34], metalMaterial);
box(group, [0.54, 0.045, 0.16], [0, 0.84, 0.37], metalMaterial);
// Seated body
cylinder(group, 0.11, 0.12, 0.16, [0, 1.45, 0], skinLightMat, 16);
const torso = new THREE.Mesh(new THREE.CapsuleGeometry(0.25, 0.36, 5, 12), shirtCoral);
torso.position.set(0, 1.12, 0.03);
torso.castShadow = true;
group.add(torso);
sphere(group, 0.22, [0, 1.67, 0.03], skinLightMat, [1, 1.08, 0.96]);
const hair = new THREE.Mesh(
new THREE.SphereGeometry(0.225, 24, 14, 0, Math.PI * 2, 0, Math.PI * 0.55),
hairMat
);
hair.position.set(0, 1.70, 0.015);
group.add(hair);
sphere(group, 0.04, [0, 1.66, 0.235], skinLightMat);
sphere(group, 0.021, [-0.07, 1.72, 0.214], mat.ink);
sphere(group, 0.021, [0.07, 1.72, 0.214], mat.ink);
// Thighs, lower legs and shoes
[-0.17, 0.17].forEach((x) => {
cylinderBetween(group, [x, 0.70, 0.05], [x, 0.69, 0.40], 0.095, trousers);
cylinderBetween(group, [x, 0.69, 0.40], [x, 0.26, 0.43], 0.078, trousers);
box(group, [0.19, 0.12, 0.32], [x, 0.21, 0.51], mat.ink);
});
// Reaching arms toward the lower counter
cylinderBetween(group, [-0.28, 1.34, 0.04], [-0.27, 1.08, 0.42], 0.075, shirtCoral);
cylinderBetween(group, [-0.27, 1.08, 0.42], [-0.25, 0.99, 0.59], 0.063, skinLightMat);
sphere(group, 0.08, [-0.25, 0.98, 0.61], skinLightMat);
cylinderBetween(group, [0.28, 1.34, 0.04], [0.31, 0.98, 0.12], 0.075, shirtCoral);
sphere(group, 0.08, [0.32, 0.94, 0.13], skinLightMat);
return group;
}
makeWheelchairUser();
// Additional waiting visitor in the shared queue
makeStandingPerson({
position: [3.15, 0, 1.75],
rotation: Math.PI,
shirt: shirtTeal,
skin: skinMat,
reaching: false,
scale: 0.96
});
// Seating: an inclusive bench with arms and open adjacent space
const bench = new THREE.Group();
bench.position.set(7.35, 0, 1.45);
scene.add(bench);
box(bench, [0.88, 0.16, 4.1], [0, 0.46, 0], mat.wood);
box(bench, [0.13, 1.05, 4.12], [0.42, 0.92, 0], mat.woodLight);
box(bench, [0.12, 0.48, 0.12], [-0.33, 0.22, -1.76], mat.ink);
box(bench, [0.12, 0.48, 0.12], [-0.33, 0.22, 1.76], mat.ink);
const cushionMaterials = [mat.teal, mat.coral, mat.gold];
[-1.32, 0, 1.32].forEach((z, i) => {
box(bench, [0.72, 0.17, 1.16], [-0.04, 0.62, z], cushionMaterials[i]);
box(
bench,
[0.12, 0.68, 1.16],
[0.34, 1.05, z],
cushionMaterials[i]
);
});
// Bench arms leave a clear transfer space alongside
[-1.92, 1.92].forEach((z) => {
cylinder(bench, 0.035, 0.04, 0.64, [-0.31, 0.79, z], mat.ink, 14);
cylinder(bench, 0.035, 0.04, 0.64, [0.31, 0.79, z], mat.ink, 14);
cylinderBetween(bench, [-0.31, 1.10, z], [0.31, 1.10, z], 0.035, mat.ink);
});
const sideTable = new THREE.Group();
sideTable.position.set(7.25, 0, 4.25);
scene.add(sideTable);
cylinder(sideTable, 0.52, 0.52, 0.08, [0, 0.62, 0], mat.woodLight, 32);
cylinder(sideTable, 0.08, 0.10, 0.60, [0, 0.30, 0], mat.ink, 18);
cylinder(sideTable, 0.32, 0.32, 0.05, [0, 0.03, 0], mat.ink, 24);
makeDeskPlant(sideTable, 0, 0.66, 0);
// Plants soften the open reception area
makePlant(-8.65, -3.6, 1.05);
makePlant(8.25, -4.65, 1.18);
makePlant(-8.25, 3.8, 0.78);
makePlant(9.0, 5.5, 0.62);
// A small accessible side table and resting point beside the bench
cylinder(scene, 0.40, 0.40, 0.07, [5.95, 0.62, 3.65], mat.woodLight, 32);
cylinder(scene, 0.06, 0.08, 0.58, [5.95, 0.30, 3.65], mat.ink, 16);
cylinder(scene, 0.25, 0.25, 0.04, [5.95, 0.02, 3.65], mat.ink, 20);
// Interactive hotspots
const pickables = [];
function addHotspot(size, position, title, text, accent) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(...size),
new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0,
depthWrite: false
})
);
mesh.position.set(...position);
mesh.userData.title = title;
mesh.userData.text = text;
mesh.userData.accent = accent;
scene.add(mesh);
pickables.push(mesh);
}
addHotspot(
[4.0, 1.2, 1.4],
[-2.0, 0.75, -3.05],
"Lower service point",
"An approximately 0.85 m high worktop leaves open knee space beneath it. A wheelchair user is being served here while remaining part of the same reception desk and public queue.",
"#176f73"
);
addHotspot(
[4.0, 1.5, 1.4],
[2.0, 0.95, -3.05],
"Standard service point",
"The standard-height counter is joined directly to the lower section. Both service points share staff space, sightlines and the same public approach.",
"#e98568"
);
addHotspot(
[8.0, 0.35, 1.4],
[0, 0.14, 6.65],
"A single step-free entrance",
"The broad, level threshold has no separate doorway for different visitors. Everyone enters the same reception area and joins one shared queue.",
"#d5a64a"
);
addHotspot(
[2.6, 0.25, 2.4],
[-2, 0.08, 0.1],
"Clear turning space",
"A marked wheelchair turning area sits beside the lower service point, separated from furniture and queue stanchions.",
"#176f73"
);
const detailTitle = document.getElementById("detail-title");
const detailText = document.getElementById("detail-text");
const detailCard = document.querySelector(".detail");
function showDetail(hit) {
detailTitle.textContent = hit.object.userData.title;
detailText.textContent = hit.object.userData.text;
detailCard.style.borderLeftColor = hit.object.userData.accent;
}
// Camera controls implemented directly without external controls modules
const views = {
overview: { target: [0, 1.0, -0.4], radius: 23.5, theta: 0.49, phi: 0.91 },
queue: { target: [0, 0.75, 2.0], radius: 11.5, theta: 0.12, phi: 1.12 },
accessible: { target: [-2.0, 0.95, -2.2], radius: 7.4, theta: 0.23, phi: 1.07 }
};
const cameraState = {
target: new THREE.Vector3(...views.overview.target),
radius: views.overview.radius,
theta: views.overview.theta,
phi: views.overview.phi
};
const cameraGoal = {
target: cameraState.target.clone(),
radius: cameraState.radius,
theta: cameraState.theta,
phi: cameraState.phi
};
function setView(name) {
const view = views[name];
cameraGoal.target.set(...view.target);
cameraGoal.radius = view.radius;
cameraGoal.theta = view.theta;
cameraGoal.phi = view.phi;
}
document.querySelectorAll("[data-view]").forEach((button) => {
button.addEventListener("click", () => setView(button.dataset.view));
});
function updateCamera(delta) {
const smoothing = 1 - Math.pow(0.001, delta);
cameraState.target.lerp(cameraGoal.target, smoothing);
cameraState.radius += (cameraGoal.radius - cameraState.radius) * smoothing;
cameraState.theta += (cameraGoal.theta - cameraState.theta) * smoothing;
cameraState.phi += (cameraGoal.phi - cameraState.phi) * smoothing;
const sinPhi = Math.sin(cameraState.phi);
camera.position.set(
cameraState.target.x + cameraState.radius * sinPhi * Math.sin(cameraState.theta),
cameraState.target.y + cameraState.radius * Math.cos(cameraState.phi),
cameraState.target.z + cameraState.radius * sinPhi * Math.cos(cameraState.theta)
);
camera.lookAt(cameraState.target);
}
const pointer = new THREE.Vector2();
const raycaster = new THREE.Raycaster();
let dragging = false;
let pointerMoved = false;
let previousX = 0;
let previousY = 0;
let activeButton = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
pointerMoved = false;
previousX = event.clientX;
previousY = event.clientY;
activeButton = event.button;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
if (Math.abs(dx) + Math.abs(dy) > 1) pointerMoved = true;
if (event.shiftKey || activeButton === 2) {
const panScale = cameraState.radius * 0.0011;
cameraGoal.target.x -= dx * panScale;
cameraGoal.target.z += dy * panScale;
cameraGoal.target.x = THREE.MathUtils.clamp(cameraGoal.target.x, -8, 8);
cameraGoal.target.z = THREE.MathUtils.clamp(cameraGoal.target.z, -5, 7);
} else {
cameraGoal.theta -= dx * 0.0055;
cameraGoal.phi = THREE.MathUtils.clamp(
cameraGoal.phi - dy * 0.0045,
0.38,
1.36
);
}
cameraState.target.copy(cameraGoal.target);
cameraState.theta = cameraGoal.theta;
cameraState.phi = cameraGoal.phi;
});
renderer.domElement.addEventListener("pointerup", (event) => {
dragging = false;
if (!pointerMoved) {
const rect = renderer.domElement.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointer, camera);
const hits = raycaster.intersectObjects(pickables, false);
if (hits.length) showDetail(hits[0]);
}
});
renderer.domElement.addEventListener("pointercancel", () => {
dragging = false;
});
renderer.domElement.addEventListener("contextmenu", (event) => event.preventDefault());
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraGoal.radius = THREE.MathUtils.clamp(
cameraGoal.radius * Math.exp(event.deltaY * 0.001),
5.5,
31
);
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", () => setView("overview"));
renderer.domElement.addEventListener("keydown", (event) => {
const key = event.key.toLowerCase();
if (key === "r") {
setView("overview");
event.preventDefault();
} else if (event.key === "ArrowLeft") {
cameraGoal.theta += 0.08;
event.preventDefault();
} else if (event.key === "ArrowRight") {
cameraGoal.theta -= 0.08;
event.preventDefault();
} else if (event.key === "ArrowUp") {
cameraGoal.phi = Math.max(0.38, cameraGoal.phi - 0.06);
event.preventDefault();
} else if (event.key === "ArrowDown") {
cameraGoal.phi = Math.min(1.36, cameraGoal.phi + 0.06);
event.preventDefault();
} else if (key === "+" || key === "=") {
cameraGoal.radius = Math.max(5.5, cameraGoal.radius - 0.7);
event.preventDefault();
} else if (key === "-") {
cameraGoal.radius = Math.min(31, cameraGoal.radius + 0.7);
event.preventDefault();
}
});
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
const clock = new THREE.Clock();
let firstFrame = true;
renderer.setAnimationLoop(() => {
const delta = Math.min(clock.getDelta(), 0.05);
updateCamera(delta);
renderer.render(scene, camera);
if (firstFrame) {
firstFrame = false;
requestAnimationFrame(() => {
document.getElementById("loading").classList.add("hidden");
});
}
});
</script>
</body>
</html>
```