src/loaders/OBJLoader2.js
function ( content ) {
		// fast-fail in case of illegal data
		if ( content === null || content === undefined ) {

			throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing';

		}
		if ( this.logging.enabled ) console.time( 'OBJLoader2 parse: ' + this.modelName );
		this.meshBuilder.init();

		var parser = new THREE.OBJLoader2.Parser();
		parser.setLogging( this.logging.enabled, this.logging.debug );
		parser.setMaterialPerSmoothingGroup( this.materialPerSmoothingGroup );
		parser.setUseOAsMesh( this.useOAsMesh );
		parser.setUseIndices( this.useIndices );
		parser.setDisregardNormals( this.disregardNormals );
		// sync code works directly on the material references
		parser.setMaterials( this.meshBuilder.getMaterials() );

		var scope = this;
		var onMeshLoaded = function ( payload ) {
			var meshes = scope.meshBuilder.processPayload( payload );
			var mesh;
			for ( var i in meshes ) {
				mesh = meshes[ i ];
				scope.loaderRootNode.add( mesh );
			}
		};
		parser.setCallbackOnAssetAvailable( onMeshLoaded );
		var onProgressScoped = function ( text, numericalValue ) {
			scope.onProgress( 'progressParse', text, numericalValue );
		};
		parser.setCallbackOnProgress( onProgressScoped );
		var onErrorScoped = function ( message ) {
			scope._onError( message );
		};
		parser.setCallbackOnError( onErrorScoped );

		if ( content instanceof ArrayBuffer || content instanceof Uint8Array ) {

			if ( this.logging.enabled ) console.info( 'Parsing arrayBuffer...' );
			parser.parse( content );

		} else if ( typeof( content ) === 'string' || content instanceof String ) {

			if ( this.logging.enabled ) console.info( 'Parsing text...' );
			parser.parseText( content );

		} else {

			this._onError( 'Provided content was neither of type String nor Uint8Array! Aborting...' );

		}
		if ( this.logging.enabled ) console.timeEnd( 'OBJLoader2 parse: ' + this.modelName );

		return this.loaderRootNode;
	}
function ( content ) {
		// fast-fail in case of illegal data
		if ( content === null || content === undefined ) {

			throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing';

		}
		if ( this.logging.enabled ) console.time( 'OBJLoader2 parse: ' + this.modelName );
		this.meshBuilder.init();

		var parser = new THREE.OBJLoader2.Parser();
		parser.setLogging( this.logging.enabled, this.logging.debug );
		parser.setMaterialPerSmoothingGroup( this.materialPerSmoothingGroup );
		parser.setUseOAsMesh( this.useOAsMesh );
		parser.setUseIndices( this.useIndices );
		parser.setDisregardNormals( this.disregardNormals );
		// sync code works directly on the material references
		parser.setMaterials( this.meshBuilder.getMaterials() );

		var scope = this;
		var onMeshLoaded = function ( payload ) {
			var meshes = scope.meshBuilder.processPayload( payload );
			var mesh;
			for ( var i in meshes ) {
				mesh = meshes[ i ];
				scope.loaderRootNode.add( mesh );
			}
		};
		parser.setCallbackOnAssetAvailable( onMeshLoaded );
		var onProgressScoped = function ( text, numericalValue ) {
			scope.onProgress( 'progressParse', text, numericalValue );
		};
		parser.setCallbackOnProgress( onProgressScoped );
		var onErrorScoped = function ( message ) {
			scope._onError( message );
		};
		parser.setCallbackOnError( onErrorScoped );

		if ( content instanceof ArrayBuffer || content instanceof Uint8Array ) {

			if ( this.logging.enabled ) console.info( 'Parsing arrayBuffer...' );
			parser.parse( content );

		} else if ( typeof( content ) === 'string' || content instanceof String ) {

			if ( this.logging.enabled ) console.info( 'Parsing text...' );
			parser.parseText( content );

		} else {

			this._onError( 'Provided content was neither of type String nor Uint8Array! Aborting...' );

		}
		if ( this.logging.enabled ) console.timeEnd( 'OBJLoader2 parse: ' + this.modelName );

		return this.loaderRootNode;
	}
function ( content ) { // fast-fail in case of illegal data if ( content === null || content === undefined ) { throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing' ; } if ( this . logging . enabled ) console . time ( 'OBJLoader2 parse: ' + this . modelName ) ; this . meshBuilder . init ( ) ; var parser = new THREE . OBJLoader2 . Parser ( ) ; parser . setLogging ( this . logging . enabled , this . logging . debug ) ; parser . setMaterialPerSmoothingGroup ( this . materialPerSmoothingGroup ) ; parser . setUseOAsMesh ( this . useOAsMesh ) ; parser . setUseIndices ( this . useIndices ) ; parser . setDisregardNormals ( this . disregardNormals ) ; // sync code works directly on the material references parser . setMaterials ( this . meshBuilder . getMaterials ( ) ) ; var scope = this ; var onMeshLoaded = function ( payload ) { var meshes = scope . meshBuilder . processPayload ( payload ) ; var mesh ; for ( var i in meshes ) { mesh = meshes [ i ] ; scope . loaderRootNode . add ( mesh ) ; } } ; parser . setCallbackOnAssetAvailable ( onMeshLoaded ) ; var onProgressScoped = function ( text , numericalValue ) { scope . onProgress ( 'progressParse' , text , numericalValue ) ; } ; parser . setCallbackOnProgress ( onProgressScoped ) ; var onErrorScoped = function ( message ) { scope . _onError ( message ) ; } ; parser . setCallbackOnError ( onErrorScoped ) ; if ( content instanceof ArrayBuffer || content instanceof Uint8Array ) { if ( this . logging . enabled ) console . info ( 'Parsing arrayBuffer...' ) ; parser . parse ( content ) ; } else if ( typeof ( content ) === 'string' || content instanceof String ) { if ( this . logging . enabled ) console . info ( 'Parsing text...' ) ; parser . parseText ( content ) ; } else { this . _onError ( 'Provided content was neither of type String nor Uint8Array! Aborting...' ) ; } if ( this . logging . enabled ) console . timeEnd ( 'OBJLoader2 parse: ' + this . modelName ) ; return this . loaderRootNode ; }
Parses OBJ data synchronously from arraybuffer or string.

@param {arraybuffer|string} content OBJ data as Uint8Array or String
Parses OBJ data synchronously from arraybuffer or string .