/*
 * 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 "Scene/Camera.hpp"
#include "IRecordable.hpp"
#include "Vulkan/Resources/UniformBuffer.hpp"

namespace OpenVulkano::Vulkan
{
class VulkanCamera : public IRenderResource<Scene::Camera>, public IRecordable
	{
		const Unique<UniformBuffer> m_buffer;

	public:
		VulkanCamera(Scene::Camera* camera, UniformBuffer* uniformBuffer)
			: IRenderResource<Scene::Camera>(camera), m_buffer(uniformBuffer)
		{}

		~VulkanCamera() override = default;

		void Record(VulkanDrawContext* context) override
		{
			m_buffer->Update(GetCamera()->GetData(), Scene::Camera::SIZE, context->currentImageId);
			m_buffer->Record(context);
		}
		
		[[nodiscard]] Scene::Camera* GetCamera() const { return GetOwner(); }

		void Release() override
		{
			/* TODO */
		}
	};
}
