From a49e4869c8eb7d9bfb681efe2828e578af8cd7e0 Mon Sep 17 00:00:00 2001 From: Andor Salga Date: Thu, 21 Jul 2011 16:02:54 -0400 Subject: [PATCH 1/3] updated changelog, updated version --- CHANGELOG | 2 +- psapi.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 10cfedd..89d8379 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -July 19, 2011 - Release 0.75 +July 21, 2011 - Release 0.75 * Created changelog * Added anti-aliasing option diff --git a/psapi.js b/psapi.js index 189203c..27ffdd0 100644 --- a/psapi.js +++ b/psapi.js @@ -6,7 +6,7 @@ @class XB PointStream is a WebGL library designed to efficiently stream and render point cloud data in a canvas element. - @version 0.7 + @version 0.75 */ var PointStream = (function() { @@ -56,7 +56,7 @@ var PointStream = (function() { registeredParsers["pts"] = PTSParser; registeredParsers["ply"] = PLYParser; - const VERSION = "0.7"; + const VERSION = "0.75"; // file status of point clouds const FILE_NOT_FOUND = -1; From b85160d6f5ce46ec0788bb0912dbf41ec92f781d Mon Sep 17 00:00:00 2001 From: Andor Salga Date: Thu, 21 Jul 2011 18:24:29 -0400 Subject: [PATCH 2/3] Merge branches 'master' and '0.75' From ec56545a5be75e78a125467aa1800b80f0b630f3 Mon Sep 17 00:00:00 2001 From: Andor Salga Date: Sat, 10 Sep 2011 15:32:17 -0400 Subject: [PATCH 3/3] added delete function and test. --- demos/lion/lion.js | 6 ++++++ psapi.js | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/demos/lion/lion.js b/demos/lion/lion.js index bef0ae1..ae8d460 100644 --- a/demos/lion/lion.js +++ b/demos/lion/lion.js @@ -32,6 +32,12 @@ function keyDown(){ if(ps.key == KEY_ESC){ ps.stop("../../clouds/lion_1048K_n.psi"); } + + // D deletes and recreates the cloud + if(ps.key == 68 || ps.key == 100 ){ + ps.delete(lion); + lion = ps.load("../../clouds/lion_1048K_n.psi"); + } } function render() { diff --git a/psapi.js b/psapi.js index 27ffdd0..5b038a7 100644 --- a/psapi.js +++ b/psapi.js @@ -1211,7 +1211,25 @@ var PointStream = (function() { this.clear = function(){ ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT); }; - + + this.delete = function(pointCloud){ + var semantics = Object.keys(pointCloud.attributes); + var firstSemantic = semantics[0]; + + var arrayOfBufferObjsV = pointCloud.attributes[firstSemantic]; + if(arrayOfBufferObjsV){ + // Iterate over all the vertex buffer objects. + for(var currVBO = 0; currVBO < arrayOfBufferObjsV.length; currVBO++){ + // iterate over all the semantic names "ps_Vertex", "ps_Normal", etc. + for(name in semantics){ + if(pointCloud.attributes[semantics[name]][currVBO]){ + ctx.deleteBuffer(pointCloud.attributes[semantics[name]][currVBO].VBO); + } + } + } + } + }; + /** Renders a point cloud. @param {} pointCloud