highlighting is hard

main
Brett 2024-05-12 21:48:43 -04:00
parent 922de9d242
commit 7c82253251
6 changed files with 17 additions and 15 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.25)
set(BLT_GRAPHICS_VERSION 0.13.12)
set(BLT_GRAPHICS_VERSION 0.13.13)
set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})

View File

@ -213,11 +213,10 @@ namespace blt::gfx
explicit batch_renderer_2d(resource_manager& resources, matrix_state_manager& state): resources(resources), state(state)
{
engine = pp_engine_t::make_multi_pp(std::make_unique<pp_outline_target_t>(),
std::make_unique<pp_mouse_highlight_step_t>(frame_buffer_t::attachment_t::COLOR1),
//std::make_unique<pp_blur_step_inplace_t>(state, frame_buffer_t::attachment_t::COLOR1),
//std::make_unique<pp_multiplier_step_inplace_t>(frame_buffer_t::attachment_t::COLOR1,
// vec4{4, 4, 4, 1}),
//std::make_unique<pp_overlay_blur_step_t>(frame_buffer_t::attachment_t::COLOR1, 2, 2),
std::make_unique<pp_blur_step_inplace_t>(state, frame_buffer_t::attachment_t::COLOR1),
std::make_unique<pp_multiplier_step_inplace_t>(frame_buffer_t::attachment_t::COLOR1,
vec4{4, 4, 4, 1}),
std::make_unique<pp_overlay_blur_step_t>(frame_buffer_t::attachment_t::COLOR1, 2, 2),
std::make_unique<pp_outline_step_t>(state)
);
}

View File

@ -22,19 +22,22 @@ void main() {
}
}
float px = mousePos.x / float(size.x);
float py = mousePos.y / float(size.y);
float dx = (gl_FragCoord.x - mousePos.x) / float(size.x);
float dy = (gl_FragCoord.y - mousePos.y) / float(size.y);
float distx = sqrt(dx * dx);
float disty = sqrt(dy * dy);
float distx = 1.0 - sqrt(dx * dx);
float disty = 1.0 - sqrt(dy * dy);
float dist = (distx + disty) / 2.0;
vec4 n_color = result / vec4((float(size.z) * 2.0 + 1.0) * (float(size.w) * 2.0 + 1.0));
FragColor = vec4(distx, disty, 0.0, 1.0);
n_color = n_color * vec4(16.0);
if (dist >= 0.5)
FragColor = normalize(n_color);
else
FragColor = texture(tex, uv);
//FragColor = ;
}

@ -1 +1 @@
Subproject commit a1b06823fe2d964a62fda99385499b218cf5cea5
Subproject commit 231cbee0fc4f59dbe5b8b853a11b08dc84e57c65

@ -1 +1 @@
Subproject commit 6675317107257c2cc16c947b359d557821d85bf2
Subproject commit 111397c71a5f1c2c88e05da9c84edfdba2e472a4

View File

@ -315,6 +315,6 @@ namespace blt::gfx
shader->bind();
auto v = vec2(getWindowWidth(), getWindowHeight());
shader->setVec4("mousePos", blt::make_vec4(blt::vec2{getMouseX(), v.y() - getMouseY()}));
shader->setVec4i("size", {static_cast<i32>(v.x()), static_cast<i32>(v.y()), 2, 2});
shader->setVec4i("size", {static_cast<i32>(v.x()), static_cast<i32>(v.y()), 4, 4});
}
}