From 59b272d8db467a005e9908cf64c7fbf97fc47e8c Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 17 Mar 2014 13:47:46 -0700 Subject: [PATCH] make seeing voxels less noisy and more random --- examples/seeingVoxelsExample.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/seeingVoxelsExample.js b/examples/seeingVoxelsExample.js index 330634f5af..0cfe54d89e 100644 --- a/examples/seeingVoxelsExample.js +++ b/examples/seeingVoxelsExample.js @@ -20,6 +20,10 @@ var isLocal = false; // set up our VoxelViewer with a position and orientation var orientation = Quat.fromPitchYawRollDegrees(0, yaw, 0); +function getRandomInt(min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min; +} + function init() { if (isLocal) { MyAvatar.position = vantagePoint; @@ -39,21 +43,26 @@ function keepLooking(deltaTime) { init(); } count++; - if (count % 10 == 0) { + if (count % getRandomInt(5, 15) == 0) { yaw += yawDirection; orientation = Quat.fromPitchYawRollDegrees(0, yaw, 0); if (yaw > yawMax || yaw < yawMin) { yawDirection = yawDirection * -1; } - print("calling VoxelViewer.queryOctree()... count=" + count + " yaw=" + yaw); + if (count % 10000 == 0) { + print("calling VoxelViewer.queryOctree()... count=" + count + " yaw=" + yaw); + } if (isLocal) { MyAvatar.orientation = orientation; } else { VoxelViewer.setOrientation(orientation); VoxelViewer.queryOctree(); - print("VoxelViewer.getOctreeElementsCount()=" + VoxelViewer.getOctreeElementsCount()); + + if (count % 10000 == 0) { + print("VoxelViewer.getOctreeElementsCount()=" + VoxelViewer.getOctreeElementsCount()); + } } }