mirror of
https://github.com/3b1b/manim.git
synced 2025-11-14 12:47:43 +00:00
Small reformatting
This commit is contained in:
parent
31b6affabb
commit
a4858918dd
1 changed files with 9 additions and 5 deletions
|
|
@ -129,12 +129,16 @@ vec3 step_to_corner(vec3 point, vec3 tangent, vec3 unit_normal, vec4 joint_produ
|
||||||
|
|
||||||
// If joint type is auto, it will bevel for cos(angle) > MITER_COS_ANGLE_THRESHOLD,
|
// 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
|
// and smoothly transition to miter for those with sharper angles
|
||||||
|
float miter_factor;
|
||||||
|
if (joint_type == BEVEL_JOINT){
|
||||||
|
miter_factor = 0.0;
|
||||||
|
}else if (joint_type == MITER_JOINT){
|
||||||
|
miter_factor = 1.0;
|
||||||
|
}else {
|
||||||
float mcat1 = MITER_COS_ANGLE_THRESHOLD;
|
float mcat1 = MITER_COS_ANGLE_THRESHOLD;
|
||||||
float mcat2 = 0.5 * (mcat1 - 1.0);
|
float mcat2 = 0.5 * (mcat1 - 1.0);
|
||||||
float miter_factor;
|
miter_factor = smoothstep(mcat1, mcat2, 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;
|
|
||||||
|
|
||||||
float sin_angle = sqrt(1 - cos_angle * cos_angle) * sign(dot(joint_product.xyz, unit_normal));
|
float sin_angle = sqrt(1 - cos_angle * cos_angle) * sign(dot(joint_product.xyz, unit_normal));
|
||||||
float shift = (cos_angle + mix(-1, 1, miter_factor)) / sin_angle;
|
float shift = (cos_angle + mix(-1, 1, miter_factor)) / sin_angle;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue