move the ui/shaders reload into the ui thread, add rtt region copy, add box/rect conversion
This commit is contained in:
12
src/util.cpp
12
src/util.cpp
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user