forked from bartvdbraak/blender
Cycles: GLSL materials now can use multiple UV maps with the attribute node.
This commit is contained in:
parent
32f35056af
commit
e66f3eb499
@ -192,9 +192,9 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to)
|
|||||||
/* for closures we can't do automatic conversion */
|
/* for closures we can't do automatic conversion */
|
||||||
if(from->type == SHADER_SOCKET_CLOSURE || to->type == SHADER_SOCKET_CLOSURE) {
|
if(from->type == SHADER_SOCKET_CLOSURE || to->type == SHADER_SOCKET_CLOSURE) {
|
||||||
fprintf(stderr, "Cycles shader graph connect: can only connect closure to closure "
|
fprintf(stderr, "Cycles shader graph connect: can only connect closure to closure "
|
||||||
"(ShaderNode:%s, ShaderOutput:%s , type:%d -> to ShaderNode:%s, ShaderInput:%s, type:%d).\n",
|
"(%s.%s to %s.%s).\n",
|
||||||
from->parent->name.c_str(), from->name, (int)from->type,
|
from->parent->name.c_str(), from->name,
|
||||||
to->parent->name.c_str(), to->name, (int)to->type);
|
to->parent->name.c_str(), to->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2121,6 +2121,13 @@ void node_fresnel(float ior, vec3 N, vec3 I, out float result)
|
|||||||
|
|
||||||
/* geometry */
|
/* geometry */
|
||||||
|
|
||||||
|
void node_attribute(vec3 attr_uv, out vec4 outcol, out vec3 outvec, out float outf)
|
||||||
|
{
|
||||||
|
outcol = vec4(attr_uv, 1.0);
|
||||||
|
outvec = attr_uv;
|
||||||
|
outf = (attr_uv.x + attr_uv.y + attr_uv.z)/3.0;
|
||||||
|
}
|
||||||
|
|
||||||
void node_geometry(vec3 I, vec3 N, mat4 toworld,
|
void node_geometry(vec3 I, vec3 N, mat4 toworld,
|
||||||
out vec3 position, out vec3 normal, out vec3 tangent,
|
out vec3 position, out vec3 normal, out vec3 tangent,
|
||||||
out vec3 true_normal, out vec3 incoming, out vec3 parametric,
|
out vec3 true_normal, out vec3 incoming, out vec3 parametric,
|
||||||
|
@ -42,6 +42,14 @@ static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node)
|
|||||||
node->storage = attr;
|
node->storage = attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int node_shader_gpu_attribute(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||||
|
{
|
||||||
|
NodeShaderAttribute *attr = node->storage;
|
||||||
|
GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, attr->name);
|
||||||
|
|
||||||
|
return GPU_stack_link(mat, "node_attribute", in, out, mtface);
|
||||||
|
}
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
void register_node_type_sh_attribute(void)
|
void register_node_type_sh_attribute(void)
|
||||||
{
|
{
|
||||||
@ -52,6 +60,8 @@ void register_node_type_sh_attribute(void)
|
|||||||
node_type_socket_templates(&ntype, NULL, sh_node_attribute_out);
|
node_type_socket_templates(&ntype, NULL, sh_node_attribute_out);
|
||||||
node_type_init(&ntype, node_shader_init_attribute);
|
node_type_init(&ntype, node_shader_init_attribute);
|
||||||
node_type_storage(&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage);
|
node_type_storage(&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage);
|
||||||
|
node_type_gpu(&ntype, node_shader_gpu_attribute);
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user