From 04a2dd3b8612c6fb451a382938298a441782fbaa Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 18 Jul 2013 14:36:55 -0700 Subject: [PATCH] clear environment data on domain server switch --- interface/src/Application.cpp | 6 +++++- interface/src/Environment.cpp | 5 +++++ interface/src/Environment.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index adb88147e9..e67d938bf1 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1148,15 +1148,19 @@ void Application::editPreferences() { // 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 + // if so we need to clear the nodelist and delete the existing voxel and environment data Node *voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); if (voxelServer) { voxelServer->lock(); } + // kill the local voxels _voxels.killLocalVoxels(); + // reset the environment to default + _environment.resetToDefault(); + if (voxelServer) { voxelServer->unlock(); } diff --git a/interface/src/Environment.cpp b/interface/src/Environment.cpp index 35ed121e38..adfb1cfb3b 100644 --- a/interface/src/Environment.cpp +++ b/interface/src/Environment.cpp @@ -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); diff --git a/interface/src/Environment.h b/interface/src/Environment.h index f711f0c38c..7bdbfa600b 100644 --- a/interface/src/Environment.h +++ b/interface/src/Environment.h @@ -24,6 +24,7 @@ class Environment { public: void init(); + void resetToDefault(); void renderAtmospheres(Camera& camera); glm::vec3 getGravity (const glm::vec3& position);