[Bf-blender-cvs] [6cd5954] master: Implement GLSL code for XYZ nodes.

Thomas Dinges noreply at git.blender.org
Fri Jun 13 23:24:25 CEST 2014


Commit: 6cd595424679c8c29848c797d079cfd7c7b73d6d
Author: Thomas Dinges
Date:   Fri Jun 13 23:23:35 2014 +0200
https://developer.blender.org/rB6cd595424679c8c29848c797d079cfd7c7b73d6d

Implement GLSL code for XYZ nodes.

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

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

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

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 5c7872a..aad675c 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -752,6 +752,18 @@ void combine_rgb(float r, float g, float b, out vec4 col)
 	col = vec4(r, g, b, 1.0);
 }
 
+void separate_xyz(vec3 vec, out float x, out float y, out float z)
+{
+	x = vec.r;
+	y = vec.g;
+	z = vec.b;
+}
+
+void combine_xyz(float x, float y, float z, out vec3 vec)
+{
+	vec = vec3(x, y, z);
+}
+
 void separate_hsv(vec4 col, out float h, out float s, out float v)
 {
 	vec4 hsv;
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c b/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c
index b02a1a9..605a3b9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c
@@ -44,7 +44,7 @@ static bNodeSocketTemplate sh_node_sepxyz_out[] = {
 	{	-1, 0, ""	}
 };
 
-static int gpu_shader_sep(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+static int gpu_shader_sepxyz(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
 {
 	return GPU_stack_link(mat, "separate_xyz", in, out);
 }
@@ -56,6 +56,7 @@ void register_node_type_sh_sepxyz(void)
 	sh_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTOR, 0);
 	node_type_compatibility(&ntype, NODE_NEW_SHADING);
 	node_type_socket_templates(&ntype, sh_node_sepxyz_in, sh_node_sepxyz_out);
+	node_type_gpu(&ntype, gpu_shader_sepxyz);
 
 	nodeRegisterType(&ntype);
 }
@@ -74,6 +75,11 @@ static bNodeSocketTemplate sh_node_combxyz_out[] = {
 	{	-1, 0, ""	}
 };
 
+static int gpu_shader_combxyz(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+{
+	return GPU_stack_link(mat, "combine_xyz", in, out);
+}
+
 void register_node_type_sh_combxyz(void)
 {
 	static bNodeType ntype;
@@ -81,6 +87,7 @@ void register_node_type_sh_combxyz(void)
 	sh_node_type_base(&ntype, SH_NODE_COMBXYZ, "Combine XYZ", NODE_CLASS_CONVERTOR, 0);
 	node_type_compatibility(&ntype, NODE_NEW_SHADING);
 	node_type_socket_templates(&ntype, sh_node_combxyz_in, sh_node_combxyz_out);
+	node_type_gpu(&ntype, gpu_shader_combxyz);
 
 	nodeRegisterType(&ntype);
 }




More information about the Bf-blender-cvs mailing list