Skip to content

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.value

Return Value

PropertyTypeDescription
textureRef<Texture | null>Loaded texture
isLoadingRef<boolean>Loading state
errorRef<Error | null>Error information
load(url: string) => Promise<Texture>Trigger loading

Released under the MIT License.