camera speed scaling

main
Brett 2024-05-01 21:32:53 -04:00
parent 26c1953bc0
commit 3588dcbd49
4 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.25) 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) set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION}) project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})

View File

@ -23,9 +23,9 @@ void main() {
float ys = pos.y * pos.y; float ys = pos.y * pos.y;
float ts = xs + ys; float ts = xs + ys;
const float sq = 0.5 * 0.5; const float sq = 0.5 * 0.5;
if (ts > sq) if (ts >= sq)
discard; discard;
if (ts + offset > sq) if (ts + offset >= sq)
FragColor = vec4(1.0, 1.0, 1.0, 1.0); FragColor = vec4(1.0, 1.0, 1.0, 1.0);
else else
FragColor = (texture(tex, uv) * use_texture) + color; FragColor = (texture(tex, uv) * use_texture) + color;

@ -1 +1 @@
Subproject commit e6b4c4a3302c0dbc5decc506dfc4916634b049f5 Subproject commit 3f0ea887cd2923cb2cf390a4929ffce452301670

View File

@ -18,6 +18,7 @@
#include <blt/gfx/renderer/camera.h> #include <blt/gfx/renderer/camera.h>
#include <blt/gfx/window.h> #include <blt/gfx/window.h>
#include <blt/std/logging.h> #include <blt/std/logging.h>
#include <blt/math/log_util.h>
void blt::gfx::first_person_camera::update() void blt::gfx::first_person_camera::update()
{ {
@ -121,12 +122,12 @@ void blt::gfx::first_person_camera_2d::update()
{ {
lockable_camera::handle_lock(); lockable_camera::handle_lock();
float speed_multi = 1; float speed_multi = (1/blt::make_vec2(world_scale_)).magnitude();
if (isKeyPressed(GLFW_KEY_LEFT_SHIFT)) if (isKeyPressed(GLFW_KEY_LEFT_SHIFT))
speed_multi = 10; speed_multi *= 10;
if (isKeyPressed(GLFW_KEY_LEFT_CONTROL)) if (isKeyPressed(GLFW_KEY_LEFT_CONTROL))
speed_multi = 0.5; speed_multi *= 0.5;
vec3 direction; vec3 direction;