summaryrefslogtreecommitdiffstats
path: root/game/client/entity/interpolation.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-12-11 15:14:26 +0500
committeruntodesu <kirill@untode.su>2025-12-11 15:14:26 +0500
commitf40d09cb8f712e87691af4912f3630d92d692779 (patch)
tree7ac3a4168ff722689372fd489c6f94d0a2546e8f /game/client/entity/interpolation.cc
parent8bcbd2729388edc63c82d77d314b583af1447c49 (diff)
downloadvoxelius-f40d09cb8f712e87691af4912f3630d92d692779.tar.bz2
voxelius-f40d09cb8f712e87691af4912f3630d92d692779.zip
Shuffle stuff around
- Use the new and improved hierarchy I figured out when making Prospero chat - Re-add NSIS scripts, again from Prospero - Update most build and utility scripts with their most recent versions
Diffstat (limited to 'game/client/entity/interpolation.cc')
-rw-r--r--game/client/entity/interpolation.cc64
1 files changed, 0 insertions, 64 deletions
diff --git a/game/client/entity/interpolation.cc b/game/client/entity/interpolation.cc
deleted file mode 100644
index c88fcf2..0000000
--- a/game/client/entity/interpolation.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-#include "client/pch.hh"
-
-#include "client/entity/interpolation.hh"
-
-#include "core/math/constexpr.hh"
-
-#include "shared/entity/head.hh"
-#include "shared/entity/transform.hh"
-
-#include "shared/world/dimension.hh"
-
-#include "shared/coord.hh"
-
-#include "client/globals.hh"
-
-static void transform_interpolate(float alpha)
-{
- auto group = globals::dimension->entities.group<entity::client::TransformIntr>(
- entt::get<entity::Transform, entity::client::TransformPrev>);
-
- for(auto [entity, interp, current, previous] : group.each()) {
- interp.angles[0] = glm::mix(previous.angles[0], current.angles[0], alpha);
- interp.angles[1] = glm::mix(previous.angles[1], current.angles[1], alpha);
- interp.angles[2] = glm::mix(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 = glm::mix(previous_local.x, current.local.x, alpha);
- interp.local.y = glm::mix(previous_local.y, current.local.y, alpha);
- interp.local.z = glm::mix(previous_local.z, current.local.z, alpha);
- }
-}
-
-static void head_interpolate(float alpha)
-{
- auto group = globals::dimension->entities.group<entity::client::HeadIntr>(entt::get<entity::Head, entity::client::HeadPrev>);
-
- for(auto [entity, interp, current, previous] : group.each()) {
- interp.angles[0] = glm::mix(previous.angles[0], current.angles[0], alpha);
- interp.angles[1] = glm::mix(previous.angles[1], current.angles[1], alpha);
- interp.angles[2] = glm::mix(previous.angles[2], current.angles[2], alpha);
-
- interp.offset.x = glm::mix(previous.offset.x, current.offset.x, alpha);
- interp.offset.y = glm::mix(previous.offset.y, current.offset.y, alpha);
- interp.offset.z = glm::mix(previous.offset.z, current.offset.z, alpha);
- }
-}
-
-void entity::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