Major Update - Physique Fixed Update And Thread

Physics process run in a fixed update in a thread
This commit is contained in:
2025-01-17 15:47:09 +01:00
parent 15217a5df8
commit 4ae55e73b2
7 changed files with 142 additions and 114 deletions

View File

@@ -144,9 +144,6 @@ void SystemClass::Run()
// Loop until there is a quit message from the window or the user.
done = false;
auto fixedUpdateInterval = std::chrono::milliseconds(16);
auto m_lastFixedUpdateTime = std::chrono::steady_clock::now();
while (!done)
{
// Handle the windows messages.
@@ -178,13 +175,6 @@ void SystemClass::Run()
Logger::Get().Log("Failed to process frame", __FILE__, __LINE__, Logger::LogLevel::Error);
done = true;
}
auto now = std::chrono::steady_clock::now();
if (now - m_lastFixedUpdateTime >= fixedUpdateInterval)
{
FixedUpdate();
m_lastFixedUpdateTime = now;
}
}
}
@@ -476,9 +466,4 @@ void SystemClass::SendPath(wchar_t* path, std::filesystem::path WFolder)
{
m_Application->SetPath(path);
m_Application->SetWFolder(WFolder);
}
void SystemClass::FixedUpdate()
{
m_Application->GetPhysics()->Update();
}