v10.0.0-alpha.5
Pre-release
Pre-release
·
55 commits
to master
since this release
Alpha 5 is a types release. The WebGPU resource hooks now carry three's exact node generics, the
stale TSL augmentations are gone, and the built declarations are compiled by a strict consumer
fixture on every build. Alongside it: the reconciler oddities that strict-TypeScript consumers
surfaced while working around the old types, and the single-canvas depth-attachment fix.
Types
useUniformanduseUniformskeep three's exactUniformNode<TNodeType, TValue>generics and
the input's exact keys. Anumberuniform is aNode<'float'>, so TSL math,mix()and
bloom()accept it without a cast;.valueis typed; an unknown key is an error
(#3769,
#3886,
#3887).ScopedStoredistinguishes nested scopes from object-valued and callable (Fn()) leaves at
runtime, and.scope(key)accepts an explicit schema generic for cross-call access.- The stale
ShaderNodeObjectandthree/tslFnaugmentations are gone. three's ownFn
overloads, including theFn(fn, 'void')statement-call form compute kernels use, are reachable
again with R3F installed. Matrix2is an accepted uniform value (mat2), matching three'suniform()overloads.StorageLikeincludesStorage3DTextureandStorageArrayTexture, souseGPUStorageaccepts
whatcompute.mdxdocuments.once()is typed as the value the prop declares:translate={once(0, 0, 5)}and
center={once()}typecheck without a cast.- On the
/webgpuentry,Canvas'sonCreatedreceivesWebGPURootState, so WebGPU-only
renderer members no longer need aninstanceofnarrow. pnpm verify-typescompiles a strict consumer fixture against the built declarations with
skipLibCheck: false, for every entry.- Reader-mode
useUniforms,useNodes,useBuffersanduseGPUStorageaccept an explicit
schema:useUniforms<{ blurAmount: number }>()returns typed nodes for values registered
elsewhere, instead ofUniformNode<unknown>. extend(THREE)accepts a whole module namespace without a cast; only its constructors are
registered.raycaster={{ params: { Points: { threshold: 0.2 } } }}typechecks:paramsis a partial,
matching the runtime merge into the raycaster's defaults.eventSourceaccepts any DOMElement, so anSVGRenderer's<svg>no longer needs a cast.<primitive>keeps typed pointer events (onClick={(e) => ...}inferse) and accepts
arbitrary props for the wrapped object.- The examples compile under strict TypeScript without a single
as unknown ascast; the
remainingas anysites are third-party gaps (three'sBackend,@use-gesture) and are
commented as such.
Bug Fixes
useTexture'sonLoadreceives the keyed record for record inputs, matching its declared type.
It was handeduseLoader's positional array, sotextures.map.wrapTthrew at runtime.- Prefixed elements (
<threeLine>) no longer throw "ThreeLine is not part of the THREE namespace"
on their first prop update. - A removed prop resets to the class default for every class. Any class whose constructor takes
arguments (every material, geometry and camera) previously had the prop set to0, turning a
removedcolorblack. fromRef(ref, transform)maps the resolved sibling before assignment, so props that need the
sibling wrapped are declarative:lightsNode={fromRef(lightRef, (l) => lights([l]))}.- Six-file
.hdrcube sets load throughHDRCubeTextureLoaderinuseEnvironment,
<Environment>and the Canvasbackgroundprop, with linear color space. - A lone primary
<Canvas id>owns the renderer's default canvas target, so its depth attachment
follows the layout instead of the element's construction size
(#3905). - Canvas honors the
resize.debounceprop after the initial measurement
(#3881). useRenderPipelinecallbacks receive aWebGPURenderer-typed state, may not return the
hook-ownedscenePass, and the hook's return narrowsrenderPipelineonisReady
(#3901).- The Pointcloud example's fragment shader handles point colors correctly.
Examples
- The demo registry is the one table of contents; the app derives its groups from it. Adds
WebGPUFogandWebGPUPrimaryOnly, drops stale entries, and the examples cleanup from
#3883.
eslint-plugin
no-clone-in-looponly flags.clone()calls. A loop variable namedcloneused as
clone.positionno longer trips it.