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

This commit is contained in:
Brecht Van Lommel 2014-07-19 14:59:41 +02:00
parent 1f3c8466a8
commit 1161b00c76
Notes: blender-bot 2023-02-14 10:29:28 +01:00
Referenced by issue #40658, "UV Map" node display issue in Material shading mode
2 changed files with 14 additions and 0 deletions

View File

@ -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,

View File

@ -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);
}