mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
more windows port
This commit is contained in:
parent
d70da7f215
commit
9ae11ffe77
22 changed files with 16085 additions and 45 deletions
|
@ -28,8 +28,8 @@
|
|||
#include "SharedUtil.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Syssocket.h"
|
||||
#include "Systime.h"
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
|
|
@ -65,14 +65,24 @@ include_directories(
|
|||
)
|
||||
|
||||
# link target to external libraries
|
||||
target_link_libraries(interface
|
||||
if (WIN32)
|
||||
target_link_libraries(interface
|
||||
${OPENGL_LIBRARY}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/glut/Release/glew32.lib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/glut/Release/freeglut.lib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/glut/Release/pthread_lib.lib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/glut/Release/lodepng.lib
|
||||
wsock32.lib
|
||||
)
|
||||
else (WIN32)
|
||||
target_link_libraries(interface
|
||||
${OPENGL_LIBRARY}
|
||||
${GLUT_LIBRARY}
|
||||
${LODEPNG_LIBRARY}
|
||||
)
|
||||
)
|
||||
endif (WIN32)
|
||||
|
||||
if (WIN32)
|
||||
else (WIN32)
|
||||
if (NOT WIN32)
|
||||
# include PortAudio as external project
|
||||
include(ExternalProject)
|
||||
set(PORTAUDIO_PROJ_DIR external/portaudio)
|
||||
|
@ -96,7 +106,7 @@ else (WIN32)
|
|||
ExternalProject_Get_Property(portaudio binary_dir)
|
||||
target_link_libraries(interface ${binary_dir}/lib/.libs/libportaudio.a)
|
||||
|
||||
endif (WIN32)
|
||||
endif (NOT WIN32)
|
||||
|
||||
# link required libraries on UNIX
|
||||
if (UNIX AND NOT APPLE)
|
||||
|
|
BIN
interface/external/glut/Release/lodepng.lib
vendored
Normal file
BIN
interface/external/glut/Release/lodepng.lib
vendored
Normal file
Binary file not shown.
BIN
interface/external/glut/Release/lodepngd.lib
vendored
Normal file
BIN
interface/external/glut/Release/lodepngd.lib
vendored
Normal file
Binary file not shown.
BIN
interface/external/glut/Release/pthread_lib.lib
vendored
BIN
interface/external/glut/Release/pthread_lib.lib
vendored
Binary file not shown.
2
interface/external/glut/include/pthread.h
vendored
2
interface/external/glut/include/pthread.h
vendored
|
@ -33,6 +33,8 @@
|
|||
#if !defined( PTHREAD_H )
|
||||
#define PTHREAD_H
|
||||
|
||||
#define PTW32_STATIC_LIB
|
||||
|
||||
/*
|
||||
* See the README file for an explanation of the pthreads-win32 version
|
||||
* numbering scheme and how the DLL is named etc.
|
||||
|
|
|
@ -5,22 +5,17 @@
|
|||
// Created by Stephen Birarda on 1/22/13.
|
||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Systime.h"
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <cstring>
|
||||
#include <SharedUtil.h>
|
||||
#include <StdDev.h>
|
||||
#include <UDPSocket.h>
|
||||
#include <SharedUtil.h>
|
||||
#include "Audio.h"
|
||||
#include "Util.h"
|
||||
|
||||
|
@ -578,3 +573,4 @@ error:
|
|||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#define __interface__Audio__
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <portaudio.h>
|
||||
#include "AudioData.h"
|
||||
#include "Oscilloscope.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
// Created by Stephen Birarda on 1/29/13.
|
||||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||
//
|
||||
#ifndef _WIN32
|
||||
|
||||
#include "AudioData.h"
|
||||
|
||||
|
@ -24,4 +25,6 @@ AudioData::AudioData() {
|
|||
|
||||
AudioData::~AudioData() {
|
||||
delete audioSocket;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -101,9 +101,9 @@ int SerialInterface::init(char* portname, int baud)
|
|||
printf("Serial interface opened!\n");
|
||||
resetSerial();
|
||||
active = true;
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Reset Trailing averages to the current measurement
|
||||
|
|
15955
interface/src/glew.cpp
Normal file
15955
interface/src/glew.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -24,8 +24,8 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Syssocket.h"
|
||||
#include "Systime.h"
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <arpa/inet.h>
|
||||
|
@ -38,7 +38,9 @@
|
|||
#include "Field.h"
|
||||
#include "world.h"
|
||||
#include "Util.h"
|
||||
#ifndef _WIN32
|
||||
#include "Audio.h"
|
||||
#endif
|
||||
#include "Head.h"
|
||||
#include "Hand.h"
|
||||
#include "Particle.h"
|
||||
|
@ -98,12 +100,12 @@ glm::vec3 box(WORLD_SIZE,WORLD_SIZE,WORLD_SIZE);
|
|||
ParticleSystem balls(0,
|
||||
box,
|
||||
false, // Wrap?
|
||||
0.02, // Noise
|
||||
0.3, // Size scale
|
||||
0.02f, // Noise
|
||||
0.3f, // Size scale
|
||||
0.0 // Gravity
|
||||
);
|
||||
|
||||
Cloud cloud(0, // Particles
|
||||
Cloud cloud(20000, // Particles
|
||||
box, // Bounding Box
|
||||
false // Wrap
|
||||
);
|
||||
|
@ -114,7 +116,9 @@ Lattice lattice(160,100);
|
|||
Finger myFinger(WIDTH, HEIGHT);
|
||||
Field field;
|
||||
|
||||
#ifndef _WIN32
|
||||
Audio audio(&audioScope, &myHead);
|
||||
#endif
|
||||
|
||||
#define RENDER_FRAME_MSECS 8
|
||||
int steps_per_frame = 0;
|
||||
|
@ -132,7 +136,7 @@ GLfloat fwd_vec[] = {0.0, 0.0, 1.0};
|
|||
//GLfloat start_location[] = { WORLD_SIZE*1.5, -WORLD_SIZE/2.0, -WORLD_SIZE/3.0};
|
||||
//GLfloat start_location[] = { 0.1, -0.15, 0.1};
|
||||
|
||||
GLfloat start_location[] = {6.1, 0, 1.4};
|
||||
GLfloat start_location[] = {6.1f, 0, 1.4f};
|
||||
|
||||
GLfloat location[] = {start_location[0], start_location[1], start_location[2]};
|
||||
float fwd_vel = 0.0f;
|
||||
|
@ -247,7 +251,7 @@ void Timer(int extra)
|
|||
// agentSocket.send((char *)"192.168.1.38", AGENT_UDP_PORT, junk, 1000);
|
||||
}
|
||||
gettimeofday(&endtest, NULL);
|
||||
float sendTime = diffclock(&starttest, &endtest);
|
||||
float sendTime = static_cast<float>( diffclock(&starttest, &endtest) );
|
||||
printf("packet test = %4.1f\n", sendTime);
|
||||
}
|
||||
|
||||
|
@ -261,16 +265,16 @@ void display_stats(void)
|
|||
{
|
||||
// bitmap chars are about 10 pels high
|
||||
char legend[] = "/ - toggle this display, Q - exit, H - show head, M - show hand, T - test audio";
|
||||
drawtext(10, 15, 0.10, 0, 1.0, 0, legend);
|
||||
drawtext(10, 15, 0.10f, 0, 1.0, 0, legend);
|
||||
|
||||
char stats[200];
|
||||
sprintf(stats, "FPS = %3.0f Pkts/s = %d Bytes/s = %d ",
|
||||
FPS, packets_per_second, bytes_per_second);
|
||||
drawtext(10, 30, 0.10, 0, 1.0, 0, stats);
|
||||
drawtext(10, 30, 0.10f, 0, 1.0, 0, stats);
|
||||
if (serialPort.active) {
|
||||
sprintf(stats, "ADC samples = %d, LED = %d",
|
||||
serialPort.getNumSamples(), serialPort.getLED());
|
||||
drawtext(300, 30, 0.10, 0, 1.0, 0, stats);
|
||||
drawtext(300, 30, 0.10f, 0, 1.0, 0, stats);
|
||||
}
|
||||
|
||||
// Output the ping times to the various agents
|
||||
|
@ -283,7 +287,7 @@ void display_stats(void)
|
|||
|
||||
std::stringstream voxelStats;
|
||||
voxelStats << "Voxels Rendered: " << voxels.getVoxelsRendered();
|
||||
drawtext(10,70,0.10, 0, 1.0, 0, (char *)voxelStats.str().c_str());
|
||||
drawtext(10,70,0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
|
||||
|
||||
|
||||
/*
|
||||
|
@ -364,7 +368,9 @@ void terminate () {
|
|||
// Close serial port
|
||||
//close(serial_fd);
|
||||
|
||||
#ifndef _WIN32
|
||||
audio.terminate();
|
||||
#endif
|
||||
stopNetworkReceiveThread = true;
|
||||
pthread_join(networkReceiveThread, NULL);
|
||||
|
||||
|
@ -426,7 +432,7 @@ void simulateHead(float frametime)
|
|||
|
||||
// Update head_mouse model
|
||||
const float MIN_MOUSE_RATE = 30.0;
|
||||
const float MOUSE_SENSITIVITY = 0.1;
|
||||
const float MOUSE_SENSITIVITY = 0.1f;
|
||||
if (powf(measured_yaw_rate*measured_yaw_rate +
|
||||
measured_pitch_rate*measured_pitch_rate, 0.5) > MIN_MOUSE_RATE)
|
||||
{
|
||||
|
@ -522,9 +528,11 @@ void simulateHead(float frametime)
|
|||
|
||||
// Get audio loudness data from audio input device
|
||||
float loudness, averageLoudness;
|
||||
#ifndef _WIN32
|
||||
audio.getInputLoudness(&loudness, &averageLoudness);
|
||||
myHead.setLoudness(loudness);
|
||||
myHead.setAverageLoudness(averageLoudness);
|
||||
#endif
|
||||
|
||||
// Send my streaming head data to agents that are nearby and need to see it!
|
||||
const int MAX_BROADCAST_STRING = 200;
|
||||
|
@ -623,8 +631,10 @@ void display(void)
|
|||
|
||||
// lattice.render(WIDTH, HEIGHT);
|
||||
// myFinger.render();
|
||||
#ifndef _WIN32
|
||||
audio.render(WIDTH, HEIGHT);
|
||||
if (audioScope.getState()) audioScope.render();
|
||||
#endif
|
||||
|
||||
|
||||
//drawvec3(100, 100, 0.15, 0, 1.0, 0, myHead.getPos(), 0, 1, 0);
|
||||
|
@ -725,7 +735,9 @@ void key(unsigned char k, int x, int y)
|
|||
|
||||
if (k == 'h') {
|
||||
display_head = !display_head;
|
||||
#ifndef _WIN32
|
||||
audio.setMixerLoopbackFlag(display_head);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (k == 'm') head_mirror = !head_mirror;
|
||||
|
@ -781,6 +793,7 @@ void *networkReceive(void *args)
|
|||
}
|
||||
|
||||
pthread_exit(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void idle(void)
|
||||
|
@ -880,9 +893,11 @@ void attachNewHeadToAgent(Agent *newAgent) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
void audioMixerUpdate(in_addr_t newMixerAddress, in_port_t newMixerPort) {
|
||||
audio.updateMixerParams(newMixerAddress, newMixerPort);
|
||||
}
|
||||
#endif
|
||||
|
||||
void voxelServerAddCallback(sockaddr *voxelServerAddress) {
|
||||
char voxelAsk[] = "I";
|
||||
|
@ -892,6 +907,7 @@ void voxelServerAddCallback(sockaddr *voxelServerAddress) {
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
struct ifaddrs * ifAddrStruct=NULL;
|
||||
struct ifaddrs * ifa=NULL;
|
||||
|
||||
|
@ -903,7 +919,7 @@ int main(int argc, char** argv)
|
|||
localAddress = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
// Lookup the IP address of things we have hostnames
|
||||
if (atoi(DOMAIN_IP) == 0) {
|
||||
struct hostent* pHostInfo;
|
||||
|
@ -920,17 +936,28 @@ int main(int argc, char** argv)
|
|||
|
||||
// the callback for our instance of AgentList is attachNewHeadToAgent
|
||||
agentList.linkedDataCreateCallback = &attachNewHeadToAgent;
|
||||
#ifndef _WIN32
|
||||
agentList.audioMixerSocketUpdate = &audioMixerUpdate;
|
||||
#endif
|
||||
agentList.voxelServerAddCallback = &voxelServerAddCallback;
|
||||
|
||||
// start the thread which checks for silent agents
|
||||
agentList.startSilentAgentRemovalThread();
|
||||
|
||||
#ifdef _WIN32
|
||||
WSADATA WsaData;
|
||||
int wsaresult = WSAStartup( MAKEWORD(2,2), &WsaData );
|
||||
#endif
|
||||
|
||||
glutInit(&argc, argv);
|
||||
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutInitWindowSize(WIDTH, HEIGHT);
|
||||
glutCreateWindow("Interface");
|
||||
|
||||
#ifdef _WIN32
|
||||
glewInit();
|
||||
#endif
|
||||
|
||||
printf( "Created Display Window.\n" );
|
||||
|
||||
initDisplay();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#ifndef _WIN32
|
||||
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
@ -14,8 +16,9 @@
|
|||
#include "AudioRingBuffer.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Syssocket.h"
|
||||
#include "Systime.h"
|
||||
#include <winsock2.h>
|
||||
#include <math.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -28,7 +31,7 @@ const unsigned short MIXER_LISTEN_PORT = 55443;
|
|||
const float SAMPLE_RATE = 22050.0;
|
||||
|
||||
const short JITTER_BUFFER_MSECS = 5;
|
||||
const short JITTER_BUFFER_SAMPLES = JITTER_BUFFER_MSECS * (SAMPLE_RATE / 1000.0);
|
||||
const short JITTER_BUFFER_SAMPLES = JITTER_BUFFER_MSECS * (SAMPLE_RATE / 1000.0f);
|
||||
|
||||
const int BUFFER_LENGTH_BYTES = 1024;
|
||||
const int BUFFER_LENGTH_SAMPLES_PER_CHANNEL = (BUFFER_LENGTH_BYTES / 2) / sizeof(int16_t);
|
||||
|
@ -41,8 +44,8 @@ const float BUFFER_SEND_INTERVAL_USECS = (BUFFER_LENGTH_SAMPLES_PER_CHANNEL / SA
|
|||
const long MAX_SAMPLE_VALUE = std::numeric_limits<int16_t>::max();
|
||||
const long MIN_SAMPLE_VALUE = std::numeric_limits<int16_t>::min();
|
||||
|
||||
const float DISTANCE_RATIO = 3.0/4.2;
|
||||
const float PHASE_AMPLITUDE_RATIO_AT_90 = 0.5;
|
||||
const float DISTANCE_RATIO = 3.0f/4.2f;
|
||||
const float PHASE_AMPLITUDE_RATIO_AT_90 = 0.5f;
|
||||
const int PHASE_DELAY_AT_90 = 20;
|
||||
|
||||
|
||||
|
@ -346,3 +349,11 @@ int main(int argc, const char * argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif _WIN32
|
|
@ -12,7 +12,7 @@
|
|||
#include "SharedUtil.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include "Syssocket.h"
|
||||
#else
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "AgentData.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include "Syssocket.h"
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "SharedUtil.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include "Syssocket.h"
|
||||
#else
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
@ -245,10 +245,15 @@ void *removeSilentAgents(void *args) {
|
|||
|
||||
|
||||
sleepTime = AGENT_SILENCE_THRESHOLD_USECS - (usecTimestampNow() - checkTimeUSecs);
|
||||
#ifdef _WIN32
|
||||
Sleep( static_cast<int>(1000.0f*sleepTime) );
|
||||
#else
|
||||
usleep(sleepTime);
|
||||
#endif
|
||||
}
|
||||
|
||||
pthread_exit(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void AgentList::startSilentAgentRemovalThread() {
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
#include "Agent.h"
|
||||
#include "UDPSocket.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "pthread.h"
|
||||
#endif
|
||||
|
||||
const int MAX_PACKET_SIZE = 1500;
|
||||
const unsigned short AGENT_SOCKET_LISTEN_PORT = 40103;
|
||||
const int AGENT_SILENCE_THRESHOLD_USECS = 2 * 1000000;
|
||||
|
|
17
shared/src/Syssocket.h
Normal file
17
shared/src/Syssocket.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef __Syssocket__
|
||||
#define __Syssocket__
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WINSOCK_API_LINKAGE
|
||||
#include <winsock2.h>
|
||||
#define _timeval_
|
||||
|
||||
typedef SSIZE_T ssize_t;
|
||||
typedef ULONG32 in_addr_t;
|
||||
typedef USHORT in_port_t;
|
||||
typedef USHORT uint16_t;
|
||||
typedef ULONG32 socklen_t;
|
||||
|
||||
#endif _Win32
|
||||
|
||||
#endif __Syssocket__
|
|
@ -24,5 +24,4 @@ int gettimeofday( struct timeval* p_tv, struct timezone* p_tz );
|
|||
|
||||
#endif _Win32
|
||||
|
||||
|
||||
#endif __Systime__
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include "Syssocket.h"
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
|
@ -96,7 +96,11 @@ UDPSocket::UDPSocket(int listeningPort) {
|
|||
}
|
||||
|
||||
UDPSocket::~UDPSocket() {
|
||||
#ifdef _WIN32
|
||||
closesocket(handle);
|
||||
#else
|
||||
close(handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Receive data on this socket with retrieving address of sender
|
||||
|
@ -110,8 +114,8 @@ bool UDPSocket::receive(sockaddr *recvAddress, void *receivedData, ssize_t *rece
|
|||
|
||||
socklen_t addressSize = sizeof(&recvAddress);
|
||||
|
||||
*receivedBytes = recvfrom(handle, receivedData, MAX_BUFFER_LENGTH_BYTES,
|
||||
0, recvAddress, &addressSize);
|
||||
*receivedBytes = recvfrom(handle, static_cast<char*>(receivedData), MAX_BUFFER_LENGTH_BYTES,
|
||||
0, recvAddress, reinterpret_cast<int*>(&addressSize));
|
||||
|
||||
return (*receivedBytes > 0);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include "Syssocket.h"
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
|
|
|
@ -11,19 +11,19 @@
|
|||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <SharedUtil.h>
|
||||
#include <OctalCode.h>
|
||||
#include <AgentList.h>
|
||||
#include <VoxelTree.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Syssocket.h"
|
||||
#include "Systime.h"
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <ifaddrs.h>
|
||||
#endif _WIN32
|
||||
#include <SharedUtil.h>
|
||||
|
||||
const int VOXEL_LISTEN_PORT = 40106;
|
||||
|
||||
|
@ -40,7 +40,7 @@ const int VOXELS_PER_PACKET = (MAX_PACKET_SIZE - 1) / VOXEL_SIZE_BYTES;
|
|||
|
||||
const int MIN_BRIGHTNESS = 64;
|
||||
const float DEATH_STAR_RADIUS = 4.0;
|
||||
const float MAX_CUBE = 0.05;
|
||||
const float MAX_CUBE = 0.05f;
|
||||
|
||||
char DOMAIN_HOSTNAME[] = "highfidelity.below92.com";
|
||||
char DOMAIN_IP[100] = ""; // IP Address will be re-set by lookup on startup
|
||||
|
@ -56,7 +56,7 @@ unsigned char randomColorValue() {
|
|||
}
|
||||
|
||||
bool randomBoolean() {
|
||||
return rand() % 2;
|
||||
return rand() % 2 != 0;
|
||||
}
|
||||
|
||||
void *reportAliveToDS(void *args) {
|
||||
|
@ -75,7 +75,11 @@ void *reportAliveToDS(void *args) {
|
|||
double usecToSleep = 1000000 - (usecTimestampNow() - usecTimestamp(&lastSend));
|
||||
|
||||
if (usecToSleep > 0) {
|
||||
#ifdef _WIN32
|
||||
Sleep( static_cast<int>(1000.0f*usecToSleep) );
|
||||
#else
|
||||
usleep(usecToSleep);
|
||||
#endif
|
||||
} else {
|
||||
std::cout << "No sleep required!";
|
||||
}
|
||||
|
@ -153,7 +157,8 @@ void randomlyFillVoxelTree(int levelsToGo, VoxelNode *currentRootNode) {
|
|||
int main(int argc, const char * argv[])
|
||||
{
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
// get the local address of the voxel server
|
||||
struct ifaddrs * ifAddrStruct=NULL;
|
||||
struct ifaddrs * ifa=NULL;
|
||||
|
@ -166,6 +171,7 @@ int main(int argc, const char * argv[])
|
|||
localAddress = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Lookup the IP address of things we have hostnames
|
||||
if (atoi(DOMAIN_IP) == 0) {
|
||||
|
|
Loading…
Reference in a new issue