clear the skybox between scenes

This commit is contained in:
Zach Pomerantz 2016-08-25 18:08:22 -07:00
parent 5e82093e69
commit 996346980d

View file

@ -113,17 +113,19 @@ void EntityTreeRenderer::resetEntitiesScriptEngine() {
void EntityTreeRenderer::clear() { void EntityTreeRenderer::clear() {
leaveAllEntities(); leaveAllEntities();
// unload and stop the engine
if (_entitiesScriptEngine) { if (_entitiesScriptEngine) {
// Unload and stop the engine here (instead of in its deleter) to // do this here (instead of in deleter) to avoid marshalling unload signals back to this thread
// avoid marshalling unload signals back to this thread
_entitiesScriptEngine->unloadAllEntityScripts(); _entitiesScriptEngine->unloadAllEntityScripts();
_entitiesScriptEngine->stop(); _entitiesScriptEngine->stop();
} }
// reset the engine
if (_wantScripts && !_shuttingDown) { if (_wantScripts && !_shuttingDown) {
resetEntitiesScriptEngine(); resetEntitiesScriptEngine();
} }
// remove all entities from the scene
auto scene = _viewState->getMain3DScene(); auto scene = _viewState->getMain3DScene();
render::PendingChanges pendingChanges; render::PendingChanges pendingChanges;
foreach(auto entity, _entitiesInScene) { foreach(auto entity, _entitiesInScene) {
@ -132,6 +134,10 @@ void EntityTreeRenderer::clear() {
scene->enqueuePendingChanges(pendingChanges); scene->enqueuePendingChanges(pendingChanges);
_entitiesInScene.clear(); _entitiesInScene.clear();
// reset the zone to the default (while we load the next scene)
_bestZone = nullptr;
applyZonePropertiesToScene(_bestZone);
OctreeRenderer::clear(); OctreeRenderer::clear();
} }