vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Turn the model freely instead of orbiting to a pole
6064a74550d5c9d86c5b899010dc9a5cc7ba5622 · Keenan Nemetz · 11d ago · parent 0be96824
Turn the model freely instead of orbiting to a pole OrbitControls clamps its polar angle to [0, π], so a vertical drag stopped after half a turn: the reader could not roll the model over. Horizontal orbiting wrapped, but the model could never be seen from the far side of a pole. The pointer now turns the model itself, about the screen's own right and up axes, which has no pole: each move is a rotation applied to a group that holds the centred model, so it can be rolled over and over in any direction and stays centred on the model's own middle. A drag the height of the canvas is still one full turn, so the feel is the one the orbit had. Two pointers cancel the turn and stay with OrbitControls, which keeps the wheel, pinch zoom, the pan and the distance limits the buttons share. Reset puts the turn back to identity. It also recomputes the spin group's world matrix before measuring the model: the bounding box is measured in world space, so a reset after a turn would otherwise measure the model at the angle it had just been left at and place it off centre. Checked in headless Chromium against the bundled three.js, with an asymmetric tetrahedron: five vertical drags moved the frame every time, where the orbit version moved it once and then stopped; horizontal drags still turn it; reset and the zoom and wireframe buttons still work.
server/web/static/models/README.md +2−1
| @@ -1,7 +1,8 @@ | |||
| 1 | 1 | # 3D model preview | |
| 2 | 2 | ||
| 3 | 3 | `model-viewer.js` is Vole's viewer: it draws a blob into a canvas with | |
| 4 | drag-to-orbit, wheel, pinch or button zoom, and a wireframe toggle. `app.js` | ||
| 4 | drag-to-turn (a trackball, with no pole to stop at), wheel, pinch or button | ||
| 5 | zoom, and a wireframe toggle. `app.js` | ||
| 5 | 6 | imports it only when a page contains a `[data-model]` element, so no other page | |
| 6 | 7 | downloads it. | |
| 7 | 8 | ||