Major Update - Physique Fixed Update And Thread
Physics process run in a fixed update in a thread
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <WICTextureLoader.h>
|
||||
#include <comdef.h> // Pour _com_error
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
|
||||
/////////////
|
||||
@@ -66,6 +67,8 @@ public:
|
||||
void Shutdown();
|
||||
bool Frame(InputClass*);
|
||||
void PhysicsThreadFunction();
|
||||
int GetPhysicsTickRate() const { return m_PhysicsTickRate; };
|
||||
void SetPhysicsTickRate(int physicsTickRate) { m_PhysicsTickRate = physicsTickRate; };
|
||||
|
||||
int GetScreenWidth() const;
|
||||
void SetScreenWidth(int screenWidth);
|
||||
@@ -130,6 +133,9 @@ public:
|
||||
float GetFrustumTolerance() const { return m_FrustumCullingTolerance; };
|
||||
void SetFrustumTolerance(float frustumTolerance) { m_FrustumCullingTolerance = frustumTolerance; };
|
||||
|
||||
bool GetCanFixedUpdate() const { return CanFixedUpdate; };
|
||||
void SetCanFixedUpdate(bool canFixedUpdate) { CanFixedUpdate = canFixedUpdate; };
|
||||
|
||||
|
||||
private:
|
||||
bool Render(float, float, float, float, float);
|
||||
@@ -232,6 +238,9 @@ private :
|
||||
float m_gravity;
|
||||
XMVECTOR m_previousPosition;
|
||||
ImVec2 windowSize;
|
||||
int m_PhysicsTickRate = 50;
|
||||
bool CanFixedUpdate = false;
|
||||
std::thread m_PhysicsThread;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------------- Culling --------------------- //
|
||||
|
||||
Reference in New Issue
Block a user