Skip to content

Commit

Permalink
docs: useGLTF extendLoader example
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier authored Sep 22, 2024
1 parent 5cce7d0 commit 5710ce5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/loaders/gltf-use-gltf.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,27 @@ If you want to use your own draco decoder globally, you can pass it through `use
> ```
>
> It is recommended that you check your browser's network tab to confirm that the correct URLs are being used, and that the files do get loaded from the prefetch cache on subsequent requests.
If for example your model [`facecap.glb`](https://github.com/mrdoob/three.js/blob/master/examples/models/gltf/facecap.glb) needs KTX2 textures, you can `extendLoader`:
```tsx
import { KTX2Loader } from "three-stdlib"
const ktx2Loader = new KTX2Loader()
ktx2Loader.setTranscoderPath("https://unpkg.com/[email protected]/examples/jsm/libs/basis/")
// ...
const { gl } = useThree()
useGLTF("facecap.glb", true, true, (loader) => {
loader.setKTX2Loader(ktx2Loader.detectSupport(gl))
})
```
## `Gltf`

A `Gltf` component is also provided:

```tsx
<Gltf src={url} />
<Gltf src={url} useDraco='/draco-gltf' />
```

0 comments on commit 5710ce5

Please sign in to comment.