make seeing voxels less noisy and more random

This commit is contained in:
ZappoMan 2014-03-17 13:47:46 -07:00
parent 07adfed6b4
commit 59b272d8db

View file

@ -20,6 +20,10 @@ var isLocal = false;
// set up our VoxelViewer with a position and orientation // set up our VoxelViewer with a position and orientation
var orientation = Quat.fromPitchYawRollDegrees(0, yaw, 0); var orientation = Quat.fromPitchYawRollDegrees(0, yaw, 0);
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function init() { function init() {
if (isLocal) { if (isLocal) {
MyAvatar.position = vantagePoint; MyAvatar.position = vantagePoint;
@ -39,21 +43,26 @@ function keepLooking(deltaTime) {
init(); init();
} }
count++; count++;
if (count % 10 == 0) { if (count % getRandomInt(5, 15) == 0) {
yaw += yawDirection; yaw += yawDirection;
orientation = Quat.fromPitchYawRollDegrees(0, yaw, 0); orientation = Quat.fromPitchYawRollDegrees(0, yaw, 0);
if (yaw > yawMax || yaw < yawMin) { if (yaw > yawMax || yaw < yawMin) {
yawDirection = yawDirection * -1; 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) { if (isLocal) {
MyAvatar.orientation = orientation; MyAvatar.orientation = orientation;
} else { } else {
VoxelViewer.setOrientation(orientation); VoxelViewer.setOrientation(orientation);
VoxelViewer.queryOctree(); VoxelViewer.queryOctree();
print("VoxelViewer.getOctreeElementsCount()=" + VoxelViewer.getOctreeElementsCount());
if (count % 10000 == 0) {
print("VoxelViewer.getOctreeElementsCount()=" + VoxelViewer.getOctreeElementsCount());
}
} }
} }