mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 13:53:38 +02:00
more windows build work
This commit is contained in:
parent
8d7cb5d0be
commit
08bb783777
6 changed files with 44 additions and 22 deletions
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
#include <glm/gtx/component_wise.hpp>
|
#include <glm/gtx/component_wise.hpp>
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
@ -320,8 +322,8 @@ void Application::initializeGL() {
|
||||||
// Before we render anything, let's set up our viewFrustumOffsetCamera with a sufficiently large
|
// Before we render anything, let's set up our viewFrustumOffsetCamera with a sufficiently large
|
||||||
// field of view and near and far clip to make it interesting.
|
// field of view and near and far clip to make it interesting.
|
||||||
//viewFrustumOffsetCamera.setFieldOfView(90.0);
|
//viewFrustumOffsetCamera.setFieldOfView(90.0);
|
||||||
_viewFrustumOffsetCamera.setNearClip(0.1);
|
_viewFrustumOffsetCamera.setNearClip(0.1f);
|
||||||
_viewFrustumOffsetCamera.setFarClip(500.0 * TREE_SCALE);
|
_viewFrustumOffsetCamera.setFarClip(500.0f * TREE_SCALE);
|
||||||
|
|
||||||
initDisplay();
|
initDisplay();
|
||||||
qDebug( "Initialized Display.\n" );
|
qDebug( "Initialized Display.\n" );
|
||||||
|
@ -1318,7 +1320,7 @@ void Application::sendAvatarFaceVideoMessage(int frameCount, const QByteArray& d
|
||||||
getInstance()->controlledBroadcastToNodes(packet, headerSize + payloadSize, &NODE_TYPE_AVATAR_MIXER, 1);
|
getInstance()->controlledBroadcastToNodes(packet, headerSize + payloadSize, &NODE_TYPE_AVATAR_MIXER, 1);
|
||||||
*offsetPosition += payloadSize;
|
*offsetPosition += payloadSize;
|
||||||
|
|
||||||
} while (*offsetPosition < data.size());
|
} while (*offsetPosition < (uint32_t)data.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Every second, check the frame rates and other stuff
|
// Every second, check the frame rates and other stuff
|
||||||
|
@ -1967,7 +1969,7 @@ void Application::shrinkMirrorView() {
|
||||||
|
|
||||||
const float MAX_AVATAR_EDIT_VELOCITY = 1.0f;
|
const float MAX_AVATAR_EDIT_VELOCITY = 1.0f;
|
||||||
const float MAX_VOXEL_EDIT_DISTANCE = 50.0f;
|
const float MAX_VOXEL_EDIT_DISTANCE = 50.0f;
|
||||||
const float HEAD_SPHERE_RADIUS = 0.07;
|
const float HEAD_SPHERE_RADIUS = 0.07f;
|
||||||
|
|
||||||
static QUuid DEFAULT_NODE_ID_REF;
|
static QUuid DEFAULT_NODE_ID_REF;
|
||||||
|
|
||||||
|
@ -2861,8 +2863,8 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node
|
||||||
_voxelQuery.setCameraPosition(glm::vec3(-0.1,-0.1,-0.1));
|
_voxelQuery.setCameraPosition(glm::vec3(-0.1,-0.1,-0.1));
|
||||||
const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0);
|
const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0);
|
||||||
_voxelQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE);
|
_voxelQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE);
|
||||||
_voxelQuery.setCameraNearClip(0.1);
|
_voxelQuery.setCameraNearClip(0.1f);
|
||||||
_voxelQuery.setCameraFarClip(0.1);
|
_voxelQuery.setCameraFarClip(0.1f);
|
||||||
if (wantExtraDebugging) {
|
if (wantExtraDebugging) {
|
||||||
qDebug() << "Using 'minimal' camera position for node " << *node << "\n";
|
qDebug() << "Using 'minimal' camera position for node " << *node << "\n";
|
||||||
}
|
}
|
||||||
|
@ -3020,9 +3022,9 @@ void Application::setupWorldLight() {
|
||||||
glm::vec3 sunDirection = getSunDirection();
|
glm::vec3 sunDirection = getSunDirection();
|
||||||
GLfloat light_position0[] = { sunDirection.x, sunDirection.y, sunDirection.z, 0.0 };
|
GLfloat light_position0[] = { sunDirection.x, sunDirection.y, sunDirection.z, 0.0 };
|
||||||
glLightfv(GL_LIGHT0, GL_POSITION, light_position0);
|
glLightfv(GL_LIGHT0, GL_POSITION, light_position0);
|
||||||
GLfloat ambient_color[] = { 0.7, 0.7, 0.8 };
|
GLfloat ambient_color[] = { 0.7f, 0.7f, 0.8f };
|
||||||
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color);
|
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color);
|
||||||
GLfloat diffuse_color[] = { 0.8, 0.7, 0.7 };
|
GLfloat diffuse_color[] = { 0.8f, 0.7f, 0.7f };
|
||||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color);
|
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color);
|
||||||
|
|
||||||
glLightfv(GL_LIGHT0, GL_SPECULAR, WHITE_SPECULAR_COLOR);
|
glLightfv(GL_LIGHT0, GL_SPECULAR, WHITE_SPECULAR_COLOR);
|
||||||
|
@ -3390,7 +3392,7 @@ void Application::displayOverlay() {
|
||||||
node->getType() == NODE_TYPE_AGENT ? totalAvatars++ : totalServers++;
|
node->getType() == NODE_TYPE_AGENT ? totalAvatars++ : totalServers++;
|
||||||
}
|
}
|
||||||
sprintf(nodes, "Servers: %d, Avatars: %d\n", totalServers, totalAvatars);
|
sprintf(nodes, "Servers: %d, Avatars: %d\n", totalServers, totalAvatars);
|
||||||
drawtext(_glWidget->width() - 150, 20, 0.10, 0, 1.0, 0, nodes, 1, 0, 0);
|
drawtext(_glWidget->width() - 150, 20, 0.10f, 0, 1.0f, 0, nodes, 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// testing rendering coverage map
|
// testing rendering coverage map
|
||||||
|
@ -3412,8 +3414,8 @@ void Application::displayOverlay() {
|
||||||
char frameTimer[10];
|
char frameTimer[10];
|
||||||
uint64_t mSecsNow = floor(usecTimestampNow() / 1000.0 + 0.5);
|
uint64_t mSecsNow = floor(usecTimestampNow() / 1000.0 + 0.5);
|
||||||
sprintf(frameTimer, "%d\n", (int)(mSecsNow % 1000));
|
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() - 100, _glWidget->height() - 20, 0.30f, 0, 1.0f, 0, frameTimer, 0, 0, 0);
|
||||||
drawtext(_glWidget->width() - 102, _glWidget->height() - 22, 0.30, 0, 1.0, 0, frameTimer, 1, 1, 1);
|
drawtext(_glWidget->width() - 102, _glWidget->height() - 22, 0.30f, 0, 1.0f, 0, frameTimer, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3475,6 +3477,12 @@ void Application::displayOverlay() {
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
double roundf(double value) {
|
||||||
|
return (value > 0.0) ? floor(value + 0.5) : ceil(value - 0.5);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Application::displayStats() {
|
void Application::displayStats() {
|
||||||
int statsVerticalOffset = 8;
|
int statsVerticalOffset = 8;
|
||||||
const int PELS_PER_LINE = 15;
|
const int PELS_PER_LINE = 15;
|
||||||
|
@ -4205,7 +4213,7 @@ void Application::nodeKilled(Node* node) {
|
||||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) {
|
if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) {
|
||||||
VoxelFade fade(VoxelFade::FADE_OUT, NODE_KILLED_RED, NODE_KILLED_GREEN, NODE_KILLED_BLUE);
|
VoxelFade fade(VoxelFade::FADE_OUT, NODE_KILLED_RED, NODE_KILLED_GREEN, NODE_KILLED_BLUE);
|
||||||
fade.voxelDetails = rootDetails;
|
fade.voxelDetails = rootDetails;
|
||||||
const float slightly_smaller = 0.99;
|
const float slightly_smaller = 0.99f;
|
||||||
fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller;
|
fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller;
|
||||||
_voxelFades.push_back(fade);
|
_voxelFades.push_back(fade);
|
||||||
}
|
}
|
||||||
|
@ -4236,7 +4244,7 @@ void Application::nodeKilled(Node* node) {
|
||||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) {
|
if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) {
|
||||||
VoxelFade fade(VoxelFade::FADE_OUT, NODE_KILLED_RED, NODE_KILLED_GREEN, NODE_KILLED_BLUE);
|
VoxelFade fade(VoxelFade::FADE_OUT, NODE_KILLED_RED, NODE_KILLED_GREEN, NODE_KILLED_BLUE);
|
||||||
fade.voxelDetails = rootDetails;
|
fade.voxelDetails = rootDetails;
|
||||||
const float slightly_smaller = 0.99;
|
const float slightly_smaller = 0.99f;
|
||||||
fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller;
|
fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller;
|
||||||
_voxelFades.push_back(fade);
|
_voxelFades.push_back(fade);
|
||||||
}
|
}
|
||||||
|
@ -4326,7 +4334,7 @@ int Application::parseOctreeStats(unsigned char* messageData, ssize_t messageLen
|
||||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) {
|
if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) {
|
||||||
VoxelFade fade(VoxelFade::FADE_OUT, NODE_ADDED_RED, NODE_ADDED_GREEN, NODE_ADDED_BLUE);
|
VoxelFade fade(VoxelFade::FADE_OUT, NODE_ADDED_RED, NODE_ADDED_GREEN, NODE_ADDED_BLUE);
|
||||||
fade.voxelDetails = rootDetails;
|
fade.voxelDetails = rootDetails;
|
||||||
const float slightly_smaller = 0.99;
|
const float slightly_smaller = 0.99f;
|
||||||
fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller;
|
fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller;
|
||||||
_voxelFades.push_back(fade);
|
_voxelFades.push_back(fade);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <CoreAudio/AudioHardware.h>
|
#include <CoreAudio/AudioHardware.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -185,7 +187,7 @@ void linearResampling(int16_t* sourceSamples, int16_t* destinationSamples,
|
||||||
// we need to downsample from 48 to 24
|
// we need to downsample from 48 to 24
|
||||||
// for now this only supports a mono output - this would be the case for audio input
|
// for now this only supports a mono output - this would be the case for audio input
|
||||||
|
|
||||||
for (int i = sourceAudioFormat.channelCount(); i < numSourceSamples; i += 2 * sourceAudioFormat.channelCount()) {
|
for (unsigned int i = sourceAudioFormat.channelCount(); i < numSourceSamples; i += 2 * sourceAudioFormat.channelCount()) {
|
||||||
if (i + (sourceAudioFormat.channelCount()) >= numSourceSamples) {
|
if (i + (sourceAudioFormat.channelCount()) >= numSourceSamples) {
|
||||||
destinationSamples[(i - sourceAudioFormat.channelCount()) / (int) sourceToDestinationFactor] =
|
destinationSamples[(i - sourceAudioFormat.channelCount()) / (int) sourceToDestinationFactor] =
|
||||||
(sourceSamples[i - sourceAudioFormat.channelCount()] / 2)
|
(sourceSamples[i - sourceAudioFormat.channelCount()] / 2)
|
||||||
|
@ -206,11 +208,11 @@ void linearResampling(int16_t* sourceSamples, int16_t* destinationSamples,
|
||||||
int sampleShift = destinationAudioFormat.channelCount() * dtsSampleRateFactor;
|
int sampleShift = destinationAudioFormat.channelCount() * dtsSampleRateFactor;
|
||||||
int destinationToSourceFactor = (1 / sourceToDestinationFactor);
|
int destinationToSourceFactor = (1 / sourceToDestinationFactor);
|
||||||
|
|
||||||
for (int i = 0; i < numDestinationSamples; i += sampleShift) {
|
for (unsigned int i = 0; i < numDestinationSamples; i += sampleShift) {
|
||||||
sourceIndex = (i / destinationToSourceFactor);
|
sourceIndex = (i / destinationToSourceFactor);
|
||||||
|
|
||||||
// fill the L/R channels and make the rest silent
|
// fill the L/R channels and make the rest silent
|
||||||
for (int j = i; j < i + sampleShift; j++) {
|
for (unsigned int j = i; j < i + sampleShift; j++) {
|
||||||
if (j % destinationAudioFormat.channelCount() == 0) {
|
if (j % destinationAudioFormat.channelCount() == 0) {
|
||||||
// left channel
|
// left channel
|
||||||
destinationSamples[j] = sourceSamples[sourceIndex];
|
destinationSamples[j] = sourceSamples[sourceIndex];
|
||||||
|
@ -293,7 +295,7 @@ void Audio::handleAudioInput() {
|
||||||
static float inputToNetworkInputRatio = _numInputCallbackBytes * CALLBACK_ACCELERATOR_RATIO
|
static float inputToNetworkInputRatio = _numInputCallbackBytes * CALLBACK_ACCELERATOR_RATIO
|
||||||
/ NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL;
|
/ NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL;
|
||||||
|
|
||||||
static int inputSamplesRequired = NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL * inputToNetworkInputRatio;
|
static unsigned int inputSamplesRequired = NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL * inputToNetworkInputRatio;
|
||||||
|
|
||||||
QByteArray inputByteArray = _inputDevice->readAll();
|
QByteArray inputByteArray = _inputDevice->readAll();
|
||||||
|
|
||||||
|
@ -325,7 +327,7 @@ void Audio::handleAudioInput() {
|
||||||
|
|
||||||
while (_inputRingBuffer.samplesAvailable() > inputSamplesRequired) {
|
while (_inputRingBuffer.samplesAvailable() > inputSamplesRequired) {
|
||||||
|
|
||||||
int16_t inputAudioSamples[inputSamplesRequired];
|
int16_t* inputAudioSamples = new int16_t[inputSamplesRequired];
|
||||||
_inputRingBuffer.readSamples(inputAudioSamples, inputSamplesRequired);
|
_inputRingBuffer.readSamples(inputAudioSamples, inputSamplesRequired);
|
||||||
|
|
||||||
// zero out the monoAudioSamples array and the locally injected audio
|
// zero out the monoAudioSamples array and the locally injected audio
|
||||||
|
@ -403,6 +405,7 @@ void Audio::handleAudioInput() {
|
||||||
Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::AUDIO)
|
Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::AUDIO)
|
||||||
.updateValue(NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes);
|
.updateValue(NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes);
|
||||||
}
|
}
|
||||||
|
delete[] inputAudioSamples;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +467,7 @@ void Audio::addReceivedAudioToBuffer(const QByteArray& audioByteArray) {
|
||||||
// add to the output samples whatever is in the _localAudioOutput byte array
|
// add to the output samples whatever is in the _localAudioOutput byte array
|
||||||
// that lets this user hear sound effects and loopback (if enabled)
|
// that lets this user hear sound effects and loopback (if enabled)
|
||||||
|
|
||||||
for (unsigned int b = 0; b < _localInjectionByteArrays.size(); b++) {
|
for (int b = 0; b < _localInjectionByteArrays.size(); b++) {
|
||||||
QByteArray audioByteArray = _localInjectionByteArrays.at(b);
|
QByteArray audioByteArray = _localInjectionByteArrays.at(b);
|
||||||
|
|
||||||
int16_t* byteArraySamples = (int16_t*) audioByteArray.data();
|
int16_t* byteArraySamples = (int16_t*) audioByteArray.data();
|
||||||
|
|
|
@ -9,6 +9,11 @@
|
||||||
#ifndef __interface__BandwidthMeter__
|
#ifndef __interface__BandwidthMeter__
|
||||||
#define __interface__BandwidthMeter__
|
#define __interface__BandwidthMeter__
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define WANT_TIMEVAL
|
||||||
|
#include <Systime.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include "ui/TextRenderer.h"
|
#include "ui/TextRenderer.h"
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
|
@ -22,7 +22,7 @@ struct Radians {
|
||||||
|
|
||||||
static float pi() { return 3.141592653589793f; }
|
static float pi() { return 3.141592653589793f; }
|
||||||
static float twicePi() { return 6.283185307179586f; }
|
static float twicePi() { return 6.283185307179586f; }
|
||||||
static float halfPi() { return 1.5707963267948966; }
|
static float halfPi() { return 1.5707963267948966f; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Rotations {
|
struct Rotations {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef __Systime__
|
#ifndef __Systime__
|
||||||
#define __Systime__
|
#define __Systime__
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#ifdef _WINSOCK2API_
|
#ifdef _WINSOCK2API_
|
||||||
|
@ -14,7 +15,10 @@
|
||||||
* and used in other calls.
|
* and used in other calls.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if 0 // not needed for VC2010
|
// this is a bit of a hack for now, but sometimes on windows
|
||||||
|
// we need timeval defined here, sometimes we get it
|
||||||
|
// from winsock.h
|
||||||
|
#ifdef WANT_TIMEVAL
|
||||||
struct timeval {
|
struct timeval {
|
||||||
long tv_sec; /* seconds */
|
long tv_sec; /* seconds */
|
||||||
long tv_usec; /* and microseconds */
|
long tv_usec; /* and microseconds */
|
||||||
|
|
Loading…
Reference in a new issue