/*
 * 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 <typeinfo>

namespace OpenVulkano
{
	namespace Vulkan
	{
		class VulkanDrawContext;
	}

	namespace Scene
	{
		class Drawable;

		struct DrawEncoder
		{
			//region function type definitions
			typedef void(* VkEncodeFunc)(Drawable*, Vulkan::VulkanDrawContext*);
			//endregion

			//region DrawEncoder storage
			VkEncodeFunc vulkan;
			//endregion

			//region DrawEncoder constructors
			DrawEncoder();

			DrawEncoder(const DrawEncoder& other) = default;
			//endregion

			//region static functions
			static void* RegisterVulkanEncodeFunction(const std::type_info* type, VkEncodeFunc func);

			static DrawEncoder& GetDrawEncoder(const std::type_info* type);
			//endregion

			//region Template helper functions
			template<class T>
			static DrawEncoder& GetDrawEncoder()
			{
				return { GetDrawEncoder(&typeid(T)) };
			}

			template<class T>
			static void* RegisterVulkanEncodeFunction(VkEncodeFunc func)
			{
				return RegisterVulkanEncodeFunction(&typeid(T), func);
			}
			//endregion
		};
	}
}