Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow custom loading manager to useTexture #585

Merged
merged 5 commits into from
Apr 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/composables/useTexture/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Texture } from 'three'
import { LoadingManager, TextureLoader } from 'three'
import type { Texture, LoadingManager } from 'three'
import { TextureLoader } from 'three'
import { isArray } from '../../utils'

export interface PBRMaterialOptions {
Expand Down Expand Up @@ -114,9 +114,10 @@ export async function useTexture<TextureMap extends PBRUseTextureMap>(

export async function useTexture(
paths: readonly [string] | string[] | PBRUseTextureMap,
manager?: LoadingManager,
): Promise<Texture | Texture[] | PBRTextureMaps> {
hawk86104 marked this conversation as resolved.
Show resolved Hide resolved
const loadingManager = new LoadingManager()
const textureLoader = new TextureLoader(loadingManager)
// fiexd TextureLoader use THREE.DefaultLoadingManager as default loading manager
const textureLoader = new TextureLoader(manager)
hawk86104 marked this conversation as resolved.
Show resolved Hide resolved

/**
* Load a texture.
Expand Down
Loading