mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Merge branch 'master' of https://github.com/worklist/hifi into dev4
This commit is contained in:
commit
28bf0b5147
6 changed files with 96 additions and 42 deletions
|
@ -235,6 +235,31 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
NodeList::getInstance()->getNodeSocket()->setBlocking(false);
|
||||
}
|
||||
|
||||
// setup QSettings
|
||||
#ifdef Q_WS_MAC
|
||||
QString resourcesPath = QCoreApplication::applicationDirPath() + "/../Resources";
|
||||
#else
|
||||
QString resourcesPath = QCoreApplication::applicationDirPath() + "/resources";
|
||||
#endif
|
||||
|
||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||
QSettings applicationInfo(resourcesPath + "/info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||
|
||||
// set the associated application properties
|
||||
applicationInfo.beginGroup("INFO");
|
||||
|
||||
setApplicationName(applicationInfo.value("name").toString());
|
||||
setApplicationVersion(applicationInfo.value("version").toString());
|
||||
setOrganizationName(applicationInfo.value("organizationName").toString());
|
||||
setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
|
||||
|
||||
_settings = new QSettings(this);
|
||||
|
||||
// check if there is a saved domain server hostname
|
||||
// this must be done now instead of with the other setting checks to allow manual override with
|
||||
// --domain or --local options
|
||||
NodeList::getInstance()->loadData(_settings);
|
||||
|
||||
const char* domainIP = getCmdOption(argc, constArgv, "--domain");
|
||||
if (domainIP) {
|
||||
NodeList::getInstance()->setDomainIP(domainIP);
|
||||
|
@ -268,23 +293,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
|
||||
_window->setCentralWidget(_glWidget);
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
QString resourcesPath = QCoreApplication::applicationDirPath() + "/../Resources";
|
||||
#else
|
||||
QString resourcesPath = QCoreApplication::applicationDirPath() + "/resources";
|
||||
#endif
|
||||
|
||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||
QSettings applicationInfo(resourcesPath + "/info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||
|
||||
// set the associated application properties
|
||||
applicationInfo.beginGroup("INFO");
|
||||
|
||||
setApplicationName(applicationInfo.value("name").toString());
|
||||
setApplicationVersion(applicationInfo.value("version").toString());
|
||||
setOrganizationName(applicationInfo.value("organizationName").toString());
|
||||
setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
|
||||
|
||||
#if defined(Q_WS_MAC) && defined(QT_NO_DEBUG)
|
||||
// if this is a release OS X build use fervor to check for an update
|
||||
FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml");
|
||||
|
@ -1143,26 +1151,29 @@ void Application::editPreferences() {
|
|||
return;
|
||||
}
|
||||
|
||||
QByteArray newHostname;
|
||||
|
||||
const char* newHostname = domainServerHostname->text().toLocal8Bit().data();
|
||||
|
||||
if (domainServerHostname->text().size() > 0) {
|
||||
// the user input a new hostname, use that
|
||||
newHostname = domainServerHostname->text().toAscii();
|
||||
} else {
|
||||
// the user left the field blank, use the default hostname
|
||||
newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME);
|
||||
}
|
||||
|
||||
// check if the domain server hostname is new
|
||||
if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, sizeof(&newHostname)) != 0) {
|
||||
// if so we need to clear the nodelist and delete the local voxels
|
||||
Node *voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER);
|
||||
|
||||
if (voxelServer) {
|
||||
voxelServer->lock();
|
||||
}
|
||||
|
||||
_voxels.killLocalVoxels();
|
||||
|
||||
if (voxelServer) {
|
||||
voxelServer->unlock();
|
||||
}
|
||||
if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname.constData(), newHostname.size()) != 0) {
|
||||
|
||||
NodeList::getInstance()->clear();
|
||||
NodeList::getInstance()->setDomainHostname(newHostname);
|
||||
|
||||
// kill the local voxels
|
||||
_voxels.killLocalVoxels();
|
||||
|
||||
// reset the environment to default
|
||||
_environment.resetToDefault();
|
||||
|
||||
// set the new hostname
|
||||
NodeList::getInstance()->setDomainHostname(newHostname.constData());
|
||||
}
|
||||
|
||||
QUrl url(avatarURL->text());
|
||||
|
@ -1786,7 +1797,6 @@ void Application::initMenu() {
|
|||
settingsMenu->addAction("Export settings", this, SLOT(exportSettings()));
|
||||
|
||||
_networkAccessManager = new QNetworkAccessManager(this);
|
||||
_settings = new QSettings(this);
|
||||
}
|
||||
|
||||
void Application::updateFrustumRenderModeAction() {
|
||||
|
@ -3352,7 +3362,7 @@ void* Application::networkReceive(void* args) {
|
|||
case PACKET_TYPE_ENVIRONMENT_DATA: {
|
||||
if (app->_renderVoxels->isChecked()) {
|
||||
Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER);
|
||||
if (voxelServer) {
|
||||
if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) {
|
||||
voxelServer->lock();
|
||||
|
||||
if (app->_incomingPacket[0] == PACKET_TYPE_ENVIRONMENT_DATA) {
|
||||
|
@ -3456,7 +3466,7 @@ void Application::saveSettings(QSettings* settings) {
|
|||
if (!settings) {
|
||||
settings = getSettings();
|
||||
}
|
||||
|
||||
|
||||
settings->setValue("headCameraPitchYawScale", _headCameraPitchYawScale);
|
||||
settings->setValue("audioJitterBufferSamples", _audioJitterBufferSamples);
|
||||
settings->setValue("horizontalFieldOfView", _horizontalFieldOfView);
|
||||
|
@ -3471,6 +3481,9 @@ void Application::saveSettings(QSettings* settings) {
|
|||
scanMenuBar(&Application::saveAction, settings);
|
||||
getAvatar()->saveData(settings);
|
||||
_swatch.saveData(settings);
|
||||
|
||||
// ask the NodeList to save its data
|
||||
NodeList::getInstance()->saveData(settings);
|
||||
}
|
||||
|
||||
void Application::importSettings() {
|
||||
|
|
|
@ -47,6 +47,11 @@ void Environment::init() {
|
|||
_data[getZeroAddress()][0];
|
||||
}
|
||||
|
||||
void Environment::resetToDefault() {
|
||||
_data.clear();
|
||||
_data[getZeroAddress()][0];
|
||||
}
|
||||
|
||||
void Environment::renderAtmospheres(Camera& camera) {
|
||||
// get the lock for the duration of the call
|
||||
QMutexLocker locker(&_mutex);
|
||||
|
|
|
@ -24,6 +24,7 @@ class Environment {
|
|||
public:
|
||||
|
||||
void init();
|
||||
void resetToDefault();
|
||||
void renderAtmospheres(Camera& camera);
|
||||
|
||||
glm::vec3 getGravity (const glm::vec3& position);
|
||||
|
|
|
@ -472,8 +472,7 @@ void *removeSilentNodes(void *args) {
|
|||
|
||||
for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); ++node) {
|
||||
|
||||
if ((checkTimeUSecs - node->getLastHeardMicrostamp()) > NODE_SILENCE_THRESHOLD_USECS
|
||||
&& node->getType() != NODE_TYPE_VOXEL_SERVER) {
|
||||
if ((checkTimeUSecs - node->getLastHeardMicrostamp()) > NODE_SILENCE_THRESHOLD_USECS) {
|
||||
|
||||
qDebug() << "Killed" << *node << "\n";
|
||||
|
||||
|
@ -500,6 +499,37 @@ void NodeList::startSilentNodeRemovalThread() {
|
|||
void NodeList::stopSilentNodeRemovalThread() {
|
||||
silentNodeThreadStopFlag = true;
|
||||
pthread_join(removeSilentNodesThread, NULL);
|
||||
|
||||
}
|
||||
|
||||
const QString QSETTINGS_GROUP_NAME = "NodeList";
|
||||
const QString DOMAIN_SERVER_SETTING_KEY = "domainServerHostname";
|
||||
|
||||
void NodeList::loadData(QSettings *settings) {
|
||||
settings->beginGroup(DOMAIN_SERVER_SETTING_KEY);
|
||||
|
||||
QString domainServerHostname = settings->value(DOMAIN_SERVER_SETTING_KEY).toString();
|
||||
|
||||
if (domainServerHostname.size() > 0) {
|
||||
memset(_domainHostname, 0, MAX_HOSTNAME_BYTES);
|
||||
memcpy(_domainHostname, domainServerHostname.toAscii().constData(), domainServerHostname.size());
|
||||
}
|
||||
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void NodeList::saveData(QSettings* settings) {
|
||||
settings->beginGroup(DOMAIN_SERVER_SETTING_KEY);
|
||||
|
||||
if (memcmp(_domainHostname, DEFAULT_DOMAIN_HOSTNAME, strlen(DEFAULT_DOMAIN_HOSTNAME)) != 0) {
|
||||
// the user is using a different hostname, store it
|
||||
settings->setValue(DOMAIN_SERVER_SETTING_KEY, QVariant(_domainHostname));
|
||||
} else {
|
||||
// the user has switched back to default, remove the current setting
|
||||
settings->remove(DOMAIN_SERVER_SETTING_KEY);
|
||||
}
|
||||
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
NodeList::iterator NodeList::begin() const {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include <iterator>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#include "Node.h"
|
||||
#include "UDPSocket.h"
|
||||
|
||||
|
@ -32,7 +34,7 @@ const int DOMAIN_SERVER_CHECK_IN_USECS = 1 * 1000000;
|
|||
|
||||
extern const char SOLO_NODE_TYPES[3];
|
||||
|
||||
const int MAX_HOSTNAME_BYTES = 255;
|
||||
const int MAX_HOSTNAME_BYTES = 256;
|
||||
|
||||
extern const char DEFAULT_DOMAIN_HOSTNAME[MAX_HOSTNAME_BYTES];
|
||||
extern const char DEFAULT_DOMAIN_IP[INET_ADDRSTRLEN]; // IP Address will be re-set by lookup on startup
|
||||
|
@ -99,6 +101,9 @@ public:
|
|||
void startSilentNodeRemovalThread();
|
||||
void stopSilentNodeRemovalThread();
|
||||
|
||||
void loadData(QSettings* settings);
|
||||
void saveData(QSettings* settings);
|
||||
|
||||
friend class NodeListIterator;
|
||||
private:
|
||||
static NodeList* _sharedInstance;
|
||||
|
|
|
@ -44,9 +44,9 @@ const int MIN_BRIGHTNESS = 64;
|
|||
const float DEATH_STAR_RADIUS = 4.0;
|
||||
const float MAX_CUBE = 0.05f;
|
||||
|
||||
const int VOXEL_SEND_INTERVAL_USECS = 100 * 1000;
|
||||
int PACKETS_PER_CLIENT_PER_INTERVAL = 30;
|
||||
const int SENDING_TIME_TO_SPARE = 20 * 1000; // usec of sending interval to spare for calculating voxels
|
||||
const int VOXEL_SEND_INTERVAL_USECS = 17 * 1000; // approximately 60fps
|
||||
int PACKETS_PER_CLIENT_PER_INTERVAL = 20;
|
||||
const int SENDING_TIME_TO_SPARE = 5 * 1000; // usec of sending interval to spare for calculating voxels
|
||||
|
||||
const int MAX_VOXEL_TREE_DEPTH_LEVELS = 4;
|
||||
|
||||
|
|
Loading…
Reference in a new issue