[Bf-blender-cvs] [1161b00] master: Fix T40658: UV map node not working for GLSL materials.

Brecht Van Lommel noreply at git.blender.org
Sat Jul 19 15:01:54 CEST 2014


Commit: 1161b00c76d71f277f7d6bb774d4dc663a4d5a53
Author: Brecht Van Lommel
Date:   Sat Jul 19 14:59:41 2014 +0200
https://developer.blender.org/rB1161b00c76d71f277f7d6bb774d4dc663a4d5a53

Fix T40658: UV map node not working for GLSL materials.

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

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

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

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index d5d0c7e..fb36401 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2257,6 +2257,11 @@ void node_attribute(vec3 attr_uv, out vec4 outcol, out vec3 outvec, out float ou
 	outf = (attr_uv.x + attr_uv.y + attr_uv.z)/3.0;
 }
 
+void node_uvmap(vec3 attr_uv, out vec3 outvec)
+{
+	outvec = attr_uv;
+}
+
 void node_geometry(vec3 I, vec3 N, mat4 toworld,
 	out vec3 position, out vec3 normal, out vec3 tangent,
 	out vec3 true_normal, out vec3 incoming, out vec3 parametric,
diff --git a/source/blender/nodes/shader/nodes/node_shader_uvmap.c b/source/blender/nodes/shader/nodes/node_shader_uvmap.c
index fff1bc1..0f96cb4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_uvmap.c
+++ b/source/blender/nodes/shader/nodes/node_shader_uvmap.c
@@ -42,6 +42,14 @@ static void node_shader_init_uvmap(bNodeTree *UNUSED(ntree), bNode *node)
 	node->storage = attr;
 }
 
+static int node_shader_gpu_uvmap(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+{
+	NodeShaderUVMap *attr = node->storage;
+	GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, attr->uv_map);
+
+	return GPU_stack_link(mat, "node_uvmap", in, out, mtface);
+}
+
 /* node type definition */
 void register_node_type_sh_uvmap(void)
 {
@@ -53,6 +61,7 @@ void register_node_type_sh_uvmap(void)
 	node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
 	node_type_init(&ntype, node_shader_init_uvmap);
 	node_type_storage(&ntype, "NodeShaderUVMap", node_free_standard_storage, node_copy_standard_storage);
+	node_type_gpu(&ntype, node_shader_gpu_uvmap);
 
 	nodeRegisterType(&ntype);
 }




More information about the Bf-blender-cvs mailing list