diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-01-30 05:31:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-01-30 05:31:39 +0300 |
commit | 4c1b7f311da58269654655359a8bddf439cc8ce9 (patch) | |
tree | 432bcc4ecb1932ee0a4e21a61b50fb0a922635f1 /source/blender/draw | |
parent | 002b1835062b9ae213828b202c02059212bdef2e (diff) | |
parent | 7a27f64ecb5ac4c6cac3a27436d7b25037e62054 (diff) |
Merge branch 'blender-v2.82-release'
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_displist.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c index ad2495aa0d1..10f4b7ddbb6 100644 --- a/source/blender/draw/intern/draw_cache_impl_displist.c +++ b/source/blender/draw/intern/draw_cache_impl_displist.c @@ -33,6 +33,7 @@ #include "DNA_curve_types.h" #include "BKE_displist.h" +#include "BKE_displist_tangent.h" #include "GPU_batch.h" #include "GPU_extensions.h" @@ -495,11 +496,12 @@ void DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv_and_tan(ListBase *lb, GPUPackedNormal ptan = {0, 0, 0, 1}; if (tan_step.size != 0) { - float tan[3]; - /* We consider the surface flat so the vector is already ortogonal to the normal. */ - sub_v3_v3v3(tan, verts[idx[0]], verts[idx[2]]); - normalize_v3(tan); + float tan[4]; + float(*tan_ptr)[4] = &tan; + BKE_displist_tangent_calc(dl, NULL, &tan_ptr); + ptan = GPU_normal_convert_i10_v3(tan); + ptan.w = (tan[3] > 0.0) ? 1 : -2; } const float x_max = (float)(dl->nr - 1); |