This commit is contained in:
Patrick Walton 2018-11-26 19:19:37 -08:00
parent 7c4f817d96
commit 26bbf2c3d5
1 changed files with 9 additions and 17 deletions

View File

@ -36,24 +36,16 @@ void main() {
vec2 from = aFrom, ctrl = aCtrl, to = aTo; vec2 from = aFrom, ctrl = aCtrl, to = aTo;
vec2 dilation, position; vec2 position;
bool zeroArea = abs(from.x - to.x) < 0.1 || bool zeroArea = !(abs(from.x - to.x) > 0.1) || !(abs(uTileSize.y - min(from.y, to.y)) > 0.1);
abs(uTileSize.y - min(min(from.y, to.y), ctrl.y)) < 0.1; if (aTessCoord.x < 0.5)
if (aTessCoord.x < 0.5) { position.x = floor(min(min(from.x, to.x), ctrl.x));
position.x = min(min(from.x, to.x), ctrl.x); else
dilation.x = zeroArea ? 0.0 : -0.5; position.x = ceil(max(max(from.x, to.x), ctrl.x));
} else { if (aTessCoord.y < 0.5)
position.x = max(max(from.x, to.x), ctrl.x); position.y = floor(min(min(from.y, to.y), ctrl.y));
dilation.x = zeroArea ? 0.0 : 0.5; else
}
if (aTessCoord.y < 0.5) {
position.y = min(min(from.y, to.y), ctrl.y);
dilation.y = zeroArea ? 0.0 : -0.5;
} else {
position.y = uTileSize.y; position.y = uTileSize.y;
dilation.y = 0.0;
}
position += dilation;
vFrom = from - position; vFrom = from - position;
vCtrl = ctrl - position; vCtrl = ctrl - position;