From 64223a0cfd2fb2da0e2d02017b6cd7ccc3d7e8f0 Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 20 Mar 2025 14:32:00 -0400 Subject: [PATCH] remove extra vertices when drawing curves --- CMakeLists.txt | 2 +- libraries/BLT | 2 +- src/blt/gfx/renderer/batch_2d_renderer.cpp | 13 ++++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b04854..23e1dfb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.25) include(FetchContent) -set(BLT_GRAPHICS_VERSION 2.0.2) +set(BLT_GRAPHICS_VERSION 2.0.3) set(BLT_GRAPHICS_TEST_VERSION 0.0.1) project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION}) diff --git a/libraries/BLT b/libraries/BLT index ebf0a80..79148a8 160000 --- a/libraries/BLT +++ b/libraries/BLT @@ -1 +1 @@ -Subproject commit ebf0a80774fba3b4c6e7ccfc51193b9a3299cdbc +Subproject commit 79148a8506b1e26a5197977b4ece1091f026b052 diff --git a/src/blt/gfx/renderer/batch_2d_renderer.cpp b/src/blt/gfx/renderer/batch_2d_renderer.cpp index cfe1900..887f5e9 100644 --- a/src/blt/gfx/renderer/batch_2d_renderer.cpp +++ b/src/blt/gfx/renderer/batch_2d_renderer.cpp @@ -82,14 +82,17 @@ namespace blt::gfx const vec2 right = {dir.y(), -dir.x()}; const vec2 left = {-dir.y(), dir.x()}; - auto bottom_left = line.p1 + left * thickness; - auto bottom_right = line.p1 + right * thickness; - auto top_left = line.p2 + left * thickness; auto top_right = line.p2 + right * thickness; - vertices.push_back({make_vec3(bottom_right), vec2{1, 0}}); - vertices.push_back({make_vec3(bottom_left), vec2{0, 0}}); + if (i == 0) + { + auto bottom_left = line.p1 + left * thickness; + auto bottom_right = line.p1 + right * thickness; + + vertices.push_back({make_vec3(bottom_right), vec2{1, 0}}); + vertices.push_back({make_vec3(bottom_left), vec2{0, 0}}); + } if (i == lines.size() - 1) {