//
// Created by martin on 12.11.21.
//

#ifndef ANIMTESTBED_ANIMNODE_H
#define ANIMTESTBED_ANIMNODE_H

#include <string>

#include "AnimationController.h"

enum class AnimNodeType {
  Blend,
  SpeedScale,
  AnimSampler
};

struct AnimNode {
  AnimNode(AnimationController* animation_controller)
      : m_animation_controller(animation_controller),
        m_current_time(0.f),
        m_is_time_synced(false),
        m_anim_duration(0.f) {}
  virtual ~AnimNode(){};

  AnimNodeType m_anim_node_type;
  std::string m_name;
  float m_current_time;
  bool m_is_time_synced;
  float m_anim_duration;
  AnimationController* m_animation_controller;
  ozz::vector<ozz::math::SoaTransform> m_local_matrices;

  virtual void Reset() { m_current_time = 0.f; }

  virtual void UpdateIsSynced(bool is_synced) = 0;

  virtual void EvalAnimDuration() = 0;

  virtual void UpdateTime(float dt) { m_current_time += dt; }

  virtual void Evaluate(
      ozz::vector<ozz::math::SoaTransform>* local_matrices) = 0;

  virtual void CollectNodeOrdering(std::vector<AnimNode*>& anim_nodes) = 0;

  virtual void DrawDebugUi(){};
};

#endif  //ANIMTESTBED_ANIMNODE_H
