Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-05 19:54:39 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-05 19:54:39 +0400
commite66f3eb499eed2121b63c7189c81453315e7611e (patch)
tree2c3ba25138bfa2a4f05abaadf6faf3583a73c9a0
parent32f35056af6909610c563dcca8f9b11b55acbe40 (diff)
Cycles: GLSL materials now can use multiple UV maps with the attribute node.
-rw-r--r--intern/cycles/render/graph.cpp6
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl7
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_attribute.c10
3 files changed, 20 insertions, 3 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 6f8082487d4..f9a4a69c954 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -192,9 +192,9 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to)
/* for closures we can't do automatic conversion */
if(from->type == SHADER_SOCKET_CLOSURE || to->type == SHADER_SOCKET_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",
- from->parent->name.c_str(), from->name, (int)from->type,
- to->parent->name.c_str(), to->name, (int)to->type);
+ "(%s.%s to %s.%s).\n",
+ from->parent->name.c_str(), from->name,
+ to->parent->name.c_str(), to->name);
return;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 145ad187823..c095d803f48 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2121,6 +2121,13 @@ void node_fresnel(float ior, vec3 N, vec3 I, out float result)
/* 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,
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_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c
index d525393f09f..608595a6fdb 100644
--- a/source/blender/nodes/shader/nodes/node_shader_attribute.c
+++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c
@@ -42,6 +42,14 @@ static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node)
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 */
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_init(&ntype, node_shader_init_attribute);
node_type_storage(&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage);
+ node_type_gpu(&ntype, node_shader_gpu_attribute);
nodeRegisterType(&ntype);
}
+