mirror of
https://github.com/overte-org/overte.git
synced 2025-06-07 22:12:33 +02:00
make seeing voxels less noisy and more random
This commit is contained in:
parent
07adfed6b4
commit
59b272d8db
1 changed files with 12 additions and 3 deletions
|
@ -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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue