move the ui/shaders reload into the ui thread, add rtt region copy, add box/rect conversion

This commit is contained in:
2019-07-17 07:04:44 +02:00
parent 6a0b654228
commit 4b73647c98
5 changed files with 64 additions and 13 deletions

View File

@@ -22,6 +22,18 @@ bool point_in_rect(const glm::vec2& p, const glm::vec4& r)
return p.x > r.x && p.x < r.x+r.z && p.y > r.y && p.y < r.y+r.w;
}
// from {origin, size} to {min, max}
glm::vec4 rect_to_box(const glm::vec4& r)
{
return { xy(r), xy(r) + zw(r) };
}
// from {min, max} to {origin, size}
glm::vec4 box_to_rect(const glm::vec4& b)
{
return { xy(b), zw(b) - xy(b) };
}
// params and returns {origin, size} form
glm::vec4 rect_intersection(glm::vec4 a, glm::vec4 b)
{