Browse Source

Examples: More clean up. (#25053)

* Examples: More clean up.

* Update USDZLoader.js
Michael Herzog 2 years ago
parent
commit
9519f6fbf6

+ 1 - 7
examples/jsm/exporters/EXRExporter.js

@@ -266,13 +266,7 @@ function compressZIP( data, tmpBuffer ) {
 
 	}
 
-	if ( typeof fflate === 'undefined' ) {
-
-		console.error( 'THREE.EXRLoader: External \`fflate.module.js\` required' );
-
-	}
-
-	const deflate = fflate.zlibSync( tmpBuffer ); // eslint-disable-line no-undef
+	const deflate = fflate.zlibSync( tmpBuffer );
 
 	return deflate;
 

+ 1 - 1
examples/jsm/exporters/MMDExporter.js

@@ -157,7 +157,7 @@ function unicodeToShiftjis( str ) {
 
 	if ( u2sTable === undefined ) {
 
-		const encoder = new MMDParser.CharsetEncoder(); // eslint-disable-line no-undef
+		const encoder = new MMDParser.CharsetEncoder();
 		const table = encoder.s2uTable;
 		u2sTable = {};
 

+ 1 - 1
examples/jsm/loaders/3MFLoader.js

@@ -106,7 +106,7 @@ class ThreeMFLoader extends Loader {
 
 			try {
 
-				zip = fflate.unzipSync( new Uint8Array( data ) ); // eslint-disable-line no-undef
+				zip = fflate.unzipSync( new Uint8Array( data ) );
 
 			} catch ( e ) {
 

+ 1 - 1
examples/jsm/loaders/AMFLoader.js

@@ -86,7 +86,7 @@ class AMFLoader extends Loader {
 
 				try {
 
-					zip = fflate.unzipSync( new Uint8Array( data ) ); // eslint-disable-line no-undef
+					zip = fflate.unzipSync( new Uint8Array( data ) );
 
 				} catch ( e ) {
 

+ 4 - 16
examples/jsm/loaders/EXRLoader.js

@@ -1252,13 +1252,7 @@ class EXRLoader extends DataTextureLoader {
 
 			const compressed = info.array.slice( info.offset.value, info.offset.value + info.size );
 
-			if ( typeof fflate === 'undefined' ) {
-
-				console.error( 'THREE.EXRLoader: External library fflate.min.js required.' );
-
-			}
-
-			const rawBuffer = fflate.unzlibSync( compressed ); // eslint-disable-line no-undef
+			const rawBuffer = fflate.unzlibSync( compressed );
 			const tmpBuffer = new Uint8Array( rawBuffer.length );
 
 			predictor( rawBuffer ); // revert predictor
@@ -1375,13 +1369,7 @@ class EXRLoader extends DataTextureLoader {
 
 			const compressed = info.array.slice( info.offset.value, info.offset.value + info.size );
 
-			if ( typeof fflate === 'undefined' ) {
-
-				console.error( 'THREE.EXRLoader: External library fflate.min.js required.' );
-
-			}
-
-			const rawBuffer = fflate.unzlibSync( compressed ); // eslint-disable-line no-undef
+			const rawBuffer = fflate.unzlibSync( compressed );
 
 			const sz = info.lines * info.channels * info.width;
 			const tmpBuffer = ( info.type == 1 ) ? new Uint16Array( sz ) : new Uint32Array( sz );
@@ -1562,7 +1550,7 @@ class EXRLoader extends DataTextureLoader {
 					case DEFLATE:
 
 						const compressed = info.array.slice( inOffset.value, inOffset.value + dwaHeader.totalAcUncompressedCount );
-						const data = fflate.unzlibSync( compressed ); // eslint-disable-line no-undef
+						const data = fflate.unzlibSync( compressed );
 						acBuffer = new Uint16Array( data.buffer );
 						inOffset.value += dwaHeader.totalAcUncompressedCount;
 						break;
@@ -1589,7 +1577,7 @@ class EXRLoader extends DataTextureLoader {
 			if ( dwaHeader.rleRawSize > 0 ) {
 
 				const compressed = info.array.slice( inOffset.value, inOffset.value + dwaHeader.rleCompressedSize );
-				const data = fflate.unzlibSync( compressed ); // eslint-disable-line no-undef
+				const data = fflate.unzlibSync( compressed );
 				rleBuffer = decodeRunLength( data.buffer );
 
 				inOffset.value += dwaHeader.rleCompressedSize;

+ 1 - 7
examples/jsm/loaders/FBXLoader.js

@@ -3551,13 +3551,7 @@ class BinaryParser {
 
 				}
 
-				if ( typeof fflate === 'undefined' ) {
-
-					console.error( 'THREE.FBXLoader: External library fflate.min.js required.' );
-
-				}
-
-				const data = fflate.unzlibSync( new Uint8Array( reader.getArrayBuffer( compressedLength ) ) ); // eslint-disable-line no-undef
+				const data = fflate.unzlibSync( new Uint8Array( reader.getArrayBuffer( compressedLength ) ) );
 				const reader2 = new BinaryReader( data.buffer );
 
 				switch ( type ) {

+ 4 - 4
examples/jsm/loaders/KMZLoader.js

@@ -86,18 +86,18 @@ class KMZLoader extends Loader {
 
 		//
 
-		const zip = fflate.unzipSync( new Uint8Array( data ) ); // eslint-disable-line no-undef
+		const zip = fflate.unzipSync( new Uint8Array( data ) );
 
 		if ( zip[ 'doc.kml' ] ) {
 
-			const xml = new DOMParser().parseFromString( fflate.strFromU8( zip[ 'doc.kml' ] ), 'application/xml' ); // eslint-disable-line no-undef
+			const xml = new DOMParser().parseFromString( fflate.strFromU8( zip[ 'doc.kml' ] ), 'application/xml' );
 
 			const model = xml.querySelector( 'Placemark Model Link href' );
 
 			if ( model ) {
 
 				const loader = new ColladaLoader( manager );
-				return loader.parse( fflate.strFromU8( zip[ model.textContent ] ) ); // eslint-disable-line no-undef
+				return loader.parse( fflate.strFromU8( zip[ model.textContent ] ) );
 
 			}
 
@@ -112,7 +112,7 @@ class KMZLoader extends Loader {
 				if ( extension === 'dae' ) {
 
 					const loader = new ColladaLoader( manager );
-					return loader.parse( fflate.strFromU8( zip[ path ] ) ); // eslint-disable-line no-undef
+					return loader.parse( fflate.strFromU8( zip[ path ] ) );
 
 				}
 

+ 1 - 7
examples/jsm/loaders/MMDLoader.js

@@ -336,13 +336,7 @@ class MMDLoader extends Loader {
 
 		if ( this.parser === null ) {
 
-			if ( typeof MMDParser === 'undefined' ) {
-
-				throw new Error( 'THREE.MMDLoader: Import MMDParser https://github.com/takahirox/mmd-parser' );
-
-			}
-
-			this.parser = new MMDParser.Parser(); // eslint-disable-line no-undef
+			this.parser = new MMDParser.Parser();
 
 		}
 

+ 1 - 1
examples/jsm/loaders/NRRDLoader.js

@@ -327,7 +327,7 @@ class NRRDLoader extends Loader {
 
 			// we need to decompress the datastream
 			// here we start the unzipping and get a typed Uint8Array back
-			_data = fflate.gunzipSync( new Uint8Array( _data ) );// eslint-disable-line no-undef
+			_data = fflate.gunzipSync( new Uint8Array( _data ) );
 
 		} else if ( headerObject.encoding === 'ascii' || headerObject.encoding === 'text' || headerObject.encoding === 'txt' || headerObject.encoding === 'hex' ) {
 

+ 1 - 8
examples/jsm/loaders/TTFLoader.js

@@ -205,14 +205,7 @@ class TTFLoader extends Loader {
 
 		}
 
-		if ( typeof opentype === 'undefined' ) {
-
-			console.warn( 'THREE.TTFLoader: The loader requires opentype.js. Make sure it\'s included before using the loader.' );
-			return null;
-
-		}
-
-		return convert( opentype.parse( arraybuffer ), this.reversed ); // eslint-disable-line no-undef
+		return convert( opentype.parse( arraybuffer ), this.reversed );
 
 	}
 

+ 1 - 1
examples/jsm/loaders/USDZLoader.js

@@ -205,7 +205,7 @@ class USDZLoader extends Loader {
 
 		}
 
-		const zip = fflate.unzipSync( new Uint8Array( buffer ) ); // eslint-disable-line no-undef
+		const zip = fflate.unzipSync( new Uint8Array( buffer ) );
 
 		// console.log( zip );
 

+ 5 - 13
examples/jsm/loaders/VRMLLoader.js

@@ -41,14 +41,6 @@ class VRMLLoader extends Loader {
 
 		super( manager );
 
-		// dependency check
-
-		if ( typeof chevrotain === 'undefined' ) { // eslint-disable-line no-undef
-
-			throw Error( 'THREE.VRMLLoader: External library chevrotain.min.js required.' );
-
-		}
-
 	}
 
 	load( url, onLoad, onProgress, onError ) {
@@ -128,7 +120,7 @@ class VRMLLoader extends Loader {
 
 		function createTokens() {
 
-			const createToken = chevrotain.createToken; // eslint-disable-line no-undef
+			const createToken = chevrotain.createToken;
 
 			// from http://gun.teipir.gr/VRML-amgem/spec/part1/concepts.html#SyntaxBasics
 
@@ -203,7 +195,7 @@ class VRMLLoader extends Loader {
 			const Comment = createToken( {
 				name: 'Comment',
 				pattern: /#.*/,
-				group: chevrotain.Lexer.SKIPPED // eslint-disable-line no-undef
+				group: chevrotain.Lexer.SKIPPED
 			} );
 
 			// commas, blanks, tabs, newlines and carriage returns are whitespace characters wherever they appear outside of string fields
@@ -211,7 +203,7 @@ class VRMLLoader extends Loader {
 			const WhiteSpace = createToken( {
 				name: 'WhiteSpace',
 				pattern: /[ ,\s]/,
-				group: chevrotain.Lexer.SKIPPED // eslint-disable-line no-undef
+				group: chevrotain.Lexer.SKIPPED
 			} );
 
 			const tokens = [
@@ -3213,7 +3205,7 @@ class VRMLLexer {
 
 	constructor( tokens ) {
 
-		this.lexer = new chevrotain.Lexer( tokens ); // eslint-disable-line no-undef
+		this.lexer = new chevrotain.Lexer( tokens );
 
 	}
 
@@ -3235,7 +3227,7 @@ class VRMLLexer {
 
 }
 
-const CstParser = chevrotain.CstParser;// eslint-disable-line no-undef
+const CstParser = chevrotain.CstParser;
 
 class VRMLParser extends CstParser {
 

+ 1 - 1
examples/jsm/loaders/VTKLoader.js

@@ -780,7 +780,7 @@ class VTKLoader extends Loader {
 
 					for ( let i = 0; i < dataOffsets.length - 1; i ++ ) {
 
-						const data = fflate.unzlibSync( byteData.slice( dataOffsets[ i ], dataOffsets[ i + 1 ] ) ); // eslint-disable-line no-undef
+						const data = fflate.unzlibSync( byteData.slice( dataOffsets[ i ], dataOffsets[ i + 1 ] ) );
 						content = data.buffer;
 
 						if ( ele.attributes.type === 'Float32' ) {