CoriEngine
Loading...
Searching...
No Matches
ShaderProgram.cpp
Go to the documentation of this file.
1
#include "
ShaderProgram.hpp
"
2
#include "
Core/Application.hpp
"
3
#include "
OpenGL/GL_ShaderProgram.hpp
"
4
5
namespace
Cori
{
6
namespace
Graphics
{
7
std::shared_ptr<ShaderProgram>
ShaderProgram::Create
(
const
std::filesystem::path& vertexPath,
const
std::filesystem::path& fragmentPath,
const
std::filesystem::path& geometryPath) {
8
switch
(
Core::Window::GetCurrentAPI
()) {
9
case
GraphicsAPIs::OpenGL
:
10
{
11
auto
shader = std::make_shared<Internal::OpenGLShaderProgram>(vertexPath, fragmentPath, geometryPath);
12
CORI_CORE_ASSERT
(shader,
"Failed to create Texture2D for API: {}. Check registrations and API validity."
,
APIEnumToName
(
Core::Window::GetCurrentAPI
()));
13
return
shader;
14
break
;
15
}
16
case
GraphicsAPIs::Vulkan
:
17
{
18
CORI_CORE_ASSERT
(
false
,
"Unsupported Graphics API."
);
19
}
20
case
GraphicsAPIs::None
:
21
{
22
break
;
23
}
24
}
25
26
return
nullptr
;
27
}
28
29
std::shared_ptr<ShaderProgram>
ShaderProgram::Create
(
const
Descriptor
& descriptor) {
30
return
Create
(descriptor.
m_VertexPath
, descriptor.
m_FragmentPath
, descriptor.
m_GeometryPath
);
31
}
32
}
33
}
Application.hpp
GL_ShaderProgram.hpp
CORI_CORE_ASSERT
#define CORI_CORE_ASSERT(x,...)
Definition
Logger.hpp:1029
ShaderProgram.hpp
Cori::Core::Window::GetCurrentAPI
static Graphics::GraphicsAPIs GetCurrentAPI()
Returns the graphical API used by this window.
Definition
Window.hpp:63
Cori::Graphics::ShaderProgram::Descriptor
Definition
ShaderProgram.hpp:7
Cori::Graphics::ShaderProgram::Descriptor::m_FragmentPath
const std::filesystem::path m_FragmentPath
Definition
ShaderProgram.hpp:32
Cori::Graphics::ShaderProgram::Descriptor::m_VertexPath
const std::filesystem::path m_VertexPath
Definition
ShaderProgram.hpp:31
Cori::Graphics::ShaderProgram::Descriptor::m_GeometryPath
const std::filesystem::path m_GeometryPath
Definition
ShaderProgram.hpp:33
Cori::Graphics::ShaderProgram::Create
static std::shared_ptr< ShaderProgram > Create(const std::filesystem::path &vertexPath, const std::filesystem::path &fragmentPath, const std::filesystem::path &geometryPath={})
Definition
ShaderProgram.cpp:7
Cori::Graphics
Almost everything connected to graphics is in this namespace.
Definition
Window.hpp:7
Cori::Graphics::GraphicsAPIs::Vulkan
@ Vulkan
I want to support vulkan, BUT later-later.
Definition
GraphicsAPIs.hpp:17
Cori::Graphics::GraphicsAPIs::None
@ None
Invalid enumerator.
Definition
GraphicsAPIs.hpp:9
Cori::Graphics::GraphicsAPIs::OpenGL
@ OpenGL
The only one available for now.
Definition
GraphicsAPIs.hpp:13
Cori::Graphics::APIEnumToName
static const char * APIEnumToName(const GraphicsAPIs api)
Definition
GraphicsAPIs.hpp:20
Cori
Global engine namespace.
Definition
AssetLoadStatus.hpp:3
CoriEngine
Engine
src
Graphics
ShaderProgram.cpp
Generated by
1.14.0