#include "CShaderFactory.hpp"
#include "../CKernel.hpp"
#include "../../Specific/Graphic/OpenGLImpl/CShaderOpenGLImpl.hpp"

CShader* CShaderFactory::createShader(CKernel* e, std::string name, std::string vertexPath, std::string fragmentPath) {
	if (e == nullptr) {
		throw CLogicException("CKernel is null");
	}
	return createShader(e->getEngineConfig()->getGraphicImplementation(), name, vertexPath, fragmentPath);
}

CShader* CShaderFactory::createShader(CKernel* e, std::string name, std::string vertexPath, std::string fragmentPath, std::string geomPath) {
	if (e == nullptr) {
		throw CLogicException("CKernel is null");
	}
	return createShader(e->getEngineConfig()->getGraphicImplementation(), name, vertexPath, fragmentPath, geomPath);
}

CShader* CShaderFactory::createShader(EGraphicImplementation e, std::string name, std::string vertexPath, std::string fragmentPath) {
	switch (e) {
	case EGraphicImplementation::GRAPHIC_OPENGL:
		return new CShaderOpenGLImpl(name, vertexPath, fragmentPath);
		break;
	}
	throw CLogicException("Unexpected error while creating shader");

}

CShader* CShaderFactory::createShader(EGraphicImplementation e, std::string name, std::string vertexPath, std::string fragmentPath, std::string geomPath) {
	switch (e) {
	case EGraphicImplementation::GRAPHIC_OPENGL:
		return new CShaderOpenGLImpl(name, vertexPath, fragmentPath, geomPath);
		break;
	}
	throw CLogicException("Unexpected error while creating shader");
}