mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-21 18:09:46 +00:00
move to namespace
This commit is contained in:
parent
67ed7ac582
commit
8798b34423
8 changed files with 63 additions and 45 deletions
|
|
@ -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
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue