#include <pch.hpp>

#include <core.hpp>
#include <open_engine/opengl/opengl_texture.hpp>
#include <open_engine/renderer/renderer.hpp>
#include <open_engine/renderer/texture.hpp>

namespace OpenEngine {
    Ref<Texture2D> Texture2D::Create(uint32_t width, uint32_t height)
    {
        OE_PROFILE_FUNCTION();

        switch (Renderer::GetAPI()) {
            case RendererAPI::API::None : OE_CORE_ASSERT(false, "No render API selected!"); return nullptr;
            case RendererAPI::API::OpenGL : return CreateRef<OpenGLTexture2D>(width, height);
        }

        OE_CORE_ASSERT(false, "Selected API not supported");
        return nullptr;
    }

    Ref<Texture2D> Texture2D::Create(const std::string &path)
    {
        OE_PROFILE_FUNCTION();

        switch (Renderer::GetAPI()) {
            case RendererAPI::API::None : OE_CORE_ASSERT(false, "No render API selected!"); return nullptr;
            case RendererAPI::API::OpenGL : return CreateRef<OpenGLTexture2D>(path);
        }

        OE_CORE_ASSERT(false, "Selected API not supported");
        return nullptr;
    }
}
