diff --git a/CMakeLists.txt b/CMakeLists.txt index a7a4c63..eff7834 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.25) -set(BLT_GRAPHICS_VERSION 0.13.22) +set(BLT_GRAPHICS_VERSION 0.13.23) set(BLT_GRAPHICS_TEST_VERSION 0.0.1) project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION}) diff --git a/include/blt/gfx/renderer/batch_2d_renderer.h b/include/blt/gfx/renderer/batch_2d_renderer.h index 57560be..5aac4dc 100644 --- a/include/blt/gfx/renderer/batch_2d_renderer.h +++ b/include/blt/gfx/renderer/batch_2d_renderer.h @@ -207,7 +207,9 @@ namespace blt::gfx void post_reset(); void draw_points(bool outlined, bool clear, const f32 denominator); + void draw_lines(bool outlined, bool clear, const f32 denominator); + void draw_rectangles(bool outlined, bool clear, const f32 denominator); void draw_objects(); @@ -224,6 +226,10 @@ namespace blt::gfx engine = pp_engine_t::make_multi_pp(std::make_unique()); } + explicit batch_renderer_2d(resource_manager& resources, matrix_state_manager& state, std::unique_ptr ppEngine): + engine(std::move(ppEngine)), resources(resources), state(state) + {} + void create(); void drawRectangleInternal(std::string_view texture, const rectangle2d_t& rectangle, f32 z_index = 0); diff --git a/libraries/imgui b/libraries/imgui index 46691d1..0e4dcfa 160000 --- a/libraries/imgui +++ b/libraries/imgui @@ -1 +1 @@ -Subproject commit 46691d172ec65915b6a1e14dd9ae2c0a49dd15c4 +Subproject commit 0e4dcfa55299eebd4659181b3622d24566f2f764 diff --git a/src/blt/gfx/renderer/batch_2d_renderer.cpp b/src/blt/gfx/renderer/batch_2d_renderer.cpp index 0326ada..8a2594f 100644 --- a/src/blt/gfx/renderer/batch_2d_renderer.cpp +++ b/src/blt/gfx/renderer/batch_2d_renderer.cpp @@ -252,10 +252,8 @@ namespace blt::gfx mat4x4 model; model.translate(point.pos.x(), point.pos.y(), 0.0f); - if (outlined) + if (outlined && render_info.outline) { - if (!render_info.outline) - continue; model.scale(point.scale * render_info.outline_thickness, point.scale * render_info.outline_thickness, 1.0); point_shader->setVec4("color", render_info.outline_color); point_shader->setVec4("use_texture", blt::vec4{0,0,0,0}); @@ -295,9 +293,7 @@ namespace blt::gfx auto& [z_index, line] = object; float thickness = line.thickness; - if (outlined){ - if (!render_info.outline) - continue; + if (outlined && render_info.outline){ square_shader->setVec4("color", render_info.outline_color); square_shader->setVec4("use_texture", {0,0,0,0}); thickness *= render_info.outline_thickness; @@ -359,9 +355,7 @@ namespace blt::gfx auto& [z_index, rect] = object; mat4x4 model; - if (outlined) { - if (!render_info.outline) - continue; + if (outlined && render_info.outline) { auto nsx = rect.size.x() * render_info.outline_thickness; auto nsy = rect.size.y() * render_info.outline_thickness; auto ns = blt::vec2(nsx, nsy);