mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-01-17 06:18:22 +01:00
Pause renderer thread when needed in GameModel
This commit is contained in:
parent
12322bb382
commit
c842086309
@ -192,6 +192,7 @@ GameModel::~GameModel()
|
|||||||
prefs.Set("Decoration.Alpha", (int)colour.Alpha);
|
prefs.Set("Decoration.Alpha", (int)colour.Alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
view->PauseRendererThread();
|
||||||
delete sim;
|
delete sim;
|
||||||
delete ren;
|
delete ren;
|
||||||
//if(activeTools)
|
//if(activeTools)
|
||||||
@ -760,6 +761,7 @@ void GameModel::SetSave(std::unique_ptr<SaveInfo> newSave, bool invertIncludePre
|
|||||||
auto *saveData = currentSave->GetGameSave();
|
auto *saveData = currentSave->GetGameSave();
|
||||||
SaveToSimParameters(*saveData);
|
SaveToSimParameters(*saveData);
|
||||||
sim->clear_sim();
|
sim->clear_sim();
|
||||||
|
view->PauseRendererThread();
|
||||||
ren->ClearAccumulation();
|
ren->ClearAccumulation();
|
||||||
sim->Load(saveData, !invertIncludePressure, { 0, 0 });
|
sim->Load(saveData, !invertIncludePressure, { 0, 0 });
|
||||||
// This save was created before logging existed
|
// This save was created before logging existed
|
||||||
@ -811,6 +813,7 @@ void GameModel::SetSaveFile(std::unique_ptr<SaveFile> newSave, bool invertInclud
|
|||||||
auto *saveData = currentFile->GetGameSave();
|
auto *saveData = currentFile->GetGameSave();
|
||||||
SaveToSimParameters(*saveData);
|
SaveToSimParameters(*saveData);
|
||||||
sim->clear_sim();
|
sim->clear_sim();
|
||||||
|
view->PauseRendererThread();
|
||||||
ren->ClearAccumulation();
|
ren->ClearAccumulation();
|
||||||
sim->Load(saveData, !invertIncludePressure, { 0, 0 });
|
sim->Load(saveData, !invertIncludePressure, { 0, 0 });
|
||||||
Client::Ref().OverwriteAuthorInfo(saveData->authors);
|
Client::Ref().OverwriteAuthorInfo(saveData->authors);
|
||||||
|
@ -267,7 +267,7 @@ public:
|
|||||||
{
|
{
|
||||||
return *rendererFrame;
|
return *rendererFrame;
|
||||||
}
|
}
|
||||||
// Call this before accessing Renderer "out of turn", e.g. from RenderView. This *does not*
|
// Call this before accessing Renderer "out of turn", e.g. from RenderView or GameModel. This *does not*
|
||||||
// include OptionsModel or Lua setting functions because they only access the RendererSettings
|
// include OptionsModel or Lua setting functions because they only access the RendererSettings
|
||||||
// in GameModel, or Lua drawing functions because they only access Renderer in eventTraitSimGraphics
|
// in GameModel, or Lua drawing functions because they only access Renderer in eventTraitSimGraphics
|
||||||
// and *SimDraw events, and the renderer thread gets paused anyway if there are handlers
|
// and *SimDraw events, and the renderer thread gets paused anyway if there are handlers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user