fix: dont fill blob corners when inside other blob
This commit is contained in:
parent
a714917300
commit
8107627737
1 changed files with 14 additions and 4 deletions
|
|
@ -305,10 +305,20 @@ void BlobShape::updatePolish() {
|
||||||
if (riExcludeMask & (1 << j))
|
if (riExcludeMask & (1 << j))
|
||||||
continue;
|
continue;
|
||||||
const auto& rj = m_cachedRects[j];
|
const auto& rj = m_cachedRects[j];
|
||||||
fTr = std::min(fTr, cpuSmoothstep(0.0f, smoothFactor, cpuSdBox(cTrX, cTrY, rj.cx, rj.cy, rj.hw, rj.hh)));
|
// Skip when the corner is inside rj: it's buried, not on a visible junction,
|
||||||
fBr = std::min(fBr, cpuSmoothstep(0.0f, smoothFactor, cpuSdBox(cBrX, cBrY, rj.cx, rj.cy, rj.hw, rj.hh)));
|
// so squaring it would only perturb interior SDF gradients.
|
||||||
fBl = std::min(fBl, cpuSmoothstep(0.0f, smoothFactor, cpuSdBox(cBlX, cBlY, rj.cx, rj.cy, rj.hw, rj.hh)));
|
const float sdTr = cpuSdBox(cTrX, cTrY, rj.cx, rj.cy, rj.hw, rj.hh);
|
||||||
fTl = std::min(fTl, cpuSmoothstep(0.0f, smoothFactor, cpuSdBox(cTlX, cTlY, rj.cx, rj.cy, rj.hw, rj.hh)));
|
const float sdBr = cpuSdBox(cBrX, cBrY, rj.cx, rj.cy, rj.hw, rj.hh);
|
||||||
|
const float sdBl = cpuSdBox(cBlX, cBlY, rj.cx, rj.cy, rj.hw, rj.hh);
|
||||||
|
const float sdTl = cpuSdBox(cTlX, cTlY, rj.cx, rj.cy, rj.hw, rj.hh);
|
||||||
|
if (sdTr >= 0.0f)
|
||||||
|
fTr = std::min(fTr, cpuSmoothstep(0.0f, smoothFactor, sdTr));
|
||||||
|
if (sdBr >= 0.0f)
|
||||||
|
fBr = std::min(fBr, cpuSmoothstep(0.0f, smoothFactor, sdBr));
|
||||||
|
if (sdBl >= 0.0f)
|
||||||
|
fBl = std::min(fBl, cpuSmoothstep(0.0f, smoothFactor, sdBl));
|
||||||
|
if (sdTl >= 0.0f)
|
||||||
|
fTl = std::min(fTl, cpuSmoothstep(0.0f, smoothFactor, sdTl));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_cachedHasInverted) {
|
if (m_cachedHasInverted) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue