Prompt specification
Build or customize the Three.js 3D scene "Three coordinated rowing positions" 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: Three coordinated rowing positions
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/three-coordinated-rowing-positions-x2262
Scene Description Prompt:
Make a voxel Three.js scene in a self-contained HTML file using cdnjs: Three coordinated rowing positions. Create a small referenced trireme cross-section with separated rowing positions. Animate synchronized strokes while preserving oar clearances and marking disputed reconstruction choices.
Working Three.js Starter (three-coordinated-rowing-positions-x2262):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Trireme — Three-Bank Rowing Study</title>
<style>
:root {
--bg: #071216;
--panel: rgba(8, 24, 29, 0.88);
--line: rgba(151, 211, 208, 0.22);
--text: #e8f0ed;
--muted: #93aaa8;
--cyan: #75d8cf;
--cyan-soft: rgba(117, 216, 207, 0.13);
--amber: #ffad5c;
--amber-soft: rgba(255, 173, 92, 0.13);
--ivory: #e7d7b7;
}
* { box-sizing: border-box; }
html, body {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: var(--bg);
color: var(--text);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button, input { font: inherit; }
#app {
position: relative;
width: 100%;
height: 100%;
isolation: isolate;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
.topbar {
position: absolute;
z-index: 5;
top: 24px;
left: 28px;
pointer-events: none;
max-width: 540px;
text-shadow: 0 2px 18px #000;
}
.eyebrow {
color: var(--cyan);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.24em;
text-transform: uppercase;
}
h1 {
margin: 7px 0 4px;
font-size: clamp(25px, 3.2vw, 47px);
line-height: 0.96;
font-weight: 620;
letter-spacing: -0.045em;
}
.subtitle {
margin: 10px 0 0;
color: #b8c9c6;
font-size: 12px;
line-height: 1.55;
max-width: 470px;
}
.subtitle strong { color: var(--text); font-weight: 600; }
.controls {
position: absolute;
z-index: 6;
top: 24px;
right: 28px;
width: 306px;
padding: 15px;
border: 1px solid var(--line);
border-radius: 13px;
background: var(--panel);
backdrop-filter: blur(15px);
box-shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
}
.control-row {
display: flex;
align-items: center;
gap: 8px;
}
.control-row + .control-row {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid var(--line);
}
.control-label {
color: var(--muted);
font-size: 9px;
font-weight: 700;
letter-spacing: 0.15em;
text-transform: uppercase;
}
button {
color: var(--text);
background: rgba(117, 216, 207, 0.07);
border: 1px solid rgba(117, 216, 207, 0.28);
border-radius: 8px;
padding: 8px 10px;
cursor: pointer;
transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
button:hover {
background: rgba(117, 216, 207, 0.15);
border-color: rgba(117, 216, 207, 0.62);
}
button:active { transform: translateY(1px); }
button.primary {
min-width: 92px;
color: #071216;
background: var(--cyan);
border-color: var(--cyan);
font-weight: 750;
}
button.primary:hover { background: #9ae8e1; }
.views {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px;
margin-top: 7px;
}
.views button {
padding: 7px 5px;
font-size: 10px;
}
input[type="range"] {
width: 100%;
accent-color: var(--cyan);
}
.speed-row {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
gap: 10px;
margin-top: 7px;
}
.speed-value {
min-width: 48px;
color: var(--cyan);
font-size: 11px;
text-align: right;
font-variant-numeric: tabular-nums;
}
.toggle {
display: flex;
align-items: center;
gap: 8px;
margin-top: 10px;
color: #c7d5d2;
font-size: 11px;
cursor: pointer;
}
.toggle input {
width: 15px;
height: 15px;
accent-color: var(--amber);
}
.notes-toggle { display: none; }
.ledger {
position: absolute;
z-index: 6;
top: 246px;
right: 28px;
bottom: 28px;
width: 306px;
padding: 16px;
overflow: auto;
border: 1px solid var(--line);
border-radius: 13px;
background: var(--panel);
backdrop-filter: blur(15px);
box-shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
scrollbar-width: thin;
scrollbar-color: #31545a transparent;
}
.ledger h2 {
margin: 0 0 13px;
color: var(--cyan);
font-size: 10px;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.ledger h3 {
margin: 16px 0 8px;
color: #d7e3df;
font-size: 10px;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.ledger p {
margin: 0 0 10px;
color: #a9bcba;
font-size: 11px;
line-height: 1.55;
}
.ledger-item {
display: grid;
grid-template-columns: 28px 1fr;
gap: 9px;
margin: 0 0 10px;
color: #a9bcba;
font-size: 11px;
line-height: 1.5;
}
.ref,
.choice-id {
display: inline-flex;
align-items: center;
justify-content: center;
width: 27px;
height: 20px;
border-radius: 5px;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.05em;
}
.ref {
color: var(--cyan);
background: var(--cyan-soft);
border: 1px solid rgba(117, 216, 207, 0.3);
}
.choice-id {
color: var(--amber);
background: var(--amber-soft);
border: 1px solid rgba(255, 173, 92, 0.32);
}
.ledger-item strong {
color: #e1eae7;
font-weight: 650;
}
.ledger-note {
padding: 10px;
border-left: 2px solid var(--amber);
background: rgba(255, 173, 92, 0.055);
}
.ledger-note p { margin: 0; }
#labels {
position: absolute;
z-index: 3;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.scene-tag {
position: absolute;
transform: translate(-50%, -50%);
white-space: nowrap;
padding: 6px 8px;
border-radius: 6px;
font-size: 9px;
font-weight: 750;
letter-spacing: 0.08em;
text-transform: uppercase;
box-shadow: 0 5px 22px rgba(0, 0, 0, 0.36);
opacity: 0;
transition: opacity 180ms ease;
}
.scene-tag.visible { opacity: 1; }
.scene-tag.bank {
color: #dff8f4;
border: 1px solid rgba(117, 216, 207, 0.48);
background: rgba(6, 28, 32, 0.87);
}
.scene-tag.bank small {
display: block;
margin-top: 3px;
color: var(--cyan);
font-size: 8px;
letter-spacing: 0.12em;
}
.scene-tag.disputed {
color: #ffe0bd;
border: 1px solid rgba(255, 173, 92, 0.58);
background: rgba(39, 23, 11, 0.90);
}
.scene-tag.design {
color: #d8f7f3;
border: 1px dashed rgba(117, 216, 207, 0.72);
background: rgba(6, 28, 32, 0.88);
}
.legend {
position: absolute;
z-index: 5;
left: 28px;
bottom: 28px;
display: grid;
gap: 7px;
padding: 11px 13px;
border: 1px solid var(--line);
border-radius: 10px;
background: rgba(8, 24, 29, 0.76);
backdrop-filter: blur(12px);
pointer-events: none;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
color: #aebfbd;
font-size: 9px;
letter-spacing: 0.04em;
}
.swatch {
width: 17px;
height: 3px;
border-radius: 2px;
background: var(--cyan);
}
.swatch.amber { background: var(--amber); }
.swatch.ivory { background: var(--ivory); }
.swatch.dashed { height: 0; border-top: 2px dashed var(--amber); background: none; }
.status {
position: absolute;
z-index: 5;
left: 50%;
bottom: 28px;
width: min(500px, calc(100vw - 520px));
transform: translateX(-50%);
padding: 11px 14px;
border: 1px solid var(--line);
border-radius: 11px;
background: rgba(8, 24, 29, 0.82);
backdrop-filter: blur(12px);
}
.status-top {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
color: #b7c8c5;
font-size: 9px;
letter-spacing: 0.09em;
text-transform: uppercase;
}
#phaseText {
color: var(--cyan);
font-weight: 800;
}
#syncText { color: var(--cyan); }
.phase-track {
position: relative;
height: 3px;
margin-top: 9px;
overflow: hidden;
border-radius: 3px;
background: rgba(117, 216, 207, 0.13);
}
#phaseDot {
position: absolute;
top: -2px;
left: 0;
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--cyan);
box-shadow: 0 0 11px rgba(117, 216, 207, 0.8);
transform: translateX(-50%);
}
.hint {
position: absolute;
z-index: 4;
right: 355px;
bottom: 30px;
color: rgba(210, 225, 222, 0.58);
font-size: 9px;
letter-spacing: 0.07em;
pointer-events: none;
}
@media (max-width: 1050px) {
.controls { width: 270px; }
.ledger { width: 270px; }
.hint { display: none; }
.status { width: min(430px, calc(100vw - 450px)); }
}
@media (max-width: 760px) {
.topbar { top: 16px; left: 17px; max-width: calc(100vw - 34px); }
h1 { font-size: 28px; }
.subtitle { max-width: 330px; font-size: 10px; }
.controls { top: auto; right: 12px; bottom: 12px; width: 220px; padding: 11px; }
.controls .views { grid-template-columns: 1fr; }
.notes-toggle { display: inline-block; }
.ledger {
display: none;
top: 16px;
right: 12px;
bottom: auto;
width: min(320px, calc(100vw - 24px));
max-height: calc(100vh - 32px);
}
body.notes-open .ledger { display: block; }
.legend { left: 12px; bottom: 12px; padding: 8px 9px; }
.legend-item:nth-child(n+3) { display: none; }
.status {
left: 12px;
bottom: 115px;
width: calc(100vw - 258px);
min-width: 120px;
padding: 9px;
}
#angleText, #clearanceText { display: none; }
}
</style>
</head>
<body>
<div id="app">
<canvas id="scene" aria-label="Interactive three-bank trireme rowing reconstruction"></canvas>
<div id="labels" aria-hidden="true"></div>
<header class="topbar">
<div class="eyebrow">Reference-led reconstruction · plate 03</div>
<h1>Trireme<br>Rowing Study</h1>
<p class="subtitle">
<strong>Three coordinated port-side rowing positions</strong> in a schematic
hull cutaway. The opposite bank is omitted. Geometry is illustrative,
not a scaled naval plan.
</p>
</header>
<section class="controls" aria-label="Scene controls">
<div class="control-row">
<button class="primary" id="playButton" type="button">Pause</button>
<div style="flex:1">
<div class="control-label">Stroke speed</div>
<div class="speed-row">
<input id="speed" type="range" min="0.25" max="1.75" step="0.05" value="1">
<span class="speed-value" id="speedValue">1.00×</span>
</div>
</div>
</div>
<div class="control-row">
<div style="flex:1">
<div class="control-label">Camera</div>
<div class="views">
<button type="button" data-view="cutaway">Cutaway</button>
<button type="button" data-view="oars">Oars</button>
<button type="button" data-view="plan">Plan</button>
</div>
</div>
<button type="button" id="resetButton" title="Reset camera">Reset</button>
</div>
<label class="toggle">
<input id="overlayToggle" type="checkbox" checked>
Show disputed reconstruction overlay
</label>
<button class="notes-toggle" id="notesButton" type="button">References & choices</button>
</section>
<aside class="ledger" aria-label="References and reconstruction ledger">
<h2>References & reconstruction ledger</h2>
<p>
Teal elements provide a referenced structural frame or a transparent design
constraint. Amber elements identify choices that cannot be treated as a
settled ancient reconstruction.
</p>
<h3>Reference basis</h3>
<div class="ledger-item">
<span class="ref">R1</span>
<span>
<strong>Literary baseline.</strong> Homer, <em>Iliad</em> 2.484–556 and
<em>Odyssey</em> 2.383–388. These works establish early Greek ships,
seamanship and rowing, but do not supply a dimensioned trireme plan.
</span>
</div>
<div class="ledger-item">
<span class="ref">R2</span>
<span>
<strong>Visual baseline.</strong> Ancient Greek depictions of oared
warships, especially Attic vase painting and 5th–4th c. BCE naval coin
types in museum catalogues such as the British Museum and Ashmolean.
Images support the broad three-bank silhouette but are stylized.
</span>
</div>
<div class="ledger-item">
<span class="ref">R3</span>
<span>
<strong>Construction analogy.</strong> The 4th-century BCE Kyrenia ship
remains, studied by the University of Cyprus, demonstrate plank-and-frame
construction. The Kyrenia ship was not a trireme and is not used as a
direct trireme template.
</span>
</div>
<h3>Disputed / interpretive choices</h3>
<div class="ledger-item">
<span class="choice-id">I1</span>
<span>
<strong>Bank spacing and offsets.</strong> Three separated teaching
positions are used to make the internal arrangement legible.
</span>
</div>
<div class="ledger-item">
<span class="choice-id">I2</span>
<span>
<strong>Oar port and thole.</strong> A generic pin-and-rest assembly
is shown. The exact ancient mechanism is uncertain.
</span>
</div>
<div class="ledger-item">
<span class="choice-id">I3</span>
<span>
<strong>Oar sweep.</strong> The 17° limit is an animation and
clearance choice, not a measured reconstruction.
</span>
</div>
<div class="ledger-item">
<span class="choice-id">I4</span>
<span>
<strong>Hull envelope.</strong> Skin curvature, sheer and deck lines
are schematic, emphasizing frames and rowing levels.
</span>
</div>
<h3>Clearance constraint</h3>
<div class="ledger-item">
<span class="choice-id" style="color:var(--cyan);background:var(--cyan-soft);border-color:rgba(117,216,207,.3)">D1</span>
<span>
All three oars share one phase. Their blade planes remain vertically
separated by at least <strong>0.69 schematic units</strong> in this
demonstration.
</span>
</div>
<div class="ledger-note">
<p>
<strong>Interpretive status:</strong> conventional names
<em>thalamites</em>, <em>zygites</em> and <em>thranites</em> identify
lower, middle and upper rowing tiers in modern reconstructions. The
animation is a comparative mechanism study, not a claim of documentary
accuracy.
</p>
</div>
</aside>
<div class="legend" aria-label="Legend">
<div class="legend-item"><span class="swatch"></span>Referenced / contextual geometry</div>
<div class="legend-item"><span class="swatch amber"></span>Disputed reconstruction choice</div>
<div class="legend-item"><span class="swatch dashed"></span>Oar sweep / clearance guide</div>
<div class="legend-item"><span class="swatch ivory"></span>Representative rower</div>
</div>
<div class="status" aria-live="polite">
<div class="status-top">
<span><span id="phaseText">Drive</span> · <span id="syncText">3 / 3 synced</span></span>
<span id="angleText">−17.0°</span>
</div>
<div class="phase-track"><span id="phaseDot"></span></div>
<div class="status-top" style="margin-top:7px;color:var(--muted);font-size:8px">
<span>Representative port-side banks</span>
<span id="clearanceText">Clearance held · 0.69 u</span>
</div>
</div>
<div class="hint">Drag to orbit · wheel to zoom · shift-drag to pan</div>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
/* --------------------------------------------------------------------------
Constants and state
-------------------------------------------------------------------------- */
const canvas = document.querySelector("#scene");
const labelsLayer = document.querySelector("#labels");
const MAX_OAR_ANGLE = THREE.MathUtils.degToRad(17);
const DRIVE_FRACTION = 0.42;
const CYCLE_SECONDS = 4.8;
const BLADE_THICKNESS = 0.12;
const rows = [
{
name: "THALAMITES",
tier: "LOWER BANK",
z: 0.68,
x: 0.55
},
{
name: "ZYGITES",
tier: "MIDDLE BANK",
z: 1.49,
x: -0.50
},
{
name: "THRANITES",
tier: "UPPER BANK",
z: 2.30,
x: 0.90
}
];
const tierGap = rows[2].z - rows[1].z;
const minimumClearance = tierGap - BLADE_THICKNESS;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x071216);
scene.fog = new THREE.Fog(0x071216, 16, 34);
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight, false);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
80
);
camera.up.set(0, 0, 1);
const orbit = {
target: new THREE.Vector3(0, -1.15, 1.55),
desiredTarget: new THREE.Vector3(0, -1.15, 1.55),
azimuth: -1.02,
desiredAzimuth: -1.02,
elevation: 0.43,
desiredElevation: 0.43,
radius: 13.3,
desiredRadius: 13.3
};
const disputedGroup = new THREE.Group();
scene.add(disputedGroup);
const animated = {
elapsed: 0,
speed: 1,
playing: true,
phase: 0,
angle: -MAX_OAR_ANGLE
};
/* --------------------------------------------------------------------------
Materials and geometry helpers
-------------------------------------------------------------------------- */
const materials = {
hull: new THREE.MeshStandardMaterial({
color: 0xc57b3b,
transparent: true,
opacity: 0.085,
roughness: 0.9,
metalness: 0.02,
side: THREE.DoubleSide,
depthWrite: false
}),
rib: new THREE.MeshStandardMaterial({
color: 0x5ea69f,
roughness: 0.66,
metalness: 0.08
}),
ribDark: new THREE.MeshStandardMaterial({
color: 0x27555a,
roughness: 0.75,
metalness: 0.03
}),
deck: new THREE.MeshStandardMaterial({
color: 0x21464c,
roughness: 0.86,
metalness: 0.04
}),
deckEdge: new THREE.MeshStandardMaterial({
color: 0x79b9b1,
roughness: 0.55,
metalness: 0.08
}),
wood: new THREE.MeshStandardMaterial({
color: 0xb77d43,
roughness: 0.68,
metalness: 0.02
}),
woodDark: new THREE.MeshStandardMaterial({
color: 0x684126,
roughness: 0.84,
metalness: 0.01
}),
ivory: new THREE.MeshStandardMaterial({
color: 0xe4d2aa,
roughness: 0.82,
metalness: 0.0
}),
bronze: new THREE.MeshStandardMaterial({
color: 0xd19b51,
roughness: 0.38,
metalness: 0.65
}),
amber: new THREE.MeshStandardMaterial({
color: 0xffa84f,
roughness: 0.58,
metalness: 0.08
}),
amberDark: new THREE.MeshStandardMaterial({
color: 0x814719,
roughness: 0.85,
metalness: 0.02
})
};
const lineMaterials = {
teal: new THREE.LineBasicMaterial({
color: 0x75d8cf,
transparent: true,
opacity: 0.28
}),
amber: new THREE.LineDashedMaterial({
color: 0xffad5c,
transparent: true,
opacity: 0.76,
dashSize: 0.12,
gapSize: 0.09
}),
amberSolid: new THREE.LineBasicMaterial({
color: 0xffad5c,
transparent: true,
opacity: 0.56
})
};
const Y_AXIS = new THREE.Vector3(0, 1, 0);
function addMesh(geometry, material, position, parent = scene) {
const mesh = new THREE.Mesh(geometry, material);
if (position) mesh.position.copy(position);
mesh.castShadow = !material.transparent;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addBox(size, position, material, parent = scene) {
return addMesh(
new THREE.BoxGeometry(size.x, size.y, size.z),
material,
position,
parent
);
}
function setSegment(mesh, a, b) {
const direction = new THREE.Vector3().subVectors(b, a);
const length = direction.length();
mesh.position.copy(a).add(b).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(Y_AXIS, direction.normalize());
mesh.scale.set(1, length, 1);
}
function cylinderBetween(a, b, radius, material, parent = scene, radialSegments = 8) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(radius, radius, 1, radialSegments),
material
);
setSegment(mesh, a, b);
mesh.castShadow = !material.transparent;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addLine(points, material, parent = scene, closed = false) {
const list = closed ? [...points, points[0]] : points;
const geometry = new THREE.BufferGeometry().setFromPoints(list);
const line = new THREE.Line(geometry, material);
if (material.isLineDashedMaterial) line.computeLineDistances();
parent.add(line);
return line;
}
function addBoxEdges(size, position, material, parent = scene) {
const edges = new THREE.EdgesGeometry(new THREE.BoxGeometry(size.x, size.y, size.z));
const lines = new THREE.LineSegments(edges, material);
lines.position.copy(position);
parent.add(lines);
return lines;
}
/* --------------------------------------------------------------------------
Lighting and ground
-------------------------------------------------------------------------- */
scene.add(new THREE.HemisphereLight(0xb7d8d6, 0x0b171c, 1.6));
const keyLight = new THREE.DirectionalLight(0xffedcf, 3.2);
keyLight.position.set(4, -7, 10);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -10;
keyLight.shadow.camera.right = 10;
keyLight.shadow.camera.top = 10;
keyLight.shadow.camera.bottom = -10;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 30;
keyLight.shadow.normalBias = 0.03;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x55bdb8, 2.4);
rimLight.position.set(-7, 5, 5);
scene.add(rimLight);
const fillLight = new THREE.DirectionalLight(0x8db7c8, 1.1);
fillLight.position.set(3, 7, 2);
scene.add(fillLight);
const grid = new THREE.GridHelper(26, 26, 0x315c62, 0x153039);
grid.rotation.x = Math.PI / 2;
grid.position.z = -0.055;
grid.material.transparent = true;
grid.material.opacity = 0.42;
scene.add(grid);
/* --------------------------------------------------------------------------
Trireme hull: schematic section and frame
-------------------------------------------------------------------------- */
const hullLength = 7.4;
const hullHalfLength = hullLength / 2;
const stations = [
{ x: -3.70, factor: 0.52 },
{ x: -3.20, factor: 0.73 },
{ x: -2.40, factor: 0.91 },
{ x: -1.25, factor: 1.00 },
{ x: 0.00, factor: 1.04 },
{ x: 1.25, factor: 1.00 },
{ x: 2.40, factor: 0.91 },
{ x: 3.20, factor: 0.73 },
{ x: 3.70, factor: 0.52 }
];
const section = [
new THREE.Vector2(0.00, 0.08),
new THREE.Vector2(0.34, 0.18),
new THREE.Vector2(0.74, 0.48),
new THREE.Vector2(1.09, 0.98),
new THREE.Vector2(1.36, 1.65),
new THREE.Vector2(1.50, 2.35),
new THREE.Vector2(1.46, 2.90)
];
function sheerAt(x) {
return 0.20 * Math.pow(Math.abs(x) / hullHalfLength, 2);
}
function makeHullSkin(side) {
const positions = [];
const indices = [];
for (const station of stations) {
for (const point of section) {
positions.push(
station.x,
side * point.x * station.factor,
point.y + sheerAt(station.x)
);
}
}
for (let s = 0; s < stations.length - 1; s++) {
for (let p = 0; p < section.length - 1; p++) {
const a = s * section.length + p;
const b = a + section.length;
const c = b + 1;
const d = a + 1;
if (side > 0) {
indices.push(a, b, d, b, c, d);
} else {
indices.push(a, d, b, b, d, c);
}
}
}
const geometry = new THREE.BufferGeometry();
geometry.setAttribute("position", new THREE.Float32BufferAttribute(positions, 3));
geometry.setIndex(indices);
geometry.computeVertexNormals();
const skin = addMesh(geometry, materials.hull, null, disputedGroup);
skin.renderOrder = 1;
return skin;
}
makeHullSkin(-1);
makeHullSkin(1);
addBox(
new THREE.Vector3(hullLength + 0.12, 0.18, 0.18),
new THREE.Vector3(0, 0, 0.08),
materials.woodDark
);
const ribStations = [-3.52, -2.60, -1.78, -1.16, 0.05, 1.70, 2.52, 3.52];
for (const side of [-1, 1]) {
for (const x of ribStations) {
const factor = 0.54 + 0.46 * Math.sin(Math.PI * (x + hullHalfLength) / hullLength);
const points = section.map(p =>
new THREE.Vector3(
x,
side * p.x * factor,
p.y + sheerAt(x)
)
);
const curve = new THREE.CatmullRomCurve3(points);
const rib = addMesh(
new THREE.TubeGeometry(curve, 28, 0.042, 6, false),
materials.rib
);
rib.castShadow = true;
}
}
for (const side of [-1, 1]) {
for (const sectionIndex of [2, 4, 5]) {
const points = stations.map(station => {
const p = section[sectionIndex];
return new THREE.Vector3(
station.x,
side * p.x * station.factor,
p.y + sheerAt(station.x)
);
});
const curve = new THREE.CatmullRomCurve3(points);
addMesh(
new THREE.TubeGeometry(curve, 48, 0.038, 6, false),
materials.deckEdge
);
}
}
// A partial upper deck leaves the port rowing spaces open.
addBox(
new THREE.Vector3(6.45, 0.82, 0.075),
new THREE.Vector3(0, 0.91, 2.82),
materials.deck
);
addBox(
new THREE.Vector3(6.45, 0.045, 0.10),
new THREE.Vector3(0, 0.49, 2.86),
materials.deckEdge
);
// End posts make the object read as a midship cutaway segment.
for (const x of [-3.67, 3.67]) {
const factor = 0.53;
cylinderBetween(
new THREE.Vector3(x, -0.72 * factor, 0.16),
new THREE.Vector3(x, -1.38 * factor, 2.82),
0.052,
materials.woodDark
);
cylinderBetween(
new THREE.Vector3(x, 0.72 * factor, 0.16),
new THREE.Vector3(x, 1.38 * factor, 2.82),
0.052,
materials.woodDark
);
}
/* --------------------------------------------------------------------------
Rowing levels, rowers, oars, and clearance guides
-------------------------------------------------------------------------- */
const rowObjects = [];
for (let index = 0; index < rows.length; index++) {
const row = rows[index];
// Thin cyan rectangles identify the three separated working levels.
const levelOutline = [
new THREE.Vector3(-3.32, -1.35, row.z),
new THREE.Vector3( 3.32, -1.35, row.z),
new THREE.Vector3( 3.32, 1.35, row.z),
new THREE.Vector3(-3.32, 1.35, row.z)
];
addLine(levelOutline, lineMaterials.teal, scene, true);
// Bench and supports.
addBox(
new THREE.Vector3(0.82, 0.28, 0.12),
new THREE.Vector3(row.x, -0.22, row.z + 0.04),
materials.wood
);
for (const dx of [-0.29, 0.29]) {
cylinderBetween(
new THREE.Vector3(row.x + dx, -0.20, row.z - 0.02),
new THREE.Vector3(row.x + dx, -0.20, row.z - 0.43),
0.035,
materials.woodDark
);
}
// Voxel rower, facing outboard.
const body = new THREE.Group();
body.position.set(row.x, -0.35, row.z);
scene.add(body);
addBox(
new THREE.Vector3(0.34, 0.27, 0.47),
new THREE.Vector3(0, 0, 0.42),
materials.ivory,
body
);
addBox(
new THREE.Vector3(0.34, 0.27, 0.18),
new THREE.Vector3(0, 0.015, 0.09),
materials.ivory,
body
);
addBox(
new THREE.Vector3(0.24, 0.23, 0.25),
new THREE.Vector3(0, -0.035, 0.82),
materials.ivory,
body
);
addBox(
new THREE.Vector3(0.075, 0.075, 0.075),
new THREE.Vector3(0, -0.17, 0.81),
materials.woodDark,
body
);
for (const side of [-1, 1]) {
cylinderBetween(
new THREE.Vector3(side * 0.10, 0.03, 0.12),
new THREE.Vector3(side * 0.12, -0.43, 0.10),
0.052,
materials.ivory,
body
);
addBox(
new THREE.Vector3(0.13, 0.22, 0.09),
new THREE.Vector3(side * 0.12, -0.47, 0.08),
materials.woodDark,
body
);
}
const oarPivot = new THREE.Vector3(row.x, -1.51, row.z);
// Amber support and generic thole/pivot mechanism: explicitly interpretive.
const hullSideY = index === 0 ? -0.80 : index === 1 ? -1.18 : -1.36;
cylinderBetween(
new THREE.Vector3(row.x, hullSideY, row.z),
oarPivot.clone(),
0.036,
materials.amberDark,
disputedGroup
);
const pivotBlock = addBox(
new THREE.Vector3(0.22, 0.15, 0.18),
oarPivot,
materials.amber,
disputedGroup
);
pivotBlock.rotation.z = 0.08;
const thole = new THREE.Mesh(
new THREE.CylinderGeometry(0.055, 0.055, 0.30, 10),
materials.bronze
);
thole.rotation.x = Math.PI / 2;
thole.position.copy(oarPivot);
thole.castShadow = true;
disputedGroup.add(thole);
// Oar assembly rotates around the local Z axis.
const oar = new THREE.Group();
oar.position.copy(oarPivot);
scene.add(oar);
const shaft = new THREE.Mesh(
new THREE.CylinderGeometry(0.041, 0.056, 3.76, 10),
materials.wood
);
shaft.position.y = -1.89;
shaft.castShadow = true;
oar.add(shaft);
const blade = addBox(
new THREE.Vector3(0.34, 0.74, BLADE_THICKNESS),
new THREE.Vector3(0, -4.00, 0),
materials.woodDark,
oar
);
blade.castShadow = true;
for (const y of [-3.76, -4.00, -4.24]) {
addBox(
new THREE.Vector3(0.355, 0.026, BLADE_THICKNESS + 0.018),
new THREE.Vector3(0, y, 0),
materials.wood,
oar
);
}
const grip = new THREE.Mesh(
new THREE.CylinderGeometry(0.057, 0.066, 0.86, 10),
materials.wood
);
grip.position.y = 0.79;
grip.castShadow = true;
oar.add(grip);
// Visible inboard hand-grip cap.
const cap = new THREE.Mesh(
new THREE.SphereGeometry(0.074, 10, 7),
materials.bronze
);
cap.position.y = 1.23;
oar.add(cap);
// Dashed sweep arc: a marked animation choice, not evidence.
const arcPoints = [];
for (let step = 0; step <= 48; step++) {
const angle = THREE.MathUtils.lerp(-MAX_OAR_ANGLE, MAX_OAR_ANGLE, step / 48);
arcPoints.push(
new THREE.Vector3(
oarPivot.x - Math.sin(angle) * 4.18,
oarPivot.y - Math.cos(angle) * 4.18,
oarPivot.z
)
);
}
addLine(arcPoints, lineMaterials.amber, disputedGroup);
// Arms are redrawn each frame so they remain attached to the moving handle.
const armLeft = cylinderBetween(
new THREE.Vector3(row.x - 0.14, -0.39, row.z + 0.62),
new THREE.Vector3(row.x - 0.08, -0.64, row.z),
0.047,
materials.ivory
);
const armRight = cylinderBetween(
new THREE.Vector3(row.x + 0.14, -0.39, row.z + 0.62),
new THREE.Vector3(row.x + 0.08, -0.64, row.z),
0.047,
materials.ivory
);
const handLeft = addBox(
new THREE.Vector3(0.09, 0.09, 0.09),
new THREE.Vector3(),
materials.ivory
);
const handRight = addBox(
new THREE.Vector3(0.09, 0.09, 0.09),
new THREE.Vector3(),
materials.ivory
);
rowObjects.push({
row,
body,
oar,
oarPivot,
armLeft,
armRight,
handLeft,
handRight
});
}
// Vertical clearance brackets at the outboard side.
const clearanceGroup = new THREE.Group();
scene.add(clearanceGroup);
const clearanceMaterial = new THREE.LineDashedMaterial({
color: 0x75d8cf,
transparent: true,
opacity: 0.72,
dashSize: 0.10,
gapSize: 0.07
});
for (let i = 0; i < rows.length - 1; i++) {
const low = rows[i].z;
const high = rows[i + 1].z;
const x = 2.15;
const y = -4.72;
const vertical = [
new THREE.Vector3(x, y, low),
new THREE.Vector3(x, y, high)
];
addLine(vertical, clearanceMaterial, clearanceGroup);
for (const z of [low, high]) {
addLine(
[
new THREE.Vector3(x - 0.13, y, z),
new THREE.Vector3(x + 0.13, y, z)
],
clearanceMaterial,
clearanceGroup
);
}
}
/* --------------------------------------------------------------------------
Projected scene labels
-------------------------------------------------------------------------- */
const projectedLabels = [];
function addSceneLabel(text, subtext, className, position, offset = [0, 0], disputed = false) {
const element = document.createElement("div");
element.className = `scene-tag ${className}`;
element.innerHTML = subtext
? `${text}<small>${subtext}</small>`
: text;
if (disputed) {
element.dataset.disputed = "true";
element.classList.add("hidden-disputed");
}
labelsLayer.appendChild(element);
projectedLabels.push({ element, position: position.clone(), offset });
return element;
}
for (const row of rows) {
addSceneLabel(
`[R1·R2] ${row.name}`,
row.tier,
"bank",
new THREE.Vector3(row.x, -0.54, row.z + 0.72),
[75, -8]
);
}
addSceneLabel(
"[I2] PIVOT / THOLE",
"interpretive form",
"disputed",
new THREE.Vector3(rows[2].x, -1.51, rows[2].z),
[98, -36],
true
);
addSceneLabel(
"[I1] BANK OFFSETS",
"separated for clarity",
"disputed",
new THREE.Vector3(1.85, -1.42, 1.10),
[104, -2],
true
);
addSceneLabel(
"[I3] SWEEP LIMIT",
"17° · safety choice",
"disputed",
new THREE.Vector3(-1.08, -4.15, 1.49),
[-82, -8],
true
);
addSceneLabel(
"[I4] HULL ENVELOPE",
"schematic skin",
"disputed",
new THREE.Vector3(2.65, 0.75, 2.25),
[86, -12],
true
);
addSceneLabel(
"[D1] CLEARANCE",
`${minimumClearance.toFixed(2)} u minimum`,
"design",
new THREE.Vector3(2.15, -4.72, 1.08),
[86, 12]
);
function updateProjectedLabels() {
const width = window.innerWidth;
const height = window.innerHeight;
for (const item of projectedLabels) {
const projected = item.position.clone().project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
projected.x > -1.15 &&
projected.x < 1.15 &&
projected.y > -1.15 &&
projected.y < 1.15;
item.element.classList.toggle("visible", visible);
if (visible) {
item.element.style.left = `${(projected.x * 0.5 + 0.5) * width + item.offset[0]}px`;
item.element.style.top = `${(-projected.y * 0.5 + 0.5) * height + item.offset[1]}px`;
}
}
}
/* --------------------------------------------------------------------------
Animation
-------------------------------------------------------------------------- */
function smooth01(t) {
t = THREE.MathUtils.clamp(t, 0, 1);
return t * t * (3 - 2 * t);
}
function updateStroke() {
const phase = (animated.elapsed % CYCLE_SECONDS) / CYCLE_SECONDS;
animated.phase = phase;
let angle;
let phaseName;
if (phase < DRIVE_FRACTION) {
const t = smooth01(phase / DRIVE_FRACTION);
angle = THREE.MathUtils.lerp(-MAX_OAR_ANGLE, MAX_OAR_ANGLE, t);
phaseName = phase < 0.035 ? "Catch" : "Drive";
} else {
const t = smooth01((phase - DRIVE_FRACTION) / (1 - DRIVE_FRACTION));
angle = THREE.MathUtils.lerp(MAX_OAR_ANGLE, -MAX_OAR_ANGLE, t);
phaseName = phase > 0.96 ? "Catch" : "Recovery";
}
animated.angle = angle;
for (const object of rowObjects) {
object.oar.rotation.z = angle;
// Slight body follow gives the synchronized stroke a readable rhythm.
const normalized = angle / MAX_OAR_ANGLE;
object.body.position.y = -0.35 + normalized * 0.045;
object.body.rotation.z = normalized * 0.025;
const handleLocal = new THREE.Vector3(0, 0.91, 0);
const handle = handleLocal
.applyAxisAngle(new THREE.Vector3(0, 0, 1), angle)
.add(object.oarPivot);
const leftHand = handle.clone().add(new THREE.Vector3(-0.065, 0, 0));
const rightHand = handle.clone().add(new THREE.Vector3(0.065, 0, 0));
const leftShoulder = new THREE.Vector3(
object.row.x - 0.14,
-0.39,
object.row.z + 0.62
);
const rightShoulder = new THREE.Vector3(
object.row.x + 0.14,
-0.39,
object.row.z + 0.62
);
setSegment(object.armLeft, leftShoulder, leftHand);
setSegment(object.armRight, rightShoulder, rightHand);
object.handLeft.position.copy(leftHand);
object.handRight.position.copy(rightHand);
}
document.querySelector("#phaseText").textContent = phaseName;
document.querySelector("#phaseDot").style.left = `${phase * 100}%`;
document.querySelector("#angleText").textContent =
`${angle >= 0 ? "+" : "−"}${Math.abs(THREE.MathUtils.radToDeg(angle)).toFixed(1)}°`;
}
/* --------------------------------------------------------------------------
Custom camera controls — no external controls addon
-------------------------------------------------------------------------- */
const views = {
cutaway: {
target: new THREE.Vector3(0, -1.15, 1.55),
azimuth: -1.02,
elevation: 0.43,
radius: 13.3
},
oars: {
target: new THREE.Vector3(-0.05, -2.65, 1.48),
azimuth: -1.30,
elevation: 0.18,
radius: 8.6
},
plan: {
target: new THREE.Vector3(0, -1.45, 1.48),
azimuth: -1.57,
elevation: 1.22,
radius: 11.2
}
};
function setView(name) {
const view = views[name];
if (!view) return;
orbit.desiredTarget.copy(view.target);
orbit.desiredAzimuth = view.azimuth;
orbit.desiredElevation = view.elevation;
orbit.desiredRadius = view.radius;
}
function panCamera(dx, dy) {
const scale = orbit.radius * 0.0016;
const right = new THREE.Vector3(1, 0, 0).applyQuaternion(camera.quaternion);
const up = new THREE.Vector3(0, 1, 0).applyQuaternion(camera.quaternion);
orbit.desiredTarget
.addScaledVector(right, -dx * scale)
.addScaledVector(up, dy * scale);
}
let dragging = false;
let dragPointerId = null;
let lastX = 0;
let lastY = 0;
let dragDistance = 0;
canvas.addEventListener("contextmenu", event => event.preventDefault());
canvas.addEventListener("pointerdown", event => {
dragging = true;
dragPointerId = event.pointerId;
lastX = event.clientX;
lastY = event.clientY;
dragDistance = 0;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", event => {
if (!dragging || event.pointerId !== dragPointerId) return;
const dx = event.clientX - lastX;
const dy = event.clientY - lastY;
lastX = event.clientX;
lastY = event.clientY;
dragDistance += Math.abs(dx) + Math.abs(dy);
if (event.shiftKey || event.buttons === 2) {
panCamera(dx, dy);
} else {
orbit.desiredAzimuth -= dx * 0.006;
orbit.desiredElevation = THREE.MathUtils.clamp(
orbit.desiredElevation + dy * 0.005,
0.06,
1.35
);
}
});
function endDrag(event) {
if (event.pointerId !== dragPointerId) return;
dragging = false;
dragPointerId = null;
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener("wheel", event => {
event.preventDefault();
orbit.desiredRadius = THREE.MathUtils.clamp(
orbit.desiredRadius * Math.exp(event.deltaY * 0.001),
5.2,
23
);
}, { passive: false });
canvas.addEventListener("dblclick", () => setView("cutaway"));
function updateCamera() {
const damping = 0.12;
orbit.azimuth += (orbit.desiredAzimuth - orbit.azimuth) * damping;
orbit.elevation += (orbit.desiredElevation - orbit.elevation) * damping;
orbit.radius += (orbit.desiredRadius - orbit.radius) * damping;
orbit.target.lerp(orbit.desiredTarget, damping);
camera.position.set(
orbit.target.x + orbit.radius * Math.cos(orbit.elevation) * Math.cos(orbit.azimuth),
orbit.target.y + orbit.radius * Math.cos(orbit.elevation) * Math.sin(orbit.azimuth),
orbit.target.z + orbit.radius * Math.sin(orbit.elevation)
);
camera.lookAt(orbit.target);
camera.updateMatrixWorld();
}
/* --------------------------------------------------------------------------
UI
-------------------------------------------------------------------------- */
const playButton = document.querySelector("#playButton");
const speedInput = document.querySelector("#speed");
const speedValue = document.querySelector("#speedValue");
const overlayToggle = document.querySelector("#overlayToggle");
playButton.addEventListener("click", () => {
animated.playing = !animated.playing;
playButton.textContent = animated.playing ? "Pause" : "Play";
playButton.setAttribute("aria-pressed", String(!animated.playing));
});
speedInput.addEventListener("input", () => {
animated.speed = Number(speedInput.value);
speedValue.textContent = `${animated.speed.toFixed(2)}×`;
});
overlayToggle.addEventListener("change", () => {
disputedGroup.visible = overlayToggle.checked;
for (const label of projectedLabels) {
if (label.element.dataset.disputed === "true") {
label.element.classList.toggle("hidden-disputed", !overlayToggle.checked);
}
}
});
document.querySelectorAll("[data-view]").forEach(button => {
button.addEventListener("click", () => setView(button.dataset.view));
});
document.querySelector("#resetButton").addEventListener("click", () => setView("cutaway"));
document.querySelector("#notesButton").addEventListener("click", () => {
document.body.classList.toggle("notes-open");
});
/* --------------------------------------------------------------------------
Resize and render loop
-------------------------------------------------------------------------- */
function resize() {
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight, false);
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
}
window.addEventListener("resize", resize);
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
if (animated.playing) {
animated.elapsed += delta * animated.speed;
}
updateCamera();
updateStroke();
scene.updateMatrixWorld(true);
updateProjectedLabels();
renderer.render(scene, camera);
}
updateStroke();
updateCamera();
animate();
</script>
</body>
</html>
```