Working on interpolation

This commit is contained in:
Vladislav Khorev committed 2026-11-06 15:14:48 +06:00
1 parent 23fef6f349
commit 28846b9f25
8 files changed
+231 -51

No files matched your search

+17
View File
@@ -12,6 +12,7 @@
#include <vector>
#include <unordered_map>
#include <utility>
#include <chrono>
#include "dialogue/TranslationDatabase.h"
#include "AudioPlayerAsync.h"
@@ -94,6 +95,7 @@ public:
bool isMoving() const;
Eigen::Vector3f getRequestedWalkTarget() const;
Eigen::Vector3f getCurrentNavigationTarget() const;
Eigen::Vector3f renderPosition() const;
float getHp() const;
// ---- Weapon rendering data (initialized from state.creationInfo by createFromState) ----
@@ -124,7 +126,22 @@ private:
VertexRenderStruct healthBarMesh;
std::unordered_map<std::string, std::shared_ptr<Texture>> meshTextures;
struct PresentationSample {
Eigen::Vector3f position = Eigen::Vector3f::Zero();
float facingAngle = 0.0f;
float animationFrame = 0.0f;
AnimationState currentState = AnimationState::STAND;
bool enabled = true;
};
PresentationSample previousPresentationSample_;
PresentationSample currentPresentationSample_;
std::chrono::steady_clock::time_point lastPresentationUpdate_;
bool hasPresentationSample_ = false;
AnimationState resolveActiveState(const CharacterState& state) const;
CharacterState interpolatedState(const CharacterState& state) const;
void updateAnimationForRender(const CharacterState& state);
bool prepareGpuSkinning(const CharacterState& state);
void drawAttachedWeapon(Renderer& renderer, const CharacterState& state);