void AppGUI::UpdateTexture(RenderEngine& engine) { const int selectedTexture = m_cache->TextureSelected.Get(); if(selectedTexture != m_selectedTexture) { m_selectedTexture = selectedTexture; const int ID = m_data.proceduralTextures[m_selectedTexture]; m_data.textures[ID]->Write(*m_cache); m_data.textures[ID]->Save(); m_cache->TexturePath.SetUpdated(m_data.textures[ID]->Path()); } else if(m_selectedTexture >= 0 && m_selectedTexture < static_cast<int>(m_data.proceduralTextures.size())) { const int ID = m_data.proceduralTextures[m_selectedTexture]; m_data.textures[ID]->Read(*m_cache); } if (m_cache->ReloadTexture.Get()) { const int ID = m_data.proceduralTextures[m_selectedTexture]; m_scene.ReloadTexture(ID); engine.ReloadTexture(ID); m_data.textures[ID]->Save(); m_cache->TexturePath.SetUpdated(m_data.textures[ID]->Path()); m_cache->ReloadTexture.Set(false); } }
void AppGUI::UpdateScene(RenderEngine& engine) { UpdateCamera(); m_cache->FramesPerSec.Set(m_timer.GetFPS()); m_cache->DeltaTime.Set(m_timer.GetDeltaTime()); m_cache->Timer.Set(m_timer.GetTotalTime()); if (m_cache->ReloadScene.Get()) { m_cache->ReloadScene.Set(false); m_scene.Reload(); const auto maxTextures = m_cache->Textures.Get().size(); for (unsigned int i = 0; i < maxTextures; ++i) { engine.ReloadTexture(m_data.proceduralTextures[i]); } const auto maxTerrain = m_cache->Terrains.Get().size(); for (unsigned int i = 0; i < maxTerrain; ++i) { engine.ReloadTerrain(i); } } if (m_cache->ReloadEngine.Get()) { m_reloadEngine(); m_cache->ReloadEngine.Set(false); } if (m_cache->ReloadPlacement.Get()) { m_scene.ReloadPlacement(); m_cache->ReloadPlacement.Set(false); } }