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 * @class 14 */ 15 function PointCloud(name, pointAttributes) { 16 this.name = name; 17 this.vbo = null; 18 this.aabb = null; 19 this.pointCloudRoot = false; 20 this.pointAttributes = pointAttributes; 21 this.size = 0; 22 } 23 24 /** 25 * delete point cloud data from gpu 26 */ 27 PointCloud.prototype.unload = function(){ 28 if (this.vbo != null) { 29 gl.bindBuffer(gl.ARRAY_BUFFER, null); 30 gl.deleteBuffer(this.vbo); 31 } 32 }; 33 34 /** 35 * move pointcloud data to the gpu 36 * @param data 37 */ 38 PointCloud.prototype.setVertexBufferData = function(data) { 39 40 // wenn vertex buffer noch nicht vorhanden -> neuen erstellen 41 if (this.vbo == null) { 42 this.vbo = gl.createBuffer(); 43 } 44 45 gl.bindBuffer(gl.ARRAY_BUFFER, this.vbo); 46 gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW); 47 }; 48 49