Merge branch 'master' of https://github.com/worklist/hifi into occlusion_culling

This commit is contained in:
ZappoMan 2013-07-11 09:46:10 -07:00
commit 5427b263f6
26 changed files with 100 additions and 78 deletions

View file

@ -10,14 +10,16 @@
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <OctalCode.h>
#include <iostream>
#include <EnvironmentData.h>
#include <NodeList.h>
#include <NodeTypes.h>
#include <EnvironmentData.h>
#include <VoxelTree.h>
#include <SharedUtil.h>
#include <OctalCode.h>
#include <PacketHeaders.h>
#include <SceneUtils.h>
#include <SharedUtil.h>
#include <VoxelTree.h>
#ifdef _WIN32
#include "Syssocket.h"
@ -643,14 +645,14 @@ void* animateVoxels(void* args) {
sendDanceFloor();
}
long long end = usecTimestampNow();
long long elapsedSeconds = (end - ::start) / 1000000;
uint64_t end = usecTimestampNow();
int elapsedSeconds = (end - ::start) / 1000000;
if (::shouldShowPacketsPerSecond) {
printf("packetsSent=%ld, bytesSent=%ld pps=%f bps=%f\n",packetsSent,bytesSent,
(float)(packetsSent/elapsedSeconds),(float)(bytesSent/elapsedSeconds));
}
// dynamically sleep until we need to fire off the next set of voxels
long long usecToSleep = ANIMATE_VOXELS_INTERVAL_USECS - (usecTimestampNow() - usecTimestamp(&lastSendTime));
uint64_t usecToSleep = ANIMATE_VOXELS_INTERVAL_USECS - (usecTimestampNow() - usecTimestamp(&lastSendTime));
if (usecToSleep > 0) {
usleep(usecToSleep);

View file

@ -47,7 +47,7 @@ const unsigned short MIXER_LISTEN_PORT = 55443;
const short JITTER_BUFFER_MSECS = 12;
const short JITTER_BUFFER_SAMPLES = JITTER_BUFFER_MSECS * (SAMPLE_RATE / 1000.0);
const long long BUFFER_SEND_INTERVAL_USECS = floorf((BUFFER_LENGTH_SAMPLES_PER_CHANNEL / SAMPLE_RATE) * 1000000);
const unsigned int BUFFER_SEND_INTERVAL_USECS = floorf((BUFFER_LENGTH_SAMPLES_PER_CHANNEL / SAMPLE_RATE) * 1000000);
const long MAX_SAMPLE_VALUE = std::numeric_limits<int16_t>::max();
const long MIN_SAMPLE_VALUE = std::numeric_limits<int16_t>::min();
@ -412,7 +412,7 @@ int main(int argc, const char* argv[]) {
numStatCollections++;
}
long long usecToSleep = usecTimestamp(&startTime) + (++nextFrame * BUFFER_SEND_INTERVAL_USECS) - usecTimestampNow();
int usecToSleep = usecTimestamp(&startTime) + (++nextFrame * BUFFER_SEND_INTERVAL_USECS) - usecTimestampNow();
if (usecToSleep > 0) {
usleep(usecToSleep);

View file

@ -159,7 +159,7 @@ int main(int argc, const char * argv[])
}
// update last receive to now
long long timeNow = usecTimestampNow();
uint64_t timeNow = usecTimestampNow();
newNode->setLastHeardMicrostamp(timeNow);
if (packetData[0] == PACKET_HEADER_DOMAIN_REPORT_FOR_DUTY

View file

@ -128,7 +128,7 @@ int main(int argc, const char* argv[]) {
broadcastPacket[0] = PACKET_HEADER_HEAD_DATA;
timeval thisSend;
long long numMicrosecondsSleep = 0;
int numMicrosecondsSleep = 0;
int handStateTimer = 0;

11
interface/external/Leap/readme.txt vendored Normal file
View file

@ -0,0 +1,11 @@
Instructions for adding the Leap driver to Interface
Eric Johnston, July 10, 2013
NOTE: Without doing step 2, you will crash at program start time.
1. Copy the Leap sdk folders (lib, include, etc.) into the interface/external/Leap folder. There should be a folder already there called "stub", and this read me.txt should be there as well.
2. IMPORTANT: Copy the file interface/external/Leap/lib/libc++/libLeap.dylib to /usr/lib
3. Delete your build directory, run cmake and build, and you should be all set.

View file

@ -906,7 +906,7 @@ void Application::wheelEvent(QWheelEvent* event) {
void Application::sendPingPackets() {
char nodeTypesOfInterest[] = {NODE_TYPE_VOXEL_SERVER, NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER};
long long currentTime = usecTimestampNow();
uint64_t currentTime = usecTimestampNow();
unsigned char pingPacket[1 + sizeof(currentTime)];
pingPacket[0] = PACKET_HEADER_PING;
@ -2250,6 +2250,15 @@ void Application::displayOculus(Camera& whichCamera) {
void Application::displaySide(Camera& whichCamera) {
// transform by eye offset
// flip x if in mirror mode (also requires reversing winding order for backface culling)
if (_lookingInMirror->isChecked()) {
glScalef(-1.0f, 1.0f, 1.0f);
glFrontFace(GL_CW);
} else {
glFrontFace(GL_CCW);
}
glm::vec3 eyeOffsetPos = whichCamera.getEyeOffsetPosition();
glm::quat eyeOffsetOrient = whichCamera.getEyeOffsetOrientation();
glm::vec3 eyeOffsetAxis = glm::axis(eyeOffsetOrient);
@ -2450,7 +2459,7 @@ void Application::displayOverlay() {
// Show on-screen msec timer
if (_renderFrameTimerOn->isChecked()) {
char frameTimer[10];
long long mSecsNow = floor(usecTimestampNow() / 1000.0 + 0.5);
uint64_t mSecsNow = floor(usecTimestampNow() / 1000.0 + 0.5);
sprintf(frameTimer, "%d\n", (int)(mSecsNow % 1000));
drawtext(_glWidget->width() - 100, _glWidget->height() - 20, 0.30, 0, 1.0, 0, frameTimer, 0, 0, 0);
drawtext(_glWidget->width() - 102, _glWidget->height() - 22, 0.30, 0, 1.0, 0, frameTimer, 1, 1, 1);

View file

@ -324,7 +324,7 @@ void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook, const glm::vec3& amplifyA
// Update torso lean distance based on accelerometer data
const float TORSO_LENGTH = 0.5f;
const float MAX_LEAN = 45.0f;
_head.setLeanSideways(glm::clamp(glm::degrees(atanf(-estimatedPosition.x * _leanScale / TORSO_LENGTH)),
_head.setLeanSideways(glm::clamp(glm::degrees(atanf(estimatedPosition.x * _leanScale / TORSO_LENGTH)),
-MAX_LEAN, MAX_LEAN));
_head.setLeanForward(glm::clamp(glm::degrees(atanf(estimatedPosition.z * _leanScale / TORSO_LENGTH)),
-MAX_LEAN, MAX_LEAN));
@ -1222,7 +1222,7 @@ void Avatar::renderBody(bool lookingInMirror, bool renderAvatarBalls) {
// Always render other people, and render myself when beyond threshold distance
if (b == BODY_BALL_HEAD_BASE) { // the head is rendered as a special
if (alpha > 0.0f) {
_head.render(lookingInMirror, alpha);
_head.render(alpha);
}
} else if (alpha > 0.0f) {
// Render the body ball sphere

View file

@ -67,7 +67,6 @@ Head::Head(Avatar* owningAvatar) :
_audioAttack(0.0f),
_returnSpringScale(1.0f),
_bodyRotation(0.0f, 0.0f, 0.0f),
_lookingInMirror(false),
_renderLookatVectors(false),
_mohawkTriangleFan(NULL),
_mohawkColors(NULL),
@ -283,11 +282,10 @@ void Head::calculateGeometry() {
}
void Head::render(bool lookingInMirror, float alpha) {
void Head::render(float alpha) {
_renderAlpha = alpha;
_lookingInMirror = lookingInMirror;
calculateGeometry();
glEnable(GL_DEPTH_TEST);
@ -375,8 +373,8 @@ void Head::renderMohawk() {
} else {
glPushMatrix();
glTranslatef(_position.x, _position.y, _position.z);
glRotatef((_lookingInMirror ? (_bodyRotation.y - _yaw) : (_bodyRotation.y + _yaw)), 0, 1, 0);
glRotatef(_lookingInMirror ? _roll: -_roll, 0, 0, 1);
glRotatef(_bodyRotation.y + _yaw, 0, 1, 0);
glRotatef(-_roll, 0, 0, 1);
glRotatef(-_pitch - _bodyRotation.x, 1, 0, 0);
glBegin(GL_TRIANGLE_FAN);
@ -391,8 +389,7 @@ void Head::renderMohawk() {
}
glm::quat Head::getOrientation() const {
return glm::quat(glm::radians(_bodyRotation)) * glm::quat(glm::radians(_lookingInMirror ?
glm::vec3(_pitch, -_yaw, -_roll) : glm::vec3(_pitch, _yaw, _roll)));
return glm::quat(glm::radians(_bodyRotation)) * glm::quat(glm::radians(glm::vec3(_pitch, _yaw, _roll)));
}
glm::quat Head::getCameraOrientation () const {

View file

@ -35,7 +35,7 @@ public:
void init();
void reset();
void simulate(float deltaTime, bool isMine);
void render(bool lookingInMirror, float alpha);
void render(float alpha);
void renderMohawk();
void setScale (float scale ) { _scale = scale; }
@ -102,7 +102,6 @@ private:
float _audioAttack;
float _returnSpringScale; //strength of return springs
glm::vec3 _bodyRotation;
bool _lookingInMirror;
bool _renderLookatVectors;
HairTuft _hairTuft[NUM_HAIR_TUFTS];
glm::vec3* _mohawkTriangleFan;

View file

@ -169,15 +169,15 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) {
void VoxelSystem::setupNewVoxelsForDrawing() {
PerformanceWarning warn(_renderWarningsOn, "setupNewVoxelsForDrawing()"); // would like to include _voxelsInArrays, _voxelsUpdated
long long start = usecTimestampNow();
long long sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000;
uint64_t start = usecTimestampNow();
int sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000;
bool iAmDebugging = false; // if you're debugging set this to true, so you won't get skipped for slow debugging
if (!iAmDebugging && sinceLastTime <= std::max(_setupNewVoxelsForDrawingLastElapsed, SIXTY_FPS_IN_MILLISECONDS)) {
return; // bail early, it hasn't been long enough since the last time we ran
}
long long sinceLastViewCulling = (start - _lastViewCulling) / 1000;
int sinceLastViewCulling = (start - _lastViewCulling) / 1000;
// If the view frustum is no longer changing, but has changed, since last time, then remove nodes that are out of view
if ((sinceLastViewCulling >= std::max(_lastViewCullingElapsed, VIEW_CULLING_RATE_IN_MILLISECONDS))
&& !isViewChanging() && hasViewChanged()) {
@ -193,7 +193,7 @@ void VoxelSystem::setupNewVoxelsForDrawing() {
// VBO reubuilding. Possibly we should do this only if our actual VBO usage crosses some lower boundary.
cleanupRemovedVoxels();
long long endViewCulling = usecTimestampNow();
uint64_t endViewCulling = usecTimestampNow();
_lastViewCullingElapsed = (endViewCulling - start) / 1000;
}
@ -230,8 +230,8 @@ void VoxelSystem::setupNewVoxelsForDrawing() {
pthread_mutex_unlock(&_bufferWriteLock);
long long end = usecTimestampNow();
long long elapsedmsec = (end - start) / 1000;
uint64_t end = usecTimestampNow();
int elapsedmsec = (end - start) / 1000;
_setupNewVoxelsForDrawingLastFinished = end;
_setupNewVoxelsForDrawingLastElapsed = elapsedmsec;
}

View file

@ -191,8 +191,8 @@ void Webcam::setFrame(const Mat& frame, int format, const Mat& depth, const Rota
const int MAX_FPS = 60;
const int MIN_FRAME_DELAY = 1000000 / MAX_FPS;
long long now = usecTimestampNow();
long long remaining = MIN_FRAME_DELAY;
uint64_t now = usecTimestampNow();
int remaining = MIN_FRAME_DELAY;
if (_startTimestamp == 0) {
_startTimestamp = now;
} else {

View file

@ -73,10 +73,10 @@ private:
cv::RotatedRect _initialFaceRect;
JointVector _joints;
long long _startTimestamp;
uint64_t _startTimestamp;
int _frameCount;
long long _lastFrameTimestamp;
uint64_t _lastFrameTimestamp;
glm::vec3 _estimatedPosition;
glm::vec3 _estimatedRotation;

View file

@ -115,7 +115,7 @@ void AudioInjector::injectAudio(UDPSocket* injectorSocket, sockaddr* destination
injectorSocket->send(destinationSocket, dataPacket, sizeof(dataPacket));
long long usecToSleep = usecTimestamp(&startTime) + (++nextFrame * INJECT_INTERVAL_USECS) - usecTimestampNow();
int usecToSleep = usecTimestamp(&startTime) + (++nextFrame * INJECT_INTERVAL_USECS) - usecTimestampNow();
if (usecToSleep > 0) {
usleep(usecToSleep);
}

View file

@ -21,7 +21,7 @@ const int STREAM_IDENTIFIER_NUM_BYTES = 8;
const int MAX_INJECTOR_VOLUME = 0xFF;
const long long INJECT_INTERVAL_USECS = floorf((BUFFER_LENGTH_SAMPLES_PER_CHANNEL / SAMPLE_RATE) * 1000000);
const int INJECT_INTERVAL_USECS = floorf((BUFFER_LENGTH_SAMPLES_PER_CHANNEL / SAMPLE_RATE) * 1000000);
class AudioInjector {
public:

View file

@ -37,11 +37,11 @@ public:
uint16_t getNodeID() const { return _nodeID; }
void setNodeID(uint16_t nodeID) { _nodeID = nodeID;}
long long getWakeMicrostamp() const { return _wakeMicrostamp; }
void setWakeMicrostamp(long long wakeMicrostamp) { _wakeMicrostamp = wakeMicrostamp; }
uint64_t getWakeMicrostamp() const { return _wakeMicrostamp; }
void setWakeMicrostamp(uint64_t wakeMicrostamp) { _wakeMicrostamp = wakeMicrostamp; }
long long getLastHeardMicrostamp() const { return _lastHeardMicrostamp; }
void setLastHeardMicrostamp(long long lastHeardMicrostamp) { _lastHeardMicrostamp = lastHeardMicrostamp; }
uint64_t getLastHeardMicrostamp() const { return _lastHeardMicrostamp; }
void setLastHeardMicrostamp(uint64_t lastHeardMicrostamp) { _lastHeardMicrostamp = lastHeardMicrostamp; }
sockaddr* getPublicSocket() const { return _publicSocket; }
void setPublicSocket(sockaddr* publicSocket) { _publicSocket = publicSocket; }
@ -74,8 +74,8 @@ private:
char _type;
uint16_t _nodeID;
long long _wakeMicrostamp;
long long _lastHeardMicrostamp;
uint64_t _wakeMicrostamp;
uint64_t _lastHeardMicrostamp;
sockaddr* _publicSocket;
sockaddr* _localSocket;
sockaddr* _activeSocket;

View file

@ -81,7 +81,7 @@ void NodeList::timePingReply(sockaddr *nodeAddress, unsigned char *packetData) {
for(NodeList::iterator node = begin(); node != end(); node++) {
if (socketMatch(node->getPublicSocket(), nodeAddress) ||
socketMatch(node->getLocalSocket(), nodeAddress)) {
int pingTime = usecTimestampNow() - *(long long *)(packetData + 1);
int pingTime = usecTimestampNow() - *(uint64_t *)(packetData + 1);
node->setPingMs(pingTime / 1000);
break;
}
@ -422,7 +422,7 @@ void *pingUnknownNodes(void *args) {
}
}
long long usecToSleep = PING_INTERVAL_USECS - (usecTimestampNow() - usecTimestamp(&lastSend));
int usecToSleep = PING_INTERVAL_USECS - (usecTimestampNow() - usecTimestamp(&lastSend));
if (usecToSleep > 0) {
usleep(usecToSleep);
@ -443,7 +443,8 @@ void NodeList::stopPingUnknownNodesThread() {
void *removeSilentNodes(void *args) {
NodeList* nodeList = (NodeList*) args;
long long checkTimeUSecs, sleepTime;
uint64_t checkTimeUSecs;
int sleepTime;
while (!silentNodeThreadStopFlag) {
checkTimeUSecs = usecTimestampNow();

View file

@ -105,7 +105,7 @@ int PerfStat::DumpStats(char** array) {
// Destructor handles recording all of our stats
PerformanceWarning::~PerformanceWarning() {
long long end = usecTimestampNow();
uint64_t end = usecTimestampNow();
double elapsedmsec = (end - _start) / 1000.0;
if ((_alwaysDisplay || _renderWarningsOn) && elapsedmsec > 1) {
if (elapsedmsec > 1000) {

View file

@ -85,7 +85,7 @@ typedef std::map<std::string,PerfStatHistory,std::less<std::string> >::iterator
class PerformanceWarning {
private:
long long _start;
uint64_t _start;
const char* _message;
bool _renderWarningsOn;
bool _alwaysDisplay;

View file

@ -22,11 +22,11 @@
#include <CoreFoundation/CoreFoundation.h>
#endif
long long usecTimestamp(timeval *time) {
uint64_t usecTimestamp(timeval *time) {
return (time->tv_sec * 1000000 + time->tv_usec);
}
long long usecTimestampNow() {
uint64_t usecTimestampNow() {
timeval now;
gettimeofday(&now, NULL);
return (now.tv_sec * 1000000 + now.tv_usec);

View file

@ -36,8 +36,8 @@ static const float DECIMETER = 0.1f;
static const float CENTIMETER = 0.01f;
static const float MILLIIMETER = 0.001f;
long long usecTimestamp(timeval *time);
long long usecTimestampNow();
uint64_t usecTimestamp(timeval *time);
uint64_t usecTimestampNow();
float randFloat();
int randIntInRange (int min, int max);

View file

@ -11,7 +11,7 @@
#ifndef __hifi__Stats__
#define __hifi__Stats__
#include <iostream>
#include <stdint.h>
class SimpleMovingAverage {
public:
@ -26,7 +26,7 @@ public:
float getAverageSampleValuePerSecond();
private:
int _numSamples;
long long _lastEventTimestamp;
uint64_t _lastEventTimestamp;
float _average;
float _eventDeltaAverage;

View file

@ -3,12 +3,15 @@
// hifi
//
// Created by Brad Hefta-Gaub on 5/7/2013.
//
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
//
#include "SceneUtils.h"
#include <algorithm>
#include <glm/gtc/noise.hpp>
#include "SceneUtils.h"
void addCornersAndAxisLines(VoxelTree* tree) {
// We want our corner voxels to be about 1/2 meter high, and our TREE_SCALE is in meters, so...
float voxelSize = 0.5f / TREE_SCALE;

View file

@ -3,12 +3,15 @@
// hifi
//
// Created by Tomáš Horáček on 6/25/13.
//
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
//
#include "SquarePixelMap.h"
#include <string.h>
#include <algorithm>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "SquarePixelMap.h"
#define CHILD_COORD_X_IS_1 0x1
#define CHILD_COORD_Y_IS_1 0x2

View file

@ -29,7 +29,7 @@ private:
#endif
glBufferIndex _glBufferIndex;
bool _isDirty;
long long _lastChanged;
uint64_t _lastChanged;
bool _shouldRender;
bool _isStagedForDeletion;
AABox _box;
@ -80,7 +80,7 @@ public:
void printDebugDetails(const char* label) const;
bool isDirty() const { return _isDirty; };
void clearDirtyBit() { _isDirty = false; };
bool hasChangedSince(long long time) const { return (_lastChanged > time); };
bool hasChangedSince(uint64_t time) const { return (_lastChanged > time); };
void markWithChangedTime() { _lastChanged = usecTimestampNow(); };
void handleSubtreeChanged(VoxelTree* myTree);

View file

@ -50,8 +50,8 @@ public:
bool getViewSent() const { return _viewSent; };
void setViewSent(bool viewSent) { _viewSent = viewSent; }
long long getLastTimeBagEmpty() const { return _lastTimeBagEmpty; };
void setLastTimeBagEmpty(long long lastTimeBagEmpty) { _lastTimeBagEmpty = lastTimeBagEmpty; };
uint64_t getLastTimeBagEmpty() const { return _lastTimeBagEmpty; };
void setLastTimeBagEmpty(uint64_t lastTimeBagEmpty) { _lastTimeBagEmpty = lastTimeBagEmpty; };
private:
VoxelNodeData(const VoxelNodeData &);
@ -66,9 +66,8 @@ private:
int _maxLevelReachedInLastSearch;
ViewFrustum _currentViewFrustum;
ViewFrustum _lastKnownViewFrustum;
long long _lastTimeBagEmpty;
uint64_t _lastTimeBagEmpty;
bool _viewFrustumChanging;
};
#endif /* defined(__hifi__VoxelNodeData__) */

View file

@ -32,7 +32,7 @@
const char* LOCAL_VOXELS_PERSIST_FILE = "resources/voxels.svo";
const char* VOXELS_PERSIST_FILE = "/etc/highfidelity/voxel-server/resources/voxels.svo";
const long long VOXEL_PERSIST_INTERVAL = 1000 * 30; // every 30 seconds
const int VOXEL_PERSIST_INTERVAL = 1000 * 30; // every 30 seconds
const int VOXEL_LISTEN_PORT = 40106;
@ -110,8 +110,6 @@ void eraseVoxelTreeAndCleanupNodeVisitData() {
}
}
pthread_mutex_t treeLock;
// Version of voxel distributor that sends the deepest LOD level at once
@ -124,7 +122,7 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
pthread_mutex_lock(&::treeLock);
int maxLevelReached = 0;
long long start = usecTimestampNow();
uint64_t start = usecTimestampNow();
// FOR NOW... node tells us if it wants to receive only view frustum deltas
bool wantDelta = viewFrustumChanged && nodeData->getWantDelta();
@ -145,7 +143,7 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
if (::debugVoxelSending) {
printf("(viewFrustumChanged=%s || nodeData->nodeBag.isEmpty() =%s)...\n",
debug::valueOf(viewFrustumChanged), debug::valueOf(nodeData->nodeBag.isEmpty()));
long long now = usecTimestampNow();
uint64_t now = usecTimestampNow();
if (nodeData->getLastTimeBagEmpty() > 0) {
float elapsedSceneSend = (now - nodeData->getLastTimeBagEmpty()) / 1000000.0f;
if (viewFrustumChanged) {
@ -182,7 +180,7 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
nodeData->nodeBag.insert(serverTree.rootNode);
}
}
long long end = usecTimestampNow();
uint64_t end = usecTimestampNow();
int elapsedmsec = (end - start)/1000;
if (elapsedmsec > 100) {
if (elapsedmsec > 1000) {
@ -205,12 +203,12 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
int packetsSentThisInterval = 0;
int truePacketsSent = 0;
int trueBytesSent = 0;
long long start = usecTimestampNow();
uint64_t start = usecTimestampNow();
bool shouldSendEnvironments = shouldDo(ENVIRONMENT_SEND_INTERVAL_USECS, VOXEL_SEND_INTERVAL_USECS);
while (packetsSentThisInterval < PACKETS_PER_CLIENT_PER_INTERVAL - (shouldSendEnvironments ? 1 : 0)) {
// Check to see if we're taking too long, and if so bail early...
long long now = usecTimestampNow();
uint64_t now = usecTimestampNow();
long elapsedUsec = (now - start);
long elapsedUsecPerPacket = (truePacketsSent == 0) ? 0 : (elapsedUsec / truePacketsSent);
long usecRemaining = (VOXEL_SEND_INTERVAL_USECS - elapsedUsec);
@ -275,7 +273,7 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
truePacketsSent++;
}
long long end = usecTimestampNow();
uint64_t end = usecTimestampNow();
int elapsedmsec = (end - start)/1000;
if (elapsedmsec > 100) {
if (elapsedmsec > 1000) {
@ -307,10 +305,10 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
pthread_mutex_unlock(&::treeLock);
}
long long lastPersistVoxels = 0;
uint64_t lastPersistVoxels = 0;
void persistVoxelsWhenDirty() {
long long now = usecTimestampNow();
long long sinceLastTime = (now - ::lastPersistVoxels) / 1000;
uint64_t now = usecTimestampNow();
int sinceLastTime = (now - ::lastPersistVoxels) / 1000;
// check the dirty bit and persist here...
if (::wantVoxelPersist && ::serverTree.isDirty() && sinceLastTime > VOXEL_PERSIST_INTERVAL) {
@ -350,7 +348,7 @@ void *distributeVoxelsToListeners(void *args) {
}
// dynamically sleep until we need to fire off the next set of voxels
long long usecToSleep = VOXEL_SEND_INTERVAL_USECS - (usecTimestampNow() - usecTimestamp(&lastSendTime));
int usecToSleep = VOXEL_SEND_INTERVAL_USECS - (usecTimestampNow() - usecTimestamp(&lastSendTime));
if (usecToSleep > 0) {
usleep(usecToSleep);