Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/validate-calculations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '24'

- name: Run validation tests
run: node tests/validate-arena-calculations.js
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Arena radius formula: `cRadius = panelWidth / (tan(alpha/2)) / 2` where `alpha =
## Arena 3D Viewer (`arena_3d_viewer.html`)

### Key Implementation Details
- Uses Three.js r128 with OrbitControls
- Uses Three.js r182 with OrbitControls (ES6 modules)
- Renderer requires `preserveDrawingBuffer: true` for screenshot functionality
- LED meshes stored in `ledMeshes[]` array for efficient animation (color-only updates)
- Pattern rotation uses `state.phaseOffset` to shift pattern, not world rotation
Expand Down
33 changes: 24 additions & 9 deletions arena_3d_viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Arena 3D Viewer - PanelDisplayTools</title>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=IBM+Plex+Mono:wght@400;600&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"></script>
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.182.0/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.182.0/examples/jsm/"
}
}
</script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }

Expand Down Expand Up @@ -583,7 +589,10 @@ <h3>View Controls</h3>
<strong>Controls:</strong> Drag to rotate | Scroll to zoom | Right-drag to pan
</div>

<script>
<script type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';

// Panel specifications (same as arena_editor.html)
const PANEL_SPECS = {
'G3': {
Expand Down Expand Up @@ -705,12 +714,13 @@ <h3>View Controls</h3>

// Renderer (preserveDrawingBuffer needed for screenshots)
renderer = new THREE.WebGLRenderer({ antialias: true, preserveDrawingBuffer: true });

renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(window.devicePixelRatio);
container.appendChild(renderer.domElement);

// Controls
controls = new THREE.OrbitControls(camera, renderer.domElement);
controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.05;
controls.minDistance = 0.1; // Allow getting close to center for fly view
Expand Down Expand Up @@ -1325,7 +1335,7 @@ <h3>View Controls</h3>
-halfW, halfH, borderZ,
-halfW, -halfH, borderZ
]);
borderGeom.setAttribute('position', new THREE.BufferAttribute(borderVertices, 3));
borderGeom.setAttribute('position', new THREE.Float32BufferAttribute(borderVertices, 3));
const border = new THREE.LineSegments(borderGeom, borderMat);
group.add(border);

Expand All @@ -1339,7 +1349,7 @@ <h3>View Controls</h3>
-halfW, lineY, borderZ,
halfW, lineY, borderZ
]);
lineGeom.setAttribute('position', new THREE.BufferAttribute(lineVerts, 3));
lineGeom.setAttribute('position', new THREE.Float32BufferAttribute(lineVerts, 3));
const line = new THREE.Line(lineGeom, borderMat);
group.add(line);
}
Expand Down Expand Up @@ -1438,7 +1448,7 @@ <h3>View Controls</h3>
c4x, c4y, 0,
c1x, c1y, 0
]);
outlineGeom.setAttribute('position', new THREE.BufferAttribute(outlineVerts, 3));
outlineGeom.setAttribute('position', new THREE.Float32BufferAttribute(outlineVerts, 3));
const outlineMat = new THREE.LineBasicMaterial({ color: 0x333333 });
const outline = new THREE.LineSegments(outlineGeom, outlineMat);
outline.position.set(localX, localY, localZ + 0.0001);
Expand Down Expand Up @@ -1484,6 +1494,7 @@ <h3>View Controls</h3>

return group;
}


// Update all LED colors without rebuilding geometry (efficient animation)
function updateLEDColors() {
Expand Down Expand Up @@ -1561,8 +1572,12 @@ <h3>View Controls</h3>
renderer.render(scene, camera);
}

// Start
init();
// Start - Initialize when module loads
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
</script>
</body>
</html>