Repository navigation
feat(graphics-3d): Three.js 3D graphics library - #459
Merged
Merged
Conversation
WebGPURenderer with WebGL2 fallback (forceWebGL), rendered from the engine tick only, following the viewport, full teardown, Three.js re-exported from the /three and /three/tsl subpaths, editor graphics-camera feature and graphics-capture command.
Keep the editor across restarts, since __editorInit runs once per app.
3D client for the network pong: each player sees the table from behind its own paddle, spectators from above the right end. The server seats players and sends spectators the game state.
josephinecr
reviewed
Nov 6, 2026
josephinecr
left a comment
Contributor
There was a problem hiding this comment.
Review of the new graphics-3d module and examples. Main issues: infinite recursion when wrapping render, blank canvas after a resize while paused, and a Context.graphics type conflict with graphics-2d. The rest are edge cases and minor perf/cleanup.
…ed camera and init cleanup - render getter returns the active render step, so a wrapper no longer recurses - redraw after a viewport change, so a paused game keeps its image - graphics-capture answers an empty string when there is no renderer - graphics-camera refreshes parent transforms (updateWorldMatrix) - release the canvas and renderer when renderer.init() fails
- tag each paddle with a Paddle component carrying its seat - drop a duplicated ternary in the server bounce
…camera matrices and raycaster - without a viewport, observe the container and size the canvas at its window's pixel ratio - send camera matrices from preallocated buffers, allocating only when they change - reuse one Raycaster and one NDC vector across picks
josephinecr
approved these changes
Nov 6, 2026
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.
Adds
@nanoforge-dev/graphics-3d, the engine's 3D library built on Three.js (chosen in the benchmark).forceWebGLforces it). It renders once per engine tick, after the systems, never from its own loop, and follows the viewport like graphics-2d (contain/cover/fill). On clear it disposes everything and removes the canvas andwindow.__THREE__.Context.graphics:scene,camera,renderer,backend,raycast,worldToScreen, and a replaceablerenderfor post-processing./threeand/three/tsl.threeis a peer dependency, so apps and add-ons share one copy.graphicsCamerafeature (sends the camera's view/projection) and thegraphics-capturecommand (screenshot that works while paused).cube-3d(first scene) andpong-3d(peer-to-peer; player camera behind their own paddle, spectator camera above the right end of the table).Tests: 20 unit tests covering init/clear cycles, viewport fits, teardown, backend choice, the editor events and the custom render. Checked in Chrome only. p2p needs the unreleased CLI p2p build.
Closes #36. Follow-ups: #456, #457, #458, NanoForge-dev/components-systems#21.