mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Fix antialiasing issue with straight lines in text
This commit is contained in:
parent
e59b3d2ac0
commit
1180932026
1 changed files with 12 additions and 4 deletions
|
@ -78,12 +78,20 @@ void emit_pentagon(vec3[3] points, vec3 normal){
|
||||||
vec3 p0_perp = cross(t01, normal);
|
vec3 p0_perp = cross(t01, normal);
|
||||||
vec3 p2_perp = cross(t12, normal);
|
vec3 p2_perp = cross(t12, normal);
|
||||||
|
|
||||||
bool fill_inside = orientation >= 0.0;
|
bool fill_inside = orientation > 0.0;
|
||||||
float aaw = anti_alias_width;
|
float aaw = anti_alias_width;
|
||||||
vec3 corners[5];
|
vec3 corners[5];
|
||||||
if(fill_inside){
|
if(bezier_degree == 1.0){
|
||||||
// Note, straight lines will also fall into this case, and since p0_perp and p2_perp
|
// For straight lines, buff out in both directions
|
||||||
// will point to the right of the curve, it's just what we want
|
corners = vec3[5](
|
||||||
|
p0 + aaw * p0_perp,
|
||||||
|
p0 - aaw * p0_perp,
|
||||||
|
p1 + 0.5 * aaw * (p0_perp + p2_perp),
|
||||||
|
p2 - aaw * p2_perp,
|
||||||
|
p2 + aaw * p2_perp
|
||||||
|
);
|
||||||
|
} else if(fill_inside){
|
||||||
|
// If curved, and filling insight, just buff out away interior
|
||||||
corners = vec3[5](
|
corners = vec3[5](
|
||||||
p0 + aaw * p0_perp,
|
p0 + aaw * p0_perp,
|
||||||
p0,
|
p0,
|
||||||
|
|
Loading…
Add table
Reference in a new issue