#include "renderapi.h"
#include "node/rendernode.h"
#include "node/rendernode_forward.h"
#ifdef VULKAN_API
#include "vulkanapi/vulkanapi.h"
#endif // VULKAN_API
namespace engineapi {
	RenderAPI::RenderAPI()
	{

	}
	void RenderAPI::OnInit()
	{
		InitRenderNode();
		InitRenderPass();
	}
	void RenderAPI::InitRenderNode()
	{
		mAllNodes.clear();
		mAllNodes.resize(RENDER_COUNT);
		mAllNodes[RENDER_FORWARD_RENDERING] = new RenderNodeForwardRendering();
		
		//mCurPasses.push_back(mAllPasses[ZX_RENDER_PASS_SHADOW_GENERATION]);
		mCurNodes.push_back(mAllNodes[RENDER_FORWARD_RENDERING]);
		//mCurPasses.push_back(mAllPasses[ZX_RENDER_PASS_AFTER_EFFECT_RENDERING]);
		//mCurPasses.push_back(mAllPasses[ZX_RENDER_PASS_UI_RENDERING]);
	}
	void RenderAPI::Render(Camera& camera)
	{
		for (auto node : mCurNodes) {
			node->Render(camera);
		}
	}
	RenderAPI* RenderAPI::MakeInstance()
	{
#ifdef VULKAN_API
		return new vulkanapi::RenderVulkanAPI();
#endif
	}
}