diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-05-07 20:48:28 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-06-11 21:32:24 +0300 |
commit | 42aec3b355b7692f60369c0d5333f54b029bfcad (patch) | |
tree | e849e60af432a102280f9192204ffa9092582430 /intern/cycles/render/svm.cpp | |
parent | 4df6474f01ce6c0db57538f737baead2936e2496 (diff) |
Cycles: nodify shader nodes
Differential Revision: https://developer.blender.org/D2038
Diffstat (limited to 'intern/cycles/render/svm.cpp')
-rw-r--r-- | intern/cycles/render/svm.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index d54afd1ba6f..f0e7ee2bd49 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -192,14 +192,16 @@ int SVMCompiler::stack_assign(ShaderInput *input) input->stack_offset = input->link->stack_offset; } else { + Node *node = input->parent; + /* not linked to output -> add nodes to load default value */ input->stack_offset = stack_find_offset(input->type()); if(input->type() == SocketType::FLOAT) { - add_node(NODE_VALUE_F, __float_as_int(input->value_float()), input->stack_offset); + add_node(NODE_VALUE_F, __float_as_int(node->get_float(input->socket_type)), input->stack_offset); } else if(input->type() == SocketType::INT) { - add_node(NODE_VALUE_F, (int)input->value_float(), input->stack_offset); + add_node(NODE_VALUE_F, node->get_int(input->socket_type), input->stack_offset); } else if(input->type() == SocketType::VECTOR || input->type() == SocketType::NORMAL || @@ -208,7 +210,7 @@ int SVMCompiler::stack_assign(ShaderInput *input) { add_node(NODE_VALUE_V, input->stack_offset); - add_node(NODE_VALUE_V, input->value()); + add_node(NODE_VALUE_V, node->get_float3(input->socket_type)); } else /* should not get called for closure */ assert(0); @@ -446,7 +448,7 @@ void SVMCompiler::generate_closure_node(ShaderNode *node, const char *weight_name = (current_type == SHADER_TYPE_VOLUME)? "VolumeMixWeight": "SurfaceMixWeight"; ShaderInput *weight_in = node->input(weight_name); - if(weight_in && (weight_in->link || weight_in->value_float() != 1.0f)) + if(weight_in && (weight_in->link || node->get_float(weight_in->socket_type) != 1.0f)) mix_weight_offset = stack_assign(weight_in); else mix_weight_offset = SVM_STACK_INVALID; |