From bc272b031da0255391c707adf15e6ea4f9ef97a0 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Wed, 2 Oct 2013 08:25:46 -0700 Subject: [PATCH] changed readByte() and readString() to read from Uint8Array returned by xhr2 --- examples/js/loaders/ctm/ctm.js | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/examples/js/loaders/ctm/ctm.js b/examples/js/loaders/ctm/ctm.js index 72f1d19c6a..daf21c0dd2 100755 --- a/examples/js/loaders/ctm/ctm.js +++ b/examples/js/loaders/ctm/ctm.js @@ -585,27 +585,16 @@ CTM.InterleavedStream.prototype.writeByte = function(value){ CTM.Stream = function(data){ this.data = data; this.offset = 0; - if (typeof data === 'string'){ - this.readByte = this.readByteFromString; - this.readString = this.readStringFromString; - } else { - this.readByte = this.readByteFromArray; - this.readString = this.readStringFromArray; - } }; CTM.Stream.prototype.TWO_POW_MINUS23 = Math.pow(2, -23); CTM.Stream.prototype.TWO_POW_MINUS126 = Math.pow(2, -126); -CTM.Stream.prototype.readByteFromArray = function(){ +CTM.Stream.prototype.readByte = function(){ return this.data[this.offset ++] & 0xff; }; -CTM.Stream.prototype.readByteFromString = function(){ - return this.data.charCodeAt(this.offset ++) & 0xff; -}; - CTM.Stream.prototype.readInt32 = function(){ var i = this.readByte(); i |= this.readByte() << 8; @@ -636,7 +625,7 @@ CTM.Stream.prototype.readFloat32 = function(){ return s * 0; }; -CTM.Stream.prototype.readStringFromArray = function(){ +CTM.Stream.prototype.readString = function(){ var len = this.readInt32(); this.offset += len; @@ -644,15 +633,6 @@ CTM.Stream.prototype.readStringFromArray = function(){ return this.data.subarray(this.offset - len, len); }; - -CTM.Stream.prototype.readStringFromString = function(){ - var len = this.readInt32(); - - this.offset += len; - - return this.data.substr(this.offset - len, len); -}; - CTM.Stream.prototype.readArrayInt32 = function(array){ var i = 0, len = array.length; -- GitLab