Skip to content
Snippets Groups Projects
Commit bf8113d9 authored by Filip Vincze's avatar Filip Vincze
Browse files

Add Rectangle Rendering

parent b4475b35
No related branches found
No related tags found
No related merge requests found
......@@ -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});
  • Owner

    You do not need to set Model/View/Projection matrices as they are fetched automatically from Frame instances. Namely, Model matrix will be taken from the frame you create on the line 53. View and projection matrices will be fetched from the active camera. To setup "screen-space" rendering you only need to make the frame of the active camera to be parent of the frame created at line 53. To do so, you insert com::Link named by https://gitlab.fi.muni.cz/qtrtik/age_libraries/-/blob/main/com/include/com/frame.hpp?ref_type=heads#L18 referencing the frame of the camera.

  • Please register or sign in to reply
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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment