wip: draw physics thread ups

This commit is contained in:
2026-02-24 18:15:14 +01:00
parent 90e2dc2186
commit d3f93fc3c6
6 changed files with 26 additions and 8 deletions

View File

@ -29,15 +29,14 @@ constexpr float ROT_SPEED = 1.0;
constexpr float CAMERA_SMOOTH_SPEED = 15.0;
// Physics Engine
constexpr float SIM_SPEED = 1.0; // How large each update should be
constexpr float TIMESTEP = 1.0 / 90; // Do 90 physics updates per second
constexpr float TIMESTEP = 0.01; // How large each update should be
constexpr float MASS = 1.0; // Mass spring system
constexpr float SPRING_CONSTANT = 5.0; // Mass spring system
constexpr float DAMPENING_CONSTANT = 1.0; // Mass spring system
constexpr float REST_LENGTH = 2.0; // Mass spring system
constexpr float VERLET_DAMPENING = 0.05; // [0, 1]
constexpr float BH_FORCE = 2.0; // BH: [1.0, 3.0]
constexpr float THETA = 1.0; // Barnes-Hut [0.5, 1.0]
constexpr float THETA = 0.9; // Barnes-Hut [0.5, 1.0]
constexpr float SOFTENING = 0.01; // Barnes-Hut [0.01, 1.0]
constexpr float GRID_FORCE = 0.02; // Grid: [0.0, ~0.05]
constexpr float REPULSION_RANGE = 5.0 * REST_LENGTH; // Grid

View File

@ -122,6 +122,7 @@ class ThreadedPhysics {
TracyLockable(std::mutex, data_mtx);
std::condition_variable_any data_ready_cnd;
std::condition_variable_any data_consumed_cnd;
float ups;
bool data_ready = false;
bool data_consumed = true;
std::vector<Vector3> masses; // Read by renderer

View File

@ -77,7 +77,7 @@ public:
const std::vector<std::pair<std::size_t, std::size_t>> &springs)
-> void;
auto DrawTextures() -> void;
auto DrawTextures(float ups) -> void;
};
#endif