diff options
| author | untodesu <kirill@untode.su> | 2025-07-01 03:08:39 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-07-01 03:08:39 +0500 |
| commit | 458e0005690ea9d579588a0a12368fc2c2c9a93a (patch) | |
| tree | 588a9ca6cb3c76d9193b5bd4601d64f0e50e8c8c /src/game/client/interpolation.cc | |
| parent | c7b0c8e0286a1b2bb7ec55e579137dfc3b22eeb9 (diff) | |
| download | voxelius-458e0005690ea9d579588a0a12368fc2c2c9a93a.tar.bz2 voxelius-458e0005690ea9d579588a0a12368fc2c2c9a93a.zip | |
I hyper-focued on refactoring again
- I put a cool-sounding "we are number one" remix on repeat and straight
up grinded the entire repository to a better state until 03:09 AM. I
guess I have something wrong in my brain that makes me do this shit
Diffstat (limited to 'src/game/client/interpolation.cc')
| -rw-r--r-- | src/game/client/interpolation.cc | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/game/client/interpolation.cc b/src/game/client/interpolation.cc deleted file mode 100644 index 27b6dfd..0000000 --- a/src/game/client/interpolation.cc +++ /dev/null @@ -1,61 +0,0 @@ -#include "client/pch.hh" - -#include "client/interpolation.hh" - -#include "core/constexpr.hh" - -#include "shared/coord.hh" -#include "shared/dimension.hh" -#include "shared/head.hh" -#include "shared/transform.hh" - -#include "client/globals.hh" - -static void transform_interpolate(float alpha) -{ - auto group = globals::dimension->entities.group<TransformComponentIntr>(entt::get<TransformComponent, TransformComponentPrev>); - - for(auto [entity, interp, current, previous] : group.each()) { - interp.angles[0] = vx::lerp(previous.angles[0], current.angles[0], alpha); - interp.angles[1] = vx::lerp(previous.angles[1], current.angles[1], alpha); - interp.angles[2] = vx::lerp(previous.angles[2], current.angles[2], alpha); - - // Figure out previous chunk-local floating-point coordinates transformed - // to the current WorldCoord's chunk domain coordinates; we're interpolating - // against these instead of using previous.position.local to prevent jittering - auto previous_shift = coord::to_relative(current.chunk, current.local, previous.chunk, previous.local); - auto previous_local = current.local + previous_shift; - - interp.chunk.x = current.chunk.x; - interp.chunk.y = current.chunk.y; - interp.chunk.z = current.chunk.z; - - interp.local.x = vx::lerp(previous_local.x, current.local.x, alpha); - interp.local.y = vx::lerp(previous_local.y, current.local.y, alpha); - interp.local.z = vx::lerp(previous_local.z, current.local.z, alpha); - } -} - -static void head_interpolate(float alpha) -{ - auto group = globals::dimension->entities.group<HeadComponentIntr>(entt::get<HeadComponent, HeadComponentPrev>); - - for(auto [entity, interp, current, previous] : group.each()) { - interp.angles[0] = vx::lerp(previous.angles[0], current.angles[0], alpha); - interp.angles[1] = vx::lerp(previous.angles[1], current.angles[1], alpha); - interp.angles[2] = vx::lerp(previous.angles[2], current.angles[2], alpha); - - interp.offset.x = vx::lerp(previous.offset.x, current.offset.x, alpha); - interp.offset.y = vx::lerp(previous.offset.y, current.offset.y, alpha); - interp.offset.z = vx::lerp(previous.offset.z, current.offset.z, alpha); - } -} - -void interpolation::update(void) -{ - if(globals::dimension) { - auto alpha = static_cast<float>(globals::fixed_accumulator) / static_cast<float>(globals::fixed_frametime_us); - transform_interpolate(alpha); - head_interpolate(alpha); - } -}
\ No newline at end of file |
