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>2019-03-29 00:08:39 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-03-29 00:08:54 +0300
commit42dd888b98b598c240f78302b857fa60add08ca5 (patch)
treeec50b6728a79d601025dc8f2e9c715890a04dce2 /source/blender/draw/intern/draw_manager_exec.c
parentd027df3add87a1f0a3356d21344a0a160c8ce43d (diff)
Fix T62178 Eevee: Texture Box mapping not matching Cycles if object is scaled
The wrong transformation was used. Add a new matrix specially for this case. This also fix the Node texture coordinate that was suffering the same issue.
Diffstat (limited to 'source/blender/draw/intern/draw_manager_exec.c')
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index 87c56efb493..7dc42c4d459 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -792,18 +792,20 @@ static void draw_matrices_model_prepare(DRWCallState *st)
if (st->matflag & DRW_CALL_MODELVIEWPROJECTION) {
mul_m4_m4m4(st->modelviewprojection, DST.view_data.matstate.mat[DRW_MAT_PERS], st->model);
}
- if (st->matflag & (DRW_CALL_NORMALVIEW | DRW_CALL_EYEVEC)) {
+ if (st->matflag & (DRW_CALL_NORMALVIEW | DRW_CALL_NORMALVIEWINVERSE | DRW_CALL_EYEVEC)) {
copy_m3_m4(st->normalview, st->modelview);
invert_m3(st->normalview);
transpose_m3(st->normalview);
}
+ if (st->matflag & (DRW_CALL_NORMALVIEWINVERSE | DRW_CALL_EYEVEC)) {
+ invert_m3_m3(st->normalviewinverse, st->normalview);
+ }
+ /* TODO remove eye vec (unused) */
if (st->matflag & DRW_CALL_EYEVEC) {
/* Used by orthographic wires */
- float tmp[3][3];
copy_v3_fl3(st->eyevec, 0.0f, 0.0f, 1.0f);
- invert_m3_m3(tmp, st->normalview);
/* set eye vector, transformed to object coords */
- mul_m3_v3(tmp, st->eyevec);
+ mul_m3_v3(st->normalviewinverse, st->eyevec);
}
/* Non view dependent */
if (st->matflag & DRW_CALL_MODELINVERSE) {
@@ -835,6 +837,7 @@ static void draw_geometry_prepare(DRWShadingGroup *shgroup, DRWCall *call)
GPU_shader_uniform_vector(shgroup->shader, shgroup->modelviewinverse, 16, 1, (float *)state->modelviewinverse);
GPU_shader_uniform_vector(shgroup->shader, shgroup->modelviewprojection, 16, 1, (float *)state->modelviewprojection);
GPU_shader_uniform_vector(shgroup->shader, shgroup->normalview, 9, 1, (float *)state->normalview);
+ GPU_shader_uniform_vector(shgroup->shader, shgroup->normalviewinverse, 9, 1, (float *)state->normalviewinverse);
GPU_shader_uniform_vector(shgroup->shader, shgroup->normalworld, 9, 1, (float *)state->normalworld);
GPU_shader_uniform_vector(shgroup->shader, shgroup->objectinfo, 4, 1, (float *)objectinfo);
GPU_shader_uniform_vector(shgroup->shader, shgroup->orcotexfac, 3, 2, (float *)state->orcotexfac);