Repository navigation
CodeX simulator: upright, a blurred garden, and rotation, light and buttons overlays - #167
Open
david-firia wants to merge 5 commits into
Open
david-firia wants to merge 5 commits into
david-firia wants to merge 5 commits into
Conversation
- CodeX starts upright, face to the camera (its Z along the room's Y, which the camera looks into); the world's default pose changes with it, so the accelerometer reads +1 g on y. - The garden backdrop is blurred when it is built (sim/tools/showroom-sky.mjs, wrapped at its seam), not in the browser: Three's background blur froze a software-rendered page for about 50 seconds. - Three toggles in the bar show overlays over the view: rotation (a slider and an editable angle to tenths per axis, -180 to 180, from upright, with Upright; the keys keep it in step), ambient light (the sensor's lux, and the scene's lights, reflections and sky scaled to match), and the buttons pad (with a note on the arrow keys and A and B). They replace the bar's light slider and keys and the rotation widget. - The screen-only button has a display icon. - The board's axes start at the accelerometer chip's centre and show only with the rotation overlay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Visit the preview URL for this PR (updated for commit a125ebe): https://firialabs-open-editor--pr167-codex-sim-overlays-1wk0gkcj.web.app (expires Thu, 10 Dec 2026 17:24:13 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 81259a1fec315ca1af3747d225d9c7424890be3e |
The glow was a Three.js sprite, a flat disc that always turns to face the camera, set just above each light and depth-tested against the board. The board's face cut that disc along a straight line that turned with the camera, and from the side the disc stood across the board, half of it behind the face, showing past the thin board edge. Each glow is now a closed half-sphere on its light, facing out along the light's normal, drawn from inside so every line of sight through it counts once. Its strength comes from how near the line of sight passes the light's centre on the side it shines to, fading to nothing at the dome's edge, so no edge or seam shows from any angle; seen from behind the board's face it fades out. Every board's LEDs and NeoPixels use it. tests/sim-ui.mjs draws CodeX's NeoPixels lit and unlit from the front, at an angle, from the side and from behind, and checks for a soft glow in front, no hard edge in it, and none behind the board. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Added: LED glow fixed to each light. The glow was a camera-facing sprite that the board's face cut along a line turning with the camera, and that showed behind the board from the side. It is now a half-sphere on each light, facing out of the board, with a soft edge and nothing behind the board (every board's LEDs and NeoPixels). tests/sim-ui.mjs checks it from the front, at an angle, from the side and from behind; the side and back checks fail on the old glow. |
One check, glowCheck, now covers every light on each board: CodeBot's 8 user LEDs, 5 line sensor LEDs, 2 proximity LEDs and power LED; CodeX's LEDs 0 to 3, A and B and its 4 NeoPixels; CodeAIR's 8 BYTE LEDs, STA and its 8 NeoPixels above and under the arms. Each light is lit alone and seen from the front, at an angle, from the side and from behind, lit and unlit with the figure held still, and its lit views are saved under tests/screenshots/glow/. It replaces the CodeX NeoPixel check. On the camera-facing sprites it replaced, 40 of the 43 lights fail, each with glow behind the board. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SS5gJ4K8DovHG7azgcmknk
The first version took about 12 seconds a light, as each of its eight page screenshots per light went through the browser's compositor, and the test jobs ran out of time. Now each view is drawn once into the square round the light and read straight from the canvas, at one pixel per page pixel: about 3 minutes for all 43 lights. What is measured is the glow drawn alone over black, the board and its parts hiding it but not drawn, so the colour behind it no longer counts. A hard line is counted only in the glow itself: not where a part in front hides it, nor along the board's face where it ends. The room is hidden and the board lifted off the floor, so no wall or floor comes between the camera and a light, and a light under CodeAIR is seen from below. The check runs once, on the JSPI pass: drawing is the same on the fallback VM. On the camera-facing sprites, 41 of the 43 lights still fail, each with glow behind the board. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SS5gJ4K8DovHG7azgcmknk
# Conflicts: # CHANGELOG.md # src/sim/sim-panel.js # src/sim/sim.css
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The simulated CodeX now stands upright with its screen toward the camera, in front of a blurred garden, and its controls sit in overlays you show or hide from three buttons under the view.
Pose. CodeX starts upright: its Z axis (out of the face) is along the room's Y axis, and the camera looks into Y, so the screen faces the student. The world starts the board in the same pose, so a program's
accel.read()reads about (0, 16384, 0). The camera starts in front of the face, a little above it.Background. The Sumo Garden panorama is blurred as it is built (
sim/tools/showroom-sky.mjs, wrapped at its seam so no line shows), and served at half the width (about 100 KB instead of 1.6 MB). It is not blurred in the browser: Three's background blur builds its maps on the GPU and froze a software-rendered page for about 50 seconds. A Chromebook with its GPU turned off renders that way.Overlays. Three toggles in the bar, each showing or hiding an overlay along the foot of the view (they wrap upward on a narrow view):
These replace the bar's light slider, its six keys and the old rotation widget.
Display icon. The screen-only button now shows a monitor, not a full-screen icon.
Axes. CodeX's own X, Y and Z arrows now start at the centre of its accelerometer chip (the model's Accelerometer part) and show only while the rotation overlay is open.
Tests.
tests/sim.mjs: a new CodeX reads upright.tests/sim-ui.mjs: the rotation overlay (axes shown with it and placed on the chip, typed angles and slider, readings, Upright, the keys and Home); the light overlay (the sensor's reading and the scene's light); the buttons overlay (B presses B; it hides and shows).🤖 Generated with Claude Code