diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-19 09:06:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-19 09:12:01 +0300 |
commit | 418cd7c4bae6247e9254bcc6b06e2ef12ec76fb6 (patch) | |
tree | f70f547a6454fe3d57c26332b546719c11ee4436 /source/blender/blenkernel/intern/displist.c | |
parent | e25f7e33ff4f2e2a5178ade82d1d4898fb07438b (diff) |
Fix T84041: Bevel caps have invalid normals
Bevel caps always had incorrect normals, causing display glitches
in some cases.
It seems this never worked properly (at least 2.79 also had this bug).
Use the projection vector as the normal.
Diffstat (limited to 'source/blender/blenkernel/intern/displist.c')
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 5220d5be2ca..375792a02c2 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -458,6 +458,7 @@ static void curve_to_displist(Curve *cu, /** * \param normal_proj: Optional normal that's used to project the scanfill verts into 2d coords. * Pass this along if known since it saves time calculating the normal. + * This is also used to initialize #DispList.nors (one normal per display list). * \param flipnormal: Flip the normal (same as passing \a normal_proj negated) */ void BKE_displist_fill(ListBase *dispbase, @@ -550,6 +551,18 @@ void BKE_displist_fill(ListBase *dispbase, dlnew->index = MEM_mallocN(sizeof(int[3]) * tot, "dlindex"); dlnew->verts = MEM_mallocN(sizeof(float[3]) * totvert, "dlverts"); + if (normal_proj != NULL) { + /* Use a single normal for #DL_INDEX3. + * Counter intuitively, the normal must always be the flipped projection vector. */ + dlnew->nors = MEM_mallocN(sizeof(float[3]), "dlnors"); + if (flipnormal) { + copy_v3_v3(dlnew->nors, normal_proj); + } + else { + negate_v3_v3(dlnew->nors, normal_proj); + } + } + /* vert data */ f1 = dlnew->verts; totvert = 0; |