From 32f104cdaf873881b5d6ad00f851c887d59a84b5 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 10 Apr 2018 17:05:56 +0200 Subject: [PATCH] fix counter var --- examples/pointcloud.js | 5 +---- examples/pointcloud_globe.js | 5 +---- src/Process/PointCloudProcessing.js | 12 +++++------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/examples/pointcloud.js b/examples/pointcloud.js index 9c170339fd..5282d162a3 100644 --- a/examples/pointcloud.js +++ b/examples/pointcloud.js @@ -76,10 +76,7 @@ function showPointcloud(serverUrl, fileName, lopocsTable) { pointcloud.postUpdate = function postUpdate() { var info = document.getElementById('info'); oldPostUpdate.apply(pointcloud, arguments); - info.textContent = 'Nb points: ' + - pointcloud.counters.displayedCount.toLocaleString() + ' (' + - Math.floor(100 * pointcloud.counters.displayedCount / pointcloud.counters.pointCount) + '%) (' + - view.mainLoop.gfxEngine.renderer.info.memory.geometries + ')'; + info.textContent = 'Nb points: ' + pointcloud.displayedCount.toLocaleString(); }; window.view = view; } diff --git a/examples/pointcloud_globe.js b/examples/pointcloud_globe.js index d867af9d4c..70035df244 100644 --- a/examples/pointcloud_globe.js +++ b/examples/pointcloud_globe.js @@ -49,10 +49,7 @@ function showPointcloud(serverUrl, fileName) { pointcloud.postUpdate = function postUpdate() { var info = document.getElementById('info'); oldPostUpdate.apply(pointcloud, arguments); - info.textContent = 'Nb points: ' + - pointcloud.counters.displayedCount.toLocaleString() + ' (' + - Math.floor(100 * pointcloud.counters.displayedCount / pointcloud.counters.pointCount) + '%) (' + - view.mainLoop.gfxEngine.renderer.info.memory.geometries + ')'; + info.textContent = 'Nb points: ' + pointcloud.displayedCount.toLocaleString(); }; window.view = view; } diff --git a/src/Process/PointCloudProcessing.js b/src/Process/PointCloudProcessing.js index 342bc573c8..1d60b73bc5 100644 --- a/src/Process/PointCloudProcessing.js +++ b/src/Process/PointCloudProcessing.js @@ -290,22 +290,20 @@ export default { return; } - layer.counters = { - displayedCount: 0, - }; + layer.displayedCount = 0; for (const pts of layer.group.children) { - layer.counters.displayedCount += pts.geometry.drawRange.count; + layer.displayedCount += pts.geometry.drawRange.count; } - if (layer.counters.displayedCount > layer.pointBudget) { - const reduction = layer.pointBudget / layer.counters.displayedCount; + if (layer.displayedCount > layer.pointBudget) { + const reduction = layer.pointBudget / layer.displayedCount; for (const pts of layer.group.children) { if (pts.material.visible) { const count = Math.max(1.0, Math.floor(pts.geometry.drawRange.count * reduction)); pts.geometry.setDrawRange(0, count); } } - layer.counters.displayedCount *= reduction; + layer.displayedCount *= reduction; } const now = Date.now();