From 3588dcbd499314284523f53cf037c290c9c62d73 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 1 May 2024 21:32:53 -0400 Subject: [PATCH] camera speed scaling --- CMakeLists.txt | 2 +- include/blt/gfx/renderer/2d_textured_circle.frag | 4 ++-- libraries/BLT | 2 +- src/blt/gfx/renderer/camera.cpp | 7 ++++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c77e3f..2001379 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.25) -set(BLT_GRAPHICS_VERSION 0.12.4) +set(BLT_GRAPHICS_VERSION 0.12.5) set(BLT_GRAPHICS_TEST_VERSION 0.0.1) project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION}) diff --git a/include/blt/gfx/renderer/2d_textured_circle.frag b/include/blt/gfx/renderer/2d_textured_circle.frag index 75a42ef..92c9e35 100644 --- a/include/blt/gfx/renderer/2d_textured_circle.frag +++ b/include/blt/gfx/renderer/2d_textured_circle.frag @@ -23,9 +23,9 @@ void main() { float ys = pos.y * pos.y; float ts = xs + ys; const float sq = 0.5 * 0.5; - if (ts > sq) + if (ts >= sq) discard; - if (ts + offset > sq) + if (ts + offset >= sq) FragColor = vec4(1.0, 1.0, 1.0, 1.0); else FragColor = (texture(tex, uv) * use_texture) + color; diff --git a/libraries/BLT b/libraries/BLT index e6b4c4a..3f0ea88 160000 --- a/libraries/BLT +++ b/libraries/BLT @@ -1 +1 @@ -Subproject commit e6b4c4a3302c0dbc5decc506dfc4916634b049f5 +Subproject commit 3f0ea887cd2923cb2cf390a4929ffce452301670 diff --git a/src/blt/gfx/renderer/camera.cpp b/src/blt/gfx/renderer/camera.cpp index 2289aa4..7c295a2 100644 --- a/src/blt/gfx/renderer/camera.cpp +++ b/src/blt/gfx/renderer/camera.cpp @@ -18,6 +18,7 @@ #include #include #include +#include void blt::gfx::first_person_camera::update() { @@ -121,12 +122,12 @@ void blt::gfx::first_person_camera_2d::update() { lockable_camera::handle_lock(); - float speed_multi = 1; + float speed_multi = (1/blt::make_vec2(world_scale_)).magnitude(); if (isKeyPressed(GLFW_KEY_LEFT_SHIFT)) - speed_multi = 10; + speed_multi *= 10; if (isKeyPressed(GLFW_KEY_LEFT_CONTROL)) - speed_multi = 0.5; + speed_multi *= 0.5; vec3 direction;