Skip to content

feat(demo): WebGPU/WebGL toggle, auto-discovered examples, vehicle example, #666 fixes - #790

Open
DennisSmolek wants to merge 10 commits into
nextfrom
feat/demo-v10-webgpu
Open

DennisSmolek wants to merge 10 commits into
nextfrom
feat/demo-v10-webgpu

Conversation

@DennisSmolek

Copy link
Copy Markdown
Member

Depends on #787 (foundation: yarn 4, r3f 10 canary, drei 11 alpha, three 0.186). This branch is based on feat/3.0-foundation; rebase onto next once #787 merges.

What

WebGPU audit

No example needed webglOnly (the flag and a notice exist for future use).

  • Sensors: troika <Text> (WebGL ShaderMaterial) replaced by drei <Html>.
  • drei 11 alpha still reads state.gl (null on WebGPU roots in r3f 10): <Html> crashed with gl.domElement and useTexture with gl.initTexture (all-colliders, all-shapes, dynamic-type-change, locked-transforms, damping, snapshot). The demo sets state.gl = renderer on WebGPU roots (GlShim in App.tsx, commented, remove when drei uses state.renderer). Worth reporting upstream.
  • Immutable props: guard against a null ref during leva-driven remount.
  • Not used in the demo: onBeforeCompile, postprocessing, csg (the @react-three/csg dep is unused).

Verification

The Claude in Chrome extension was not connected, so I drove the dev server with headless Chrome (playwright-core, WebGPU enabled, which works), visiting every route on both renderers, collecting console errors/page errors and screenshots; also spot-checked cradle/vehicle/debug interactively by key presses. yarn typecheck, yarn test (38 tests), yarn demo:build pass.

Example WebGPU WebGL
active-collision-types ok (1) ok
all-colliders ok ok
all-shapes ok ok
api-usage ok ok
attractors ok (2) ok (2)
car ok ok
cluster ok (2) ok (2)
colliders ok ok
collision-events ok ok
components ok ok
contact-force-events ok ok
contact-skin ok ok
cradle ok ok
damping ok ok
dynamic-type-change ok ok
immutable-props ok ok
instanced-meshes ok (2) ok (2)
instances-meshes-compound ok (2) ok (2)
joints ok (1) ok
kinematics ok ok
locked-transforms ok ok
manual-step ok ok
mesh-collider-test ok ok
one-way-platform ok ok
performance ok ok
plinko ok ok
rope-joint ok (1) ok
sensors ok ok
snapshot ok ok
spring ok (1) ok
stuttering ok ok
transforms ok ok
vehicle ok (1) ok
  1. Intermittent WebGPU validation error Destroyed texture "PMREM.cubeUv" used in a submit (drei <Environment> under StrictMode); varies per run, rendering was fine in screenshots. Not fixed.
  2. React warning "props object containing a key prop is being spread" from InstancedRigidBodies ({...instance} includes key), on both renderers. Library-side fix (const { key, ...rest } = instance); left alone because fix/3.0-bugfixes also edits that file.

Also: a harmless 404 (likely favicon) and drei's RGBELoader deprecation warning appear in the console.

🤖 Generated with Claude Code

DennisSmolek and others added 10 commits October 10, 2026 12:09
- packageManager yarn@4.18.1, nodeLinker node-modules (.yarnrc.yml)
- move root tooling from dependencies to devDependencies
- drop @manypkg/cli (only used by the `ci` script)
- demo/addons depend on workspace packages via workspace:*
- engines.node >=22, ignore .yarn state but keep releases/plugins/patches

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- @react-three/fiber + test-renderer 10.0.0-canary.a056612 (scheduler 0.3, fixed step),
  three/@types/three 0.186, react/react-dom 19.2.8, drei 11.0.0-alpha.7 (demo)
- peerDependencies: fiber >=10.0.0-0, react >=19.0 <19.3, three >=0.185.0;
  rapier-addons peers on @react-three/rapier ^3.0.0-0
- three-stdlib ^2.36.1 (2.35 imports LuminanceFormat, removed from three)
- vitest 5 + jsdom 30, typescript 5.9; vitest.config.mts replaces vite.config.mts and
  resolves workspace packages from src (no build needed); root tsconfig uses
  moduleResolution Bundler with matching `paths`
- utils.ts: type-only narrowing for fiber v10's readonly-tuple math types
- tests: await `create()` instead of racing it against mount callbacks (overlapping act
  scopes), expect the extra zero-delta priming frame from advanceFrames, re-baseline the
  physics snapshot (float noise from scheduler ms timing, see PR)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mirrors react-three-jolt's build: `tsc -p tsconfig.build.json` emits per-file declarations,
rollup bundles each entry to dist/<name>.{mjs,cjs} with esbuild and rolls declarations up
into dist/<name>.{d.ts,d.mts,d.cts}.

- shared config in scripts/rollup-library.mjs; entry points are derived from each
  package's `exports` map, so a subpath entry (e.g. `./soft-bodies` -> src/soft-bodies/index.ts)
  only needs an `exports` + `files` entry. Relative imports of another entry are rewritten to
  the published specifier so core is never inlined twice.
- package.json: `exports` map (import/require with types), `type`, `sideEffects: false`,
  `engines`, narrowed `files`, repository/bugs/homepage/license metadata
- deps, peers and their subpaths are external
- `check:package` (publint --strict + attw --pack) per package, `yarn check:packages` at root
- drop babel config and the preconstruct dev postinstall

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Minimal fixes only; the demo migration proper (WebGPU, routing, perf overlay) is separate work.

- resolve @react-three/rapier(-addons) from workspace sources via vite aliases + tsconfig
  paths (keeps the old `preconstruct dev` behaviour: no build needed, HMR on library code)
- moduleResolution Bundler (exports maps of fiber v10 / drei 11 / three)
- `state.clock` is gone in v10: use `state.elapsed`
- `<Canvas shadows>` -> `gl={{ shadows: true }}` (keeps the default WebGL renderer)
- drei 11: `Text` comes from `@react-three/drei/legacy`; drop unused `useCamera`
- OrbitControls type from three/addons instead of three-stdlib
- SpringExample: stop deep-importing library internals (blocked by the exports map)
- replace r3f-perf (pins drei 9 / an old three-stdlib that breaks on three 0.186) with drei
  <Stats>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- eslint.config.mjs mirrors react-three-jolt (js + typescript-eslint recommended, react,
  react-hooks rules-of-hooks/exhaustive-deps, jsx-a11y, eslint-config-prettier last);
  automatic JSX runtime everywhere
- prettier 3 with the repo's existing style options moved to .prettierrc, so the deferred
  reformat stays small (6 files differ today)
- `lint`, `format`, `format:check` scripts. The codebase is NOT reformatted or lint-fixed
  here (baseline: 29 errors / 126 warnings); that lands at the end of the 3.0 integration.
- pre-commit hook runs `yarn typecheck` instead of the full CI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ci.yml (replaces test.yml): typecheck, test, build + publint/attw, demo build, and a
  non-blocking lint/format job; runs on PRs and pushes to main and next, with concurrency
  cancellation and read-only permissions
- shared .github/actions/setup composite: corepack (yarn 4) + setup-node with yarn cache +
  `yarn install --immutable`
- current action majors: checkout v7, setup-node v7, configure-pages v6,
  upload-pages-artifact v5, deploy-pages v5 (supersedes #733)
- release.yml mirrors react-three-jolt: runs on main and next, owner guard, permissions
  (contents/pull-requests write, id-token for provenance), yarn 4 publish env;
  `changeset:version` / `changeset:publish` scripts (publish builds and tests first)
- @changesets/cli 3; `yarn changeset pre enter alpha` (.changeset/pre.json), so `next`
  releases 3.0.0-alpha.n under the `alpha` dist-tag; `prerelease:enter`/`prerelease:exit`
  scripts replace the canary ones
- changeset for the r3f v10 stack / package format (core + addons, major)
- dependabot: root workspace + github-actions ecosystem, ignore majors of the r3f stack
- .nvmrc v22.22.2 (jsdom 30 needs >=22.22.2), demo `typecheck` script

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy-paste example on Rapier's DynamicRayCastVehicleController using
QueryFilterFlags.EXCLUDE_SENSORS for the wheel rays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…null ref

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

changeset-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 452d9eb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@react-three/rapier Major
@react-three/rapier-addons Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
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