From 8cf6858a6cd958f31521c4ce680cf2011bfb7cc3 Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 12 Aug 2025 18:41:26 +0200 Subject: [add]: Camera --- src/Rendering/Renderer.h | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/Rendering/Renderer.h') diff --git a/src/Rendering/Renderer.h b/src/Rendering/Renderer.h index 29f66a5..d08d015 100644 --- a/src/Rendering/Renderer.h +++ b/src/Rendering/Renderer.h @@ -33,6 +33,7 @@ namespace Donut virtual void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) = 0; virtual void SetClearColor(const glm::vec4& color) = 0; virtual void Clear() = 0; + virtual void EnableDepthTest() = 0; virtual void DrawIndexed(const std::shared_ptr& vertexArray, uint32_t indexCount = 0) = 0; @@ -46,23 +47,33 @@ namespace Donut class RenderCommand { public: - inline static void Init() { + inline static void Init() + { s_RendererAPI->Init(); } - inline static void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) { + inline static void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) + { s_RendererAPI->SetViewport(x, y, width, height); } - inline static void SetClearColor(const glm::vec4& color) { + inline static void SetClearColor(const glm::vec4& color) + { s_RendererAPI->SetClearColor(color); } - inline static void Clear() { + inline static void Clear() + { s_RendererAPI->Clear(); } - inline static void DrawIndexed(const std::shared_ptr& vertexArray, uint32_t indexCount = 0) { + inline static void EnableDepthTest() + { + s_RendererAPI->EnableDepthTest(); + } + + inline static void DrawIndexed(const std::shared_ptr& vertexArray, uint32_t indexCount = 0) + { s_RendererAPI->DrawIndexed(vertexArray, indexCount); } @@ -78,23 +89,14 @@ namespace Donut static void OnWindowResize(uint32_t width, uint32_t height); - static void BeginScene(); - static void EndScene(); - static void Submit(const std::shared_ptr& shader, const std::shared_ptr& vertexArray, - const glm::mat4& transform = glm::mat4(1.0f)); + const glm::mat4& transform, + const glm::mat4& viewProjection); static void SetClearColor(const glm::vec4& color); static void Clear(); inline static RendererAPI::API GetAPI() { return RendererAPI::GetAPI(); } - private: - struct SceneData - { - glm::mat4 ViewProjectionMatrix; - }; - - static SceneData* s_SceneData; }; }; -- cgit v1.3