Fix T49372: Fresnel node: difference between 2.76 and 2.78 GLSL output
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 16 Sep 2016 09:48:42 +0000 (11:48 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 22 Sep 2016 09:07:35 +0000 (11:07 +0200)
source/blender/nodes/shader/nodes/node_shader_fresnel.c

index b50f722..ef2ce99 100644 (file)
@@ -41,10 +41,12 @@ static bNodeSocketTemplate sh_node_fresnel_out[] = {
 
 static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
 {
-       if (!in[1].link)
+       if (!in[1].link) {
                in[1].link = GPU_builtin(GPU_VIEW_NORMAL);
-       else
+       }
+       else if (GPU_material_use_world_space_shading(mat)) {
                GPU_link(mat, "direction_transform_m4v3", in[1].link, GPU_builtin(GPU_VIEW_MATRIX), &in[1].link);
+       }
        
        return GPU_stack_link(mat, "node_fresnel", in, out, GPU_builtin(GPU_VIEW_POSITION));
 }