clear environment data on domain server switch

This commit is contained in:
Stephen Birarda 2013-07-18 14:36:55 -07:00
parent 67e5a6409e
commit 04a2dd3b86
3 changed files with 11 additions and 1 deletions

View file

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

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