fix brush projection to eliminate seams, still problems with big brushes and need to implement erase
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user