Fix T92631: Fix negative thickness regression in complex solidify
This regression was introduced by D11832, but there was problems before that as well. I seem to have missed it in review. See the differential revision for a screenshot of the difference. Differential Revision: https://developer.blender.org/D13216
This commit is contained in:
parent
7b09213f2f
commit
819b9bdfa1
Notes:
blender-bot
2023-02-14 06:54:28 +01:00
Referenced by issue #92631, Solidify modifier with Complex mode and negative thickness not pointing normals outside
|
@ -74,6 +74,7 @@ static float angle_signed_on_axis_normalized_v3v3_v3(const float n[3],
|
|||
static float clamp_nonzero(const float value, const float epsilon)
|
||||
{
|
||||
BLI_assert(!(epsilon < 0.0f));
|
||||
/* Return closest value with `abs(value) >= epsilon`. */
|
||||
if (value < 0.0f) {
|
||||
return min_ff(value, -epsilon);
|
||||
}
|
||||
|
@ -171,15 +172,22 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
|
|||
|
||||
float(*poly_nors)[3] = NULL;
|
||||
|
||||
/* #ofs_front and #ofs_back are the offset from the original
|
||||
* surface along the normal, where #oft_front is along the positive
|
||||
* and #oft_back is along the negative normal. */
|
||||
const float ofs_front = (smd->offset_fac + 1.0f) * 0.5f * smd->offset;
|
||||
const float ofs_back = ofs_front - smd->offset * smd->offset_fac;
|
||||
const float ofs_front_clamped = clamp_nonzero(smd->offset > 0 ? ofs_front : ofs_back, 1e-5f);
|
||||
const float ofs_back_clamped = clamp_nonzero(smd->offset > 0 ? ofs_back : ofs_front, 1e-5f);
|
||||
/* #ofs_front_clamped and #ofs_back_clamped are the same as
|
||||
* #ofs_front and #ofs_back, but never zero. */
|
||||
const float ofs_front_clamped = clamp_nonzero(ofs_front, 1e-5f);
|
||||
const float ofs_back_clamped = clamp_nonzero(ofs_back, 1e-5f);
|
||||
const float offset_fac_vg = smd->offset_fac_vg;
|
||||
const float offset_fac_vg_inv = 1.0f - smd->offset_fac_vg;
|
||||
const float offset = fabsf(smd->offset) * smd->offset_clamp;
|
||||
const bool do_angle_clamp = smd->flag & MOD_SOLIDIFY_OFFSET_ANGLE_CLAMP;
|
||||
const bool do_flip = (smd->flag & MOD_SOLIDIFY_FLIP) != 0;
|
||||
/* #do_flip, flips the normals of the result. This is inverted if negative thickness
|
||||
* is used, since simple soldify with negative thickness keeps the faces facing outside. */
|
||||
const bool do_flip = ((smd->flag & MOD_SOLIDIFY_FLIP) != 0) == (smd->offset > 0);
|
||||
const bool do_rim = smd->flag & MOD_SOLIDIFY_RIM;
|
||||
const bool do_shell = ((smd->flag & MOD_SOLIDIFY_RIM) && (smd->flag & MOD_SOLIDIFY_NOSHELL)) ==
|
||||
0;
|
||||
|
|
Loading…
Reference in New Issue