From bf8113d9b15c53c4b657795de607799b725e8560 Mon Sep 17 00:00:00 2001 From: Filip Vincze <vincze.filip@gmail.com> Date: Thu, 22 Feb 2024 15:59:24 +0100 Subject: [PATCH] Add Rectangle Rendering --- src/presenter.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/presenter.cpp b/src/presenter.cpp index 584b0a2..1230fc0 100644 --- a/src/presenter.cpp +++ b/src/presenter.cpp @@ -27,7 +27,6 @@ void Presenter::initialize() ); // --- BEGIN test_box --- - com::Folder* const test_box = gfx::object_system()->insert_object( { "maker", "test_box" }, gfx::shader_generators()->insert_shader_forward_uniform_color(), @@ -46,6 +45,20 @@ void Presenter::initialize() // --- END test_box --- + com::Folder * const test_rect = gfx::object_system()->insert_object( + { "maker", "test_rect" }, + gfx::shader_generators()->insert_shader_forward_uniform_color_ui(), + gfx::buffer_generators()->insert_procedural_rectangle({ 2.0f, 2.0f }, "test_rect", { "maker" }) + ); + gfx::object_system()->push_frame_back( + test_rect, + root()->push_back<com::Folder>("text_rect")->push_back<com::Frame>() + ); + gfx::object_system()->get_uniforms(test_rect)->push_back<com::FileVec3>("material_ambient_color", vec3{ 0.75f, 0.75f, 0 }); + gfx::object_system()->get_uniforms(test_rect)->push_back<com::FileMat4x4>("view_matrix", mat4x4{1.0f}); + gfx::object_system()->get_uniforms(test_rect)->push_back<com::FileMat4x4>("model_matrix", mat4x4{1.0f}); + gfx::object_system()->get_uniforms(test_rect)->push_back<com::FileMat4x4>("projection_matrix", glm::ortho(0, 320, 240, 0, -1, 1)); + // --- BEGIN directional light --- com::Frame* const frame_light = root()->push_back<com::Folder>("directional_light")->push_back<com::Frame>(); @@ -66,6 +79,7 @@ void Presenter::release() osi::presenters()->find<com::Folder>("maker")->erase(self_name() + ".link"); root()->erase("test_box"); + root()->erase("test_rect"); } void Presenter::next_round() -- GitLab