diff options
Diffstat (limited to 'source/blender/nodes/shader/node_shader_util.c')
-rw-r--r-- | source/blender/nodes/shader/node_shader_util.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c index a2b18b61480..cf58846a051 100644 --- a/source/blender/nodes/shader/node_shader_util.c +++ b/source/blender/nodes/shader/node_shader_util.c @@ -258,6 +258,30 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, bNode *output_node } } +void node_shader_gpu_bump_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link) +{ + if (node->branch_tag == 1) { + /* Add one time the value fo derivative to the input vector. */ + GPU_link(mat, "dfdx_v3", *link, link); + } + else if (node->branch_tag == 2) { + /* Add one time the value fo derivative to the input vector. */ + GPU_link(mat, "dfdy_v3", *link, link); + } + else { + /* nothing to do, reference center value. */ + } +} + +void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link) +{ + if (!*link) { + *link = GPU_attribute(CD_ORCO, ""); + GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), *link, link); + node_shader_gpu_bump_tex_coord(mat, node, link); + } +} + void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, |