[Bf-blender-cvs] [dec9c7d87e5] master: Eevee: Implement Texture coordinate from object

Clément Foucault noreply at git.blender.org
Fri Mar 29 17:41:36 CET 2019


Commit: dec9c7d87e5baf7e3025c1e94083b1712bfaeb51
Author: Clément Foucault
Date:   Fri Mar 29 17:40:50 2019 +0100
Branches: master
https://developer.blender.org/rBdec9c7d87e5baf7e3025c1e94083b1712bfaeb51

Eevee: Implement Texture coordinate from object

First try to implement T57489. But unfortunately, there is a missing
dependency in the depsgraph that does not trigger the shader update.

===================================================================

M	source/blender/nodes/shader/nodes/node_shader_tex_coord.c

===================================================================

diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
index fb901ea0774..08dbeb5454f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
@@ -36,6 +36,11 @@ static bNodeSocketTemplate sh_node_tex_coord_out[] = {
 
 static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
 {
+	Object *ob = (Object *)node->id;
+	invert_m4_m4(ob->imat, ob->obmat);
+
+	GPUNodeLink *inv_obmat = (ob != NULL) ? GPU_uniform((float*)ob->imat) : GPU_builtin(GPU_INVERSE_OBJECT_MATRIX);
+
 	GPUNodeLink *orco = GPU_attribute(CD_ORCO, "");
 	GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, "");
 
@@ -43,7 +48,7 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *node, bNodeExecDat
 
 	return GPU_stack_link(mat, node, "node_tex_coord", in, out,
 	                      GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL),
-	                      GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX),
+	                      GPU_builtin(GPU_INVERSE_VIEW_MATRIX), inv_obmat,
 	                      GPU_builtin(GPU_CAMERA_TEXCO_FACTORS), orco, mtface);
 }



More information about the Bf-blender-cvs mailing list