fix brush projection to eliminate seams, still problems with big brushes and need to implement erase

This commit is contained in:
2017-08-13 16:59:58 +01:00
parent 060e08a891
commit 90ee185dcd
7 changed files with 123 additions and 90 deletions

View File

@@ -478,30 +478,6 @@ glm::vec2 Node::GetSize()
return{ GetWidth(), GetHeight() };
}
glm::vec4 Node::rect_intersection(glm::vec4 a, glm::vec4 b) const
{
// convert from [x,y,w,h] to [x1,y1,x2,y1]
a = glm::vec4(a.xy(), a.xy() + a.zw());
b = glm::vec4(b.xy(), b.xy() + b.zw());
// compute intersection
auto o = glm::vec4(glm::max(a.xy(), b.xy()), glm::min(a.zw(), b.zw()));
// back to rect form
o = glm::vec4(o.xy(), glm::max({ 0, 0 }, o.zw() - o.xy()));
return o;
}
glm::vec4 Node::rect_union(glm::vec4 a, glm::vec4 b) const
{
// convert from rect [x,y,w,h] to bb [x1,y1,x2,y1]
a = glm::vec4(a.xy(), a.xy() + a.zw());
b = glm::vec4(b.xy(), b.xy() + b.zw());
// compute union
glm::vec4 o = { glm::min(a.xy(), b.xy()), glm::max(a.zw(), b.zw()) };
// back to rect form
o = glm::vec4(o.xy(), glm::max({ 0, 0 }, o.zw() - o.xy()));
return o;
}
void Node::restore_context()
{
for (auto& c : m_children)