move to namespace

This commit is contained in:
Andrey Tazetdinov 2026-10-21 11:28:33 +02:00
parent 67ed7ac582
commit 8798b34423
8 changed files with 63 additions and 45 deletions

View file

@ -7,27 +7,35 @@
#include <algorithm>
#include <glm/glm.hpp>
inline void integrate(
Hitbox& box, const glm::vec3& gravity, float dt, uint substeps
) {
float n = static_cast<float>(substeps);
auto accel = gravity * box.gravityScale;
box.position += box.velocity * (dt * n) +
accel * (dt * dt * n * (n + 2.0f) * 0.5f);
box.velocity += accel * (dt * n);
}
inline void push_body(Hitbox& box, int axis, float value, uint wakeSubstep) {
if (box.velocity[axis] != value) {
box.velocity[axis] = value;
box.nextSubstep = std::min(box.nextSubstep, wakeSubstep);
namespace physics {
inline void integrate(
Hitbox& box, const glm::vec3& gravity, float dt, uint substeps
) {
float n = static_cast<float>(substeps);
auto accel = gravity * box.gravityScale;
box.position += box.velocity * (dt * n) +
accel * (dt * dt * n * (n + 2.0f) * 0.5f);
box.velocity += accel * (dt * n);
}
inline void push_body(
Hitbox& box, int axis, float value, uint wakeSubstep
) {
if (box.velocity[axis] != value) {
box.velocity[axis] = value;
box.nextSubstep = std::min(box.nextSubstep, wakeSubstep);
}
}
uint calc_substep_stride(
const Hitbox& hitbox, const glm::vec3& gravity, float dt, uint left
);
void schedule_substep(
Hitbox& hitbox,
const glm::vec3& gravity,
uint done,
uint substeps,
float dt
);
}
uint calc_substep_stride(
const Hitbox& hitbox, const glm::vec3& gravity, float dt, uint left
);
void schedule_substep(
Hitbox& hitbox, const glm::vec3& gravity, uint done, uint substeps, float dt
);