Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Mark Peng 2013-07-18 21:08:08 -07:00
commit cfcb31172c
5 changed files with 22 additions and 21 deletions

View file

@ -1145,25 +1145,20 @@ void Application::editPreferences() {
return;
}
const char* newHostname = domainServerHostname->text().toLocal8Bit().data();
char newHostname[MAX_HOSTNAME_BYTES] = {};
memcpy(newHostname, domainServerHostname->text().toAscii().data(), domainServerHostname->text().size());
// 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, strlen(newHostname)) != 0) {
NodeList::getInstance()->clear();
// kill the local voxels
_voxels.killLocalVoxels();
// reset the environment to default
_environment.resetToDefault();
NodeList::getInstance()->setDomainHostname(newHostname);
}
@ -3379,7 +3374,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) {

View file

@ -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);

View file

@ -24,6 +24,7 @@ class Environment {
public:
void init();
void resetToDefault();
void renderAtmospheres(Camera& camera);
glm::vec3 getGravity (const glm::vec3& position);

View file

@ -32,7 +32,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

View file

@ -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;