Comments (2)
Does #3131 satisfy this?
from react-three-fiber.
@CodyJasonBennett That looks almost exactly like what I want!
The only difference I see is the caching behavior. For example, in this case:
useLoader.preload(gltfLoader, [URL_A, URL_B])
function ComponentA() {
const gltf = useLoader(gltfLoader, URL_A)
}
In the current code, the suspend
function sees these as different cache keys ([loader, URL_A]
instead of [loader, URL_A, URL_B]
) and would re-run the Loader.load
function instead of returning the preloaded object.
This sandbox shows one way to address this, memoizing load results for each URL per-loader instead of just memoizing loader instances.
Something like like:
// memoizedResults[<loader>][<url>] = <result> | undefined
const memoizedResults = new WeakMap<Loader<unknown>, Map<string, unknown>>()
That way even though suspend
re-runs, it skips loading a new object.
from react-three-fiber.
Related Issues (20)
- How to animate material during rendering
- Can't catch all useGLTF errors with React Error Boundaries HOT 7
- How to render text on top of material from list of materials? HOT 1
- Invalidate is not behaving as expected HOT 5
- Can we modify useLoader to accept an empty string or null? HOT 1
- XRFrame type resolving incorrectly HOT 2
- Error loading OBJ model in React Native HOT 2
- Help: TypeError in is.equ HOT 4
- Primitive with children mounting / unmounting + documentation HOT 4
- This sandbox doesn't work HOT 1
- Canvas eventHandler: onWebGLContextLost, onWebGLContextRestored HOT 2
- Cannot catch error HOT 1
- Is it possible to use react-three-fiber with React-Native CLI application? HOT 1
- help: using the onPointerDown event of a` <group/>` and the event.handlers of `useThree()` together HOT 1
- Types: Removed classes from three.js are still available at R3F HOT 3
- Rendering `<Context.Consumer.Provider>` is not supported HOT 1
- R3F & StereoCamera
- Breaking changes in React experimental branch HOT 1
- Cannot read properties of undefined (reading 'boundingSphere') HOT 1
- Forced landscape HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-three-fiber.