fix: harden upload resilience and contracts

This commit is contained in:
Tom Boullay
2026-05-12 23:49:30 +02:00
parent 101af23418
commit 606df93b69
19 changed files with 479 additions and 159 deletions
+3 -3
View File
@@ -93,7 +93,7 @@ function supportsAlphaMap(material: Material): material is AlphaMapMaterial {
return 'alphaMap' in material
}
function isAlphaImageSource(image: object | null | undefined): image is AlphaImageSource {
function isAlphaImageSource(image: unknown): image is AlphaImageSource {
return image instanceof HTMLImageElement
|| image instanceof HTMLCanvasElement
|| (typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap)
@@ -103,7 +103,7 @@ function createAlphaMapTexture(texture: Texture) {
const cachedTexture = alphaMapTextureCache.get(texture)
if (cachedTexture) return cachedTexture
const image = texture.image as object | null | undefined
const image = texture.image
if (!isAlphaImageSource(image)) {
texture.flipY = false
@@ -243,7 +243,7 @@ function Model({
loader.manager.setURLModifier((requestedUrl) => resolveAssetUrl(requestedUrl, assetUrls))
})
const opacityMapEntries = getOpacityMapEntries(assetUrls)
const opacityMaps = useLoader(TextureLoader, opacityMapEntries.map((entry) => entry.url)) as Texture[]
const opacityMaps = useLoader(TextureLoader, opacityMapEntries.map((entry) => entry.url))
useEffect(() => {
onStatsReady(getModelStats(scene, assetUrls))