Integrate Marble world pano/splat + GLB collider and extend splat/world discovery#123
Integrate Marble world pano/splat + GLB collider and extend splat/world discovery#123alexwelcing wants to merge 2 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a42b5b221
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| viewerRef.current.dispose() | ||
| viewerRef.current = null | ||
| loadedRef.current = false | ||
| } | ||
| } | ||
| }, [splatUrl, scene, camera, gl, position, rotation, scale]) | ||
| }, [splatUrl, scene, camera, gl, position, rotation, normalizedScale]) |
There was a problem hiding this comment.
Avoid reinitializing the splat viewer on every render
Because the useEffect depends on position/rotation arrays (which are recreated each render when passed as inline literals or defaults), and the previous loadedRef guard was removed, any parent re-render now disposes and rebuilds the Gaussian Splat viewer. This will repeatedly reload the splat when state updates occur (e.g., game timer changes), causing flicker and heavy CPU/network churn. Consider memoizing position/rotation or restoring a guard so the viewer only recreates when the splat URL or scale actually changes.
Useful? React with 👍 / 👎.
| if (scenery.splatUrl && performanceFlags.allowSplats) { | ||
| setUseGaussianSplat(true); | ||
| setSelectedSplat(scenery.splatUrl); | ||
| } else { | ||
| setUseGaussianSplat(false); |
There was a problem hiding this comment.
Preserve 3D world assets when selecting a world
When a world is selected from the gallery, the scenery object often only includes path/type (because /api/backgrounds injects the Marble world without splatUrl/colliderUrl). In that case this branch explicitly disables splats and clears the collider, so re-selecting the Marble world from the terminal gallery downgrades it to a flat pano and drops physics. Either include the splat/collider URLs in the world entry or avoid clearing them when the world selection is missing those fields.
Useful? React with 👍 / 👎.
Motivation
Description
lib/worlds/marbleWorld.tsand wired the Marble pano/splat defaults intoThreeSixtyso the scene loads the remote world by default viaonChangeImageand selects appropriate splat variants.components/3d/scene/WorldCollider.tsxwhich loads a GLB, merges mesh geometries, and creates a trimesh collider viauseTrimeshfor physics.GaussianSplatBackgroundto normalize array scales andBackgroundSphereto acceptradius,renderOrder, anddepthWrite..spzfiles by updating/pages/api/backgrounds.tsto inject the world entry and/pages/api/getSplats.tsto detect.spz, and propagated theworldtype across UI components (tablet, gallery, terminal, scene gallery, world tracker).Testing
pnpm dev --hostname 0.0.0.0 --port 3000and the application compiled and served pages successfully./api/backgroundImages,/api/backgrounds, and/api/articles-enhanced./and capture a screenshot (artifacts/marble-world.png) showing the Marble world landing view.Codex Task