Skip to content

Commit 20d1f60

Browse files
authored
Merge pull request #21177 from zeux/gltf-loader-error
GLTFLoader: Make error when loading textures with no data clear
2 parents 464efc8 + 5d6ad11 commit 20d1f60

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

examples/js/loaders/GLTFLoader.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2443,6 +2443,10 @@ THREE.GLTFLoader = ( function () {
24432443

24442444
} );
24452445

2446+
} else if ( source.uri === undefined ) {
2447+
2448+
throw new Error( 'THREE.GLTFLoader: Image ' + textureIndex + ' is missing URI and bufferView' );
2449+
24462450
}
24472451

24482452
return Promise.resolve( sourceURI ).then( function ( sourceURI ) {
@@ -2626,7 +2630,7 @@ THREE.GLTFLoader = ( function () {
26262630
if ( useFlatShading ) cachedMaterial.flatShading = true;
26272631
if ( useMorphTargets ) cachedMaterial.morphTargets = true;
26282632
if ( useMorphNormals ) cachedMaterial.morphNormals = true;
2629-
2633+
26302634
if ( useVertexTangents ) {
26312635

26322636
cachedMaterial.vertexTangents = true;

examples/jsm/loaders/GLTFLoader.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,10 @@ var GLTFLoader = ( function () {
25082508

25092509
} );
25102510

2511+
} else if ( source.uri === undefined ) {
2512+
2513+
throw new Error( 'THREE.GLTFLoader: Image ' + textureIndex + ' is missing URI and bufferView' );
2514+
25112515
}
25122516

25132517
return Promise.resolve( sourceURI ).then( function ( sourceURI ) {

0 commit comments

Comments
 (0)