|
@@ -25,7 +25,7 @@ class TGALoader extends DataTextureLoader {
|
|
case TGA_TYPE_RLE_INDEXED:
|
|
case TGA_TYPE_RLE_INDEXED:
|
|
if ( header.colormap_length > 256 || header.colormap_size !== 24 || header.colormap_type !== 1 ) {
|
|
if ( header.colormap_length > 256 || header.colormap_size !== 24 || header.colormap_type !== 1 ) {
|
|
|
|
|
|
- console.error( 'THREE.TGALoader: Invalid type colormap data for indexed type.' );
|
|
|
|
|
|
+ throw new Error( 'THREE.TGALoader: Invalid type colormap data for indexed type.' );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -39,7 +39,7 @@ class TGALoader extends DataTextureLoader {
|
|
case TGA_TYPE_RLE_GREY:
|
|
case TGA_TYPE_RLE_GREY:
|
|
if ( header.colormap_type ) {
|
|
if ( header.colormap_type ) {
|
|
|
|
|
|
- console.error( 'THREE.TGALoader: Invalid type colormap data for colormap type.' );
|
|
|
|
|
|
+ throw new Error( 'THREE.TGALoader: Invalid type colormap data for colormap type.' );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -48,12 +48,12 @@ class TGALoader extends DataTextureLoader {
|
|
// What the need of a file without data ?
|
|
// What the need of a file without data ?
|
|
|
|
|
|
case TGA_TYPE_NO_DATA:
|
|
case TGA_TYPE_NO_DATA:
|
|
- console.error( 'THREE.TGALoader: No data.' );
|
|
|
|
|
|
+ throw new Error( 'THREE.TGALoader: No data.' );
|
|
|
|
|
|
// Invalid type ?
|
|
// Invalid type ?
|
|
|
|
|
|
default:
|
|
default:
|
|
- console.error( 'THREE.TGALoader: Invalid type "%s".', header.image_type );
|
|
|
|
|
|
+ throw new Error( 'THREE.TGALoader: Invalid type ' + header.image_type );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -61,7 +61,7 @@ class TGALoader extends DataTextureLoader {
|
|
|
|
|
|
if ( header.width <= 0 || header.height <= 0 ) {
|
|
if ( header.width <= 0 || header.height <= 0 ) {
|
|
|
|
|
|
- console.error( 'THREE.TGALoader: Invalid image size.' );
|
|
|
|
|
|
+ throw new Error( 'THREE.TGALoader: Invalid image size.' );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -70,7 +70,7 @@ class TGALoader extends DataTextureLoader {
|
|
if ( header.pixel_size !== 8 && header.pixel_size !== 16 &&
|
|
if ( header.pixel_size !== 8 && header.pixel_size !== 16 &&
|
|
header.pixel_size !== 24 && header.pixel_size !== 32 ) {
|
|
header.pixel_size !== 24 && header.pixel_size !== 32 ) {
|
|
|
|
|
|
- console.error( 'THREE.TGALoader: Invalid pixel size "%s".', header.pixel_size );
|
|
|
|
|
|
+ throw new Error( 'THREE.TGALoader: Invalid pixel size ' + header.pixel_size );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -365,7 +365,7 @@ class TGALoader extends DataTextureLoader {
|
|
break;
|
|
break;
|
|
|
|
|
|
default:
|
|
default:
|
|
- console.error( 'THREE.TGALoader: Format not supported.' );
|
|
|
|
|
|
+ throw new Error( 'THREE.TGALoader: Format not supported.' );
|
|
break;
|
|
break;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -391,7 +391,7 @@ class TGALoader extends DataTextureLoader {
|
|
break;
|
|
break;
|
|
|
|
|
|
default:
|
|
default:
|
|
- console.error( 'THREE.TGALoader: Format not supported.' );
|
|
|
|
|
|
+ throw new Error( 'THREE.TGALoader: Format not supported.' );
|
|
break;
|
|
break;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -422,7 +422,7 @@ class TGALoader extends DataTextureLoader {
|
|
TGA_ORIGIN_UL = 0x02,
|
|
TGA_ORIGIN_UL = 0x02,
|
|
TGA_ORIGIN_UR = 0x03;
|
|
TGA_ORIGIN_UR = 0x03;
|
|
|
|
|
|
- if ( buffer.length < 19 ) console.error( 'THREE.TGALoader: Not enough data to contain header.' );
|
|
|
|
|
|
+ if ( buffer.length < 19 ) throw new Error( 'THREE.TGALoader: Not enough data to contain header.' );
|
|
|
|
|
|
let offset = 0;
|
|
let offset = 0;
|
|
|
|
|
|
@@ -450,7 +450,7 @@ class TGALoader extends DataTextureLoader {
|
|
|
|
|
|
if ( header.id_length + offset > buffer.length ) {
|
|
if ( header.id_length + offset > buffer.length ) {
|
|
|
|
|
|
- console.error( 'THREE.TGALoader: No data.' );
|
|
|
|
|
|
+ throw new Error( 'THREE.TGALoader: No data.' );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|