Skip to content

Scene: Spherical, and Vector3.setFromSpherical, as three.js has them - #227

Closed
kvnloo wants to merge 1 commit into
meshy-dev:mainfrom
kvnloo:fix/trt-compat-spherical
Closed

kvnloo wants to merge 1 commit into
meshy-dev:mainfrom
kvnloo:fix/trt-compat-spherical

Conversation

@kvnloo

@kvnloo kvnloo commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Adds three.js's Spherical to the scene package (set, copy, clone, makeSafe, setFromVector3, setFromCartesianCoords), along with Vector3.setFromSpherical and Vector3.setFromSphericalCoords. Both follow three.js's convention: phi is the polar angle from +y and theta is the azimuth about y from +z.

Why: orbit cameras and controls written for three.js keep the camera's offset as a Spherical. They turn it with setFromVector3, then makeSafe, then setFromSpherical. Before this, that code did not load against ThreeRT.

Merge gate: tier T. This adds TypeScript API and changes nothing the renderer draws.

  • npm run typecheck: passes
  • npm test: passes, 0 failures. The new packages/scene/test/three-compat-spherical.test.ts covers the axes, the poles, the origin, a round trip back to the same vector, and makeSafe at both poles.
  • test:render was not run. No engine encoding or scene description changes.

Drafted with AI assistance.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kvnloo

kvnloo commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Folded into #249 so these review together; closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant