#pragma once
#include "render_context.h"
#include "singleton.h"
namespace engineapi
{
	class Mesh;
	class Shader;
	class Camera;
	class RenderNode;
	class RenderAPI : public Singleton<RenderAPI>
	{
	protected:
		uint32_t mFrame;
		ViewPortInfo mViewPortInfo;

		vector<RenderNode*> mCurNodes;
		vector<RenderNode*> mAllNodes;
	public:
		RenderAPI();
		virtual ~RenderAPI() {};
	public:
		virtual RenderContext* GetContext() = 0;
	public:
		virtual void OnInit();
		virtual void InitRenderNode();
		virtual void InitRenderPass() = 0;
	public:
		virtual void SetViewPort(uint32_t width, uint32_t height, uint32_t xOffset = 0, uint32_t yOffset = 0) = 0;
		virtual void BeginFrame() = 0;
		virtual void Render(Camera& camera);
		virtual void EndFrame() = 0;
		virtual void SetStaticMesh(Mesh* mesh) = 0;
		virtual void DrawStaticMesh(Mesh* mesh) = 0;

		virtual void LoadShader(Shader* shader) = 0;
		virtual void SwitchContext() = 0;


	public:
		static RenderAPI* MakeInstance();
	};
}
template<>
engineapi::RenderAPI* Singleton<engineapi::RenderAPI>::ms_Singleton = nullptr;