Skip to content

Commit

Permalink
Use FileLoader.setMimeType() from MMDLoader (#9990)
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirox authored and mrdoob committed Nov 2, 2016
1 parent 0d47a62 commit 4a1db7b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions examples/js/loaders/MMDLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,12 @@ THREE.MMDLoader.prototype.extractExtension = function ( url ) {

};

THREE.MMDLoader.prototype.loadFile = function ( url, onLoad, onProgress, onError, responseType ) {
THREE.MMDLoader.prototype.loadFile = function ( url, onLoad, onProgress, onError, responseType, mimeType ) {

var loader = new THREE.FileLoader( this.manager );

if ( mimeType !== undefined ) loader.setMimeType( mimeType );

loader.setResponseType( responseType );

var request = loader.load( url, function ( result ) {
Expand All @@ -338,15 +340,7 @@ THREE.MMDLoader.prototype.loadFileAsText = function ( url, onLoad, onProgress, o

THREE.MMDLoader.prototype.loadFileAsShiftJISText = function ( url, onLoad, onProgress, onError ) {

var request = this.loadFile( url, onLoad, onProgress, onError, 'text' );

/*
* TODO: some browsers seem not support overrideMimeType
* so some workarounds for them may be necessary.
* Note: to set property of request after calling request.send(null)
* (it's called in THREE.FileLoader.load()) could be a bad manner.
*/
request.overrideMimeType( 'text/plain; charset=shift_jis' );
var request = this.loadFile( url, onLoad, onProgress, onError, 'text', 'text/plain; charset=shift_jis' );

};

Expand Down

0 comments on commit 4a1db7b

Please sign in to comment.