1 /**
  2  * potree.js 
  3  * http://potree.org
  4  *
  5  * Copyright 2012, Markus Sch�tz
  6  * Licensed under the GPL Version 2 or later.
  7  * - http://potree.org/wp/?page_id=7
  8  * - http://www.gnu.org/licenses/gpl-3.0.html
  9  *
 10  */
 11 
 12 /**
 13  * extensions for ArrayBuffers
 14  * 
 15  * @author Markus Sch�tz
 16  *
 17  * @class
 18  */
 19 ArrayBuffer = ArrayBuffer;
 20 
 21 ArrayBuffer.prototype.subarray = function(offset, length){
 22 	if(length == null){
 23 		length = this.byteLength - offset;
 24 	}
 25 	
 26 	var sub = new ArrayBuffer(length);
 27 	var subView = new Int8Array(sub);
 28 	var thisView = new Int8Array(this);
 29 	
 30 	for(var i = 0; i < length; i++ ){
 31 		subView[i] = thisView[offset+i];
 32 	}
 33 	
 34 	return sub;
 35 }