diff --git a/examples/js/loaders/ctm/ctm.js b/examples/js/loaders/ctm/ctm.js index 72f1d19c6a51d964f42a4938197df4b2cfd05f57..daf21c0dd27a835551b56b564b818c96f37a957a 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;