2
0
Эх сурвалжийг харах

Merge branch 'ie11-ctmloader-xhr2' of https://github.com/MSOpenTech/three.js into dev

Mr.doob 11 жил өмнө
parent
commit
30d2dbdfa1

+ 3 - 3
examples/js/loaders/ctm/CTMLoader.js

@@ -72,7 +72,6 @@ THREE.CTMLoader.prototype.loadParts = function( url, callback, parameters ) {
 	}
 
 	xhr.open( "GET", url, true );
-	if ( xhr.overrideMimeType ) xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
 	xhr.setRequestHeader( "Content-Type", "text/plain" );
 	xhr.send( null );
 
@@ -101,7 +100,7 @@ THREE.CTMLoader.prototype.load = function( url, callback, parameters ) {
 
 			if ( xhr.status === 200 || xhr.status === 0 ) {
 
-				var binaryData = xhr.responseText;
+				var binaryData = new Uint8Array(xhr.response);
 
 				var s = Date.now();
 
@@ -194,8 +193,9 @@ THREE.CTMLoader.prototype.load = function( url, callback, parameters ) {
 
 	}
 
-	xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
 	xhr.open( "GET", url, true );
+	xhr.responseType = "arraybuffer";
+
 	xhr.send( null );
 
 };

+ 2 - 2
examples/js/loaders/ctm/ctm.js

@@ -592,7 +592,7 @@ CTM.Stream.prototype.TWO_POW_MINUS23 = Math.pow(2, -23);
 CTM.Stream.prototype.TWO_POW_MINUS126 = Math.pow(2, -126);
 
 CTM.Stream.prototype.readByte = function(){
-  return this.data.charCodeAt(this.offset ++) & 0xff;
+  return this.data[this.offset ++] & 0xff;
 };
 
 CTM.Stream.prototype.readInt32 = function(){
@@ -630,7 +630,7 @@ CTM.Stream.prototype.readString = function(){
 
   this.offset += len;
 
-  return this.data.substr(this.offset - len, len);
+  return this.data.subarray(this.offset - len, len);
 };
 
 CTM.Stream.prototype.readArrayInt32 = function(array){