/*
 * 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 "Renderer.hpp"
#include "Base/FrameMetadata.hpp"

namespace OpenVulkano::Vulkan
{
	class VulkanDrawContext
	{
		VulkanShader* m_lastShader = nullptr;
		VulkanCamera* m_lastCamera = nullptr;

	public:
		const size_t encoderThreadId;
		const size_t currentImageId;
		const size_t frameId = CURRENT_FRAME.frameId;
		vk::CommandBuffer& commandBuffer;
		Renderer* renderer;

		VulkanDrawContext(size_t encThreadId, size_t currentImgId, vk::CommandBuffer& buffer, Renderer* render)
			: encoderThreadId(encThreadId), currentImageId(currentImgId), commandBuffer(buffer), renderer(render)
		{}

		void EncodeShader(Scene::Shader* shader);

		void EncodeShader(VulkanShader* shader);

		void EncodeNode(Scene::Node* node);

		void SetCamera(Scene::Camera* camera);

		[[nodiscard]] VulkanShader* GetShader() const { return m_lastShader; }
		
		[[nodiscard]] VulkanCamera* GetCamera() const { return m_lastCamera; }
	};
}
