Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-01-30 04:44:56 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-01-30 04:46:01 +0300
commitc27d30f3eaf866fed12adaa84bae48937ad56e53 (patch)
treea38df079820b112331ca5ddf41b31c7a4dbc7d38 /source/blender/draw/intern/draw_cache_impl_displist.c
parent4482d70f6e0dd3e3f455236915357a69898dc9be (diff)
Displist: Add mikktspace tangent space generation for DL_INDEX3
This now matches the Mesh behavior. Surfaces and metaball implementation are yet to be implemented.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_displist.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_displist.c10
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);