//
// Created by martin on 16.11.21.
//

#ifndef ANIMTESTBED_LOCKBONES_H
#define ANIMTESTBED_LOCKBONES_H

#include "../AnimNode.h"

struct LockTranslationNode : public AnimNode {
  LockTranslationNode(AnimationController* animation_controller)
      : AnimNode(animation_controller),
        m_input(nullptr),
        m_locked_bone_index(0),
        m_lock_x(false),
        m_lock_y(false),
        m_lock_z(false) {}

  virtual ~LockTranslationNode() {}

  AnimNode* m_input;
  int m_locked_bone_index;
  bool m_lock_x;
  bool m_lock_y;
  bool m_lock_z;

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

  virtual void UpdateIsSynced(bool is_synced) override {
    m_is_time_synced = is_synced;

    m_input->UpdateIsSynced(m_is_time_synced);
  }

  virtual void UpdateSyncTrack() override {
    m_sync_track = m_input->m_sync_track;
  }

  virtual void UpdateTime(float dt) { m_input->UpdateTime(dt); }

  virtual void Evaluate(
      ozz::vector<ozz::math::SoaTransform>* local_matrices,
      ozz::math::Transform* root_transform = nullptr) override;

  virtual void GetInputNodes(
      std::vector<AnimNode*>& input_nodes) const override {
    input_nodes.push_back(m_input);
  };

  virtual void DrawDebugUi() override;
};

#endif  //ANIMTESTBED_LOCKBONES_H
