NoJobEngine 2.0.7
Loading...
Searching...
No Matches
RenderCommand.cpp
Go to the documentation of this file.
5#include <stdexcept>
6
7namespace NoJob
8{
9 std::unique_ptr<RendererAPI> RenderCommand::s_RendererAPI;
10
12 {
13 switch (RendererAPI::GetAPI())
14 {
16 s_RendererAPI = std::make_unique<OpenGLRendererAPI>();
17 break;
19 throw std::runtime_error(
20 "NoJobEngine: Vulkan backend is not implemented yet.");
21 default:
22 throw std::runtime_error(
23 "NoJobEngine: no graphics API selected.");
24 }
25
26 s_RendererAPI->Init();
27 }
28
30 std::uint32_t x,
31 std::uint32_t y,
32 std::uint32_t width,
33 std::uint32_t height)
34 {
35 s_RendererAPI->SetViewport(x, y, width, height);
36 }
37
38 void RenderCommand::SetClearColor(float r, float g, float b, float a)
39 {
40 s_RendererAPI->SetClearColor(r, g, b, a);
41 }
42
44 {
45 s_RendererAPI->Clear();
46 }
47
48 void RenderCommand::DrawIndexed(const VertexArray& vertexArray)
49 {
50 s_RendererAPI->DrawIndexed(vertexArray);
51 }
53 const VertexArray& vertexArray,
54 std::uint32_t indexCount,
55 std::uint32_t indexOffset)
56 {
57 s_RendererAPI->DrawIndexedRange(vertexArray,indexCount,indexOffset);
58 }
59
61 const VertexArray& vertexArray,
62 std::uint32_t vertexCount)
63 {
64 s_RendererAPI->DrawLines(
65 vertexArray,
66 vertexCount);
67 }
68}
OpenGLRendererAPI declarations for the OpenGL Backend subsystem.
RenderCommand declarations for the Rendering subsystem.
RendererAPI declarations for the Rendering subsystem.
VertexArray declarations for the Rendering subsystem.
static void SetClearColor(float r, float g, float b, float a)
static void DrawLines(const VertexArray &vertexArray, std::uint32_t vertexCount)
static void DrawIndexedRange(const VertexArray &vertexArray, std::uint32_t indexCount, std::uint32_t indexOffset)
static void DrawIndexed(const VertexArray &vertexArray)
static void SetViewport(std::uint32_t x, std::uint32_t y, std::uint32_t width, std::uint32_t height)
static GraphicsAPI GetAPI()
Definition RendererAPI.h:49