mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Change miter threshold to global constant
This commit is contained in:
parent
c345d76de0
commit
9f54b85c4e
1 changed files with 5 additions and 2 deletions
|
@ -32,6 +32,7 @@ const float COS_THRESHOLD = 0.999;
|
|||
// Used to determine how many lines to break the curve into
|
||||
const float POLYLINE_FACTOR = 100;
|
||||
const int MAX_STEPS = 32;
|
||||
const float MITER_COS_ANGLE_THRESHOLD = -0.8;
|
||||
|
||||
#INSERT emit_gl_Position.glsl
|
||||
#INSERT finalize_color.glsl
|
||||
|
@ -126,10 +127,12 @@ vec3 step_to_corner(vec3 point, vec3 tangent, vec3 unit_normal, vec4 joint_produ
|
|||
cos_angle = unit_joint_product(flat_jp).w;
|
||||
}
|
||||
|
||||
// If joint type is auto, it will bevel for cos(angle) > -0.7,
|
||||
// If joint type is auto, it will bevel for cos(angle) > MITER_COS_ANGLE_THRESHOLD,
|
||||
// and smoothly transition to miter for those with sharper angles
|
||||
float mcat1 = MITER_COS_ANGLE_THRESHOLD;
|
||||
float mcat2 = 0.5 * (mcat1 - 1.0);
|
||||
float miter_factor;
|
||||
if (joint_type == AUTO_JOINT) miter_factor = smoothstep(-0.7, -0.9, cos_angle);
|
||||
if (joint_type == AUTO_JOINT) miter_factor = smoothstep(mcat1, mcat2, cos_angle);
|
||||
else if (joint_type == BEVEL_JOINT) miter_factor = 0.0;
|
||||
else miter_factor = 1.0;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue