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