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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-06-30 14:24:03 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-06-30 14:24:43 +0400
commit7dbedf6d4ac719d5e452091d82d902cf99c47471 (patch)
treeebd77c92041f1af04bb20bc04e16916388b263bf /source
parentcb95544e41864280cbf7df315ede5447f3a2a867 (diff)
Fix T40795: Dot output is inverted in viewport with Cycles
Diffstat (limited to 'source')
-rw-r--r--source/blender/gpu/GPU_material.h1
-rw-r--r--source/blender/gpu/intern/gpu_material.c5
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal.c7
3 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index a1c249d7f00..8d44ad87916 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -147,6 +147,7 @@ void GPU_material_vertex_attributes(GPUMaterial *material,
struct GPUVertexAttribs *attrib);
bool GPU_material_do_color_management(GPUMaterial *mat);
+bool GPU_material_use_new_shading_nodes(GPUMaterial *mat);
/* Exported shading */
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 5ed47cda8f5..1750d3142d9 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -417,6 +417,11 @@ bool GPU_material_do_color_management(GPUMaterial *mat)
return !((mat->scene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT));
}
+bool GPU_material_use_new_shading_nodes(GPUMaterial *mat)
+{
+ return BKE_scene_use_new_shading_nodes(mat->scene);
+}
+
static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **lv, GPUNodeLink **dist)
{
GPUNodeLink *visifac, *inpr;
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c
index 22b27ce4b71..fcd738f0b15 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.c
@@ -61,7 +61,12 @@ static void node_shader_exec_normal(void *UNUSED(data), int UNUSED(thread), bNod
static int gpu_shader_normal(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
{
GPUNodeLink *vec = GPU_uniform(out[0].vec);
- return GPU_stack_link(mat, "normal", in, out, vec);
+ int ret = GPU_stack_link(mat, "normal", in, out, vec);
+ if (ret && GPU_material_use_new_shading_nodes(mat)) {
+ float fac[3] = {1.0f, 0.0f, 0.0f};
+ GPU_link(mat, "invert", GPU_uniform(fac), out[1].link, &out[1].link);
+ }
+ return ret;
}
void register_node_type_sh_normal(void)