useTexture
Load a single texture and return the result reactively.
Usage
ts
import { useTexture } from '@threeuse/core'
const { texture, isLoading, load } = useTexture()
await load('/textures/diffuse.jpg')
material.map = texture.valueReturn Value
| Property | Type | Description |
|---|---|---|
texture | Ref<Texture | null> | Loaded texture |
isLoading | Ref<boolean> | Loading state |
error | Ref<Error | null> | Error information |
load | (url: string) => Promise<Texture> | Trigger loading |