/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */
#pragma once

#include "MorphableCamera.hpp"
#include "Controller/CameraController.hpp"
#include "Input/InputManager.hpp"
#include "Input/InputKey.hpp"
#include "Math/Math.hpp"

namespace OpenVulkano::Scene
{
	class MorphableCameraController final : public CameraController
	{
		double m_animationDuration;
		double m_currentTime;
		bool m_isMorphing;
		bool m_targetMorphStatePerspective; // true for perspective, false for orthographic

		Input::InputAction* m_actionMorph;
		bool m_wasMorphingKeyDown = false;

	public:
		MorphableCameraController(MorphableCamera* camera = nullptr);

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
		void Init(MorphableCamera* camera);
#pragma clang diagnostic pop
		void Tick() override;

		void SetDuration(double duration) { m_animationDuration = duration; }
		[[nodiscard]] double GetDuration() { return m_animationDuration; }
		void SetTargetState(bool toPerspective);
		void Reset() { m_currentTime = 0; }
	};
}