NoJobEngine 2.0.7
Loading...
Searching...
No Matches
Renderer.cpp
Go to the documentation of this file.
5
6namespace NoJob
7{
9 {
11 }
12
14 {
15 }
16
18 {
19 RenderCommand::SetViewport(0, 0, 1600, 900);
20 RenderCommand::SetClearColor(0.08f, 0.09f, 0.11f, 1.0f);
22 }
23
25 {
26 }
27
29 const std::shared_ptr<VertexArray>& vertexArray,
30 const std::shared_ptr<Shader>& shader,
31 const glm::mat4& transform,
32 const glm::mat4& viewProjection,
33 const glm::vec4& color)
34 {
35 Submit(
36 vertexArray,
37 shader,
38 transform,
39 viewProjection,
40 color,
41 0);
42 }
43
45 const std::shared_ptr<VertexArray>& vertexArray,
46 const std::shared_ptr<Shader>& shader,
47 const glm::mat4& transform,
48 const glm::mat4& viewProjection,
49 const glm::vec4& color,
50 int useTexture)
51 {
52 shader->Bind();
53 shader->SetMat4("u_Transform", transform);
54 shader->SetMat4("u_ViewProjection", viewProjection);
55 shader->SetFloat4("u_Color", color);
56 shader->SetInt("u_Texture", 0);
57 shader->SetInt("u_UseTexture", useTexture);
58 RenderCommand::DrawIndexed(*vertexArray);
59 }
61 const std::shared_ptr<VertexArray>& vertexArray,
62 const std::shared_ptr<Shader>& shader,
63 std::uint32_t indexCount, std::uint32_t indexOffset,
64 const glm::mat4& transform, const glm::mat4& viewProjection,
65 const glm::vec4& color, int useTexture)
66 {
67 shader->Bind();
68 shader->SetMat4("u_Transform",transform);
69 shader->SetMat4("u_ViewProjection",viewProjection);
70 shader->SetFloat4("u_Color",color);
71 shader->SetInt("u_Texture",0);
72 shader->SetInt("u_UseTexture",useTexture);
73 RenderCommand::DrawIndexedRange(*vertexArray,indexCount,indexOffset);
74 }
75
76}
RenderCommand declarations for the Rendering subsystem.
Renderer declarations for the Rendering subsystem.
Shader declarations for the Rendering subsystem.
VertexArray declarations for the Rendering subsystem.
static void SetClearColor(float r, float g, float b, float a)
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 void SubmitRange(const std::shared_ptr< VertexArray > &vertexArray, const std::shared_ptr< Shader > &shader, std::uint32_t indexCount, std::uint32_t indexOffset, const glm::mat4 &transform, const glm::mat4 &viewProjection, const glm::vec4 &color, int useTexture)
Definition Renderer.cpp:60
static void Submit(const std::shared_ptr< VertexArray > &vertexArray, const std::shared_ptr< Shader > &shader, const glm::mat4 &transform=glm::mat4(1.0f), const glm::mat4 &viewProjection=glm::mat4(1.0f), const glm::vec4 &color=glm::vec4(1.0f))
Definition Renderer.cpp:28
static void BeginFrame()
Definition Renderer.cpp:17
static void EndFrame()
Definition Renderer.cpp:24
static void Init()
Definition Renderer.cpp:8
static void Shutdown()
Definition Renderer.cpp:13