Explorar o código

Use TextDecoder for PCDLoader

Takahiro %!s(int64=8) %!d(string=hai) anos
pai
achega
beb9bf0e50
Modificáronse 1 ficheiros con 9 adicións e 2 borrados
  1. 9 2
      examples/js/loaders/PCDLoader.js

+ 9 - 2
examples/js/loaders/PCDLoader.js

@@ -35,9 +35,16 @@ THREE.PCDLoader.prototype = {
 
 	binarryToStr: function ( data ) {
 
-		var text = "";
 		var charArray = new Uint8Array( data );
-		for ( var i = 0; i < data.byteLength; i ++ ) {
+
+		if ( window.TextDecoder !== undefined ) {
+
+			return new TextDecoder().decode( charArray );
+
+		}
+
+		var text = "";
+		for ( var i = 0, il = data.byteLength; i < il; i ++ ) {
 
 			text += String.fromCharCode( charArray[ i ] );