[Bf-blender-cvs] [bec22ca] compositor-2016: Fix missing Ignore option for GLSL bump

Sergey Sharybin noreply at git.blender.org
Wed Jun 8 21:49:03 CEST 2016


Commit: bec22ca5263eb801dbc5d086d3315b496d7524cd
Author: Sergey Sharybin
Date:   Sun May 22 16:47:06 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBbec22ca5263eb801dbc5d086d3315b496d7524cd

Fix missing Ignore option for GLSL bump

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

M	source/blender/gpu/shaders/gpu_shader_material.glsl
M	source/blender/nodes/shader/nodes/node_shader_bump.c

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

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 28bf99b..e97dddf 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -3160,8 +3160,11 @@ void node_normal_map(vec4 tangent, vec3 normal, vec3 texnormal, out vec3 outnorm
 	outnormal = normalize(outnormal);
 }
 
-void node_bump(float strength, float dist, float height, vec3 N, vec3 surf_pos, out vec3 result)
+void node_bump(float strength, float dist, float height, vec3 N, vec3 surf_pos, float invert, out vec3 result)
 {
+	if (invert != 0.0) {
+		dist *= -1.0;
+	}
 	vec3 dPdx = dFdx(surf_pos);
 	vec3 dPdy = dFdy(surf_pos);
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.c b/source/blender/nodes/shader/nodes/node_shader_bump.c
index 285dede..b39ca5d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bump.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bump.c
@@ -45,13 +45,14 @@ static bNodeSocketTemplate sh_node_bump_out[] = {
 	{ -1, 0, "" }
 };
 
-static int gpu_shader_bump(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+static int gpu_shader_bump(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
 {
 	if (!in[3].link)
 		in[3].link = GPU_builtin(GPU_VIEW_NORMAL);
 	else
 		GPU_link(mat, "direction_transform_m4v3", in[3].link, GPU_builtin(GPU_VIEW_MATRIX), &in[3].link);
-	GPU_stack_link(mat, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION));
+	float invert = node->custom1;
+	GPU_stack_link(mat, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_uniform(&invert));
 	/* Other nodes are applying view matrix if the input Normal has a link.
 	 * We don't want normal to have view matrix applied twice, so we cancel it here.
 	 *




More information about the Bf-blender-cvs mailing list