KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
RenderCommand.h
Go to the documentation of this file.
1
10#pragma once
11
12#include "krpch.h"
13
14#include "RendererAPI.h"
15
16namespace Karma
17{
22 {
23 public:
31 static void Init();
32
38 static void DeInit();
39
45 inline static void SetClearColor(const glm::vec4& color)
46 {
47 s_RendererAPI->SetClearColor(color);
48 }
49
58 inline static void Clear()
59 {
60 s_RendererAPI->Clear();
61 }
62
81 inline static void BeginScene()
82 {
83 s_RendererAPI->BeginScene();
84 }
85
96 inline static void DrawIndexed(const std::shared_ptr<VertexArray>& vertexArray)
97 {
98 s_RendererAPI->DrawIndexed(vertexArray);
99 }
100
106 static void EndScene()
107 {
108 s_RendererAPI->EndScene();
109 }
110
116 inline static glm::vec4& GetClearColor()
117 {
118 return s_RendererAPI->GetClearColor();
119 }
120
126 inline static RendererAPI* GetRendererAPI() { return s_RendererAPI; }
127
128 private:
129 static RendererAPI* s_RendererAPI;
130 };
131}
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
This file contains the class RendererAPI.
A class with static routines relevant for rendering a scene using RendererAPI.
Definition RenderCommand.h:22
static RendererAPI * GetRendererAPI()
Getter for the renderer API.
Definition RenderCommand.h:126
static void EndScene()
The clearing of resources, if any, at the end of frame.
Definition RenderCommand.h:106
static void DeInit()
Deinitialize RenderCommand by freeing up rendering resources.
Definition RenderCommand.cpp:30
static void Clear()
Clears the rendering screen.
Definition RenderCommand.h:58
static void DrawIndexed(const std::shared_ptr< VertexArray > &vertexArray)
Actually issue a draw call of primitives with indexed vertices.
Definition RenderCommand.h:96
static glm::vec4 & GetClearColor()
Getter for the set clear color.
Definition RenderCommand.h:116
static void Init()
Initializing RenderCommand by creating the instance of appropriate RendererAPI Called in the main fun...
Definition RenderCommand.cpp:9
static void BeginScene()
Setting up resources for rendering of a scene.
Definition RenderCommand.h:81
static void SetClearColor(const glm::vec4 &color)
Sets the background color of the screen.
Definition RenderCommand.h:45
An abstract class for a renderer.
Definition RendererAPI.h:23