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@gmail.com>2018-02-18 05:20:39 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-02-23 20:57:58 +0300
commita963c7d48dade70474ec3b40bea5e99ebdbbc5d4 (patch)
tree7df66a8c09dec4f9bd1f9eb1f9d390339213c21d /intern/cycles/render/svm.cpp
parent4448ed6c5e6d321c9f0822ca2d969f7e7041fe27 (diff)
Code refactor: improve attribute handling for optional volume attributes.
A volume shader should be able to request attributes, and still be rendered as homogeneous if no volume attributes are available for the object.
Diffstat (limited to 'intern/cycles/render/svm.cpp')
-rw-r--r--intern/cycles/render/svm.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index b678277433b..c5b4060d5c3 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -399,6 +399,12 @@ uint SVMCompiler::attribute(AttributeStandard std)
return shader_manager->get_attribute_id(std);
}
+uint SVMCompiler::attribute_standard(ustring name)
+{
+ AttributeStandard std = Attribute::name_standard(name.c_str());
+ return (std)? attribute(std): attribute(name);
+}
+
bool SVMCompiler::node_skip_input(ShaderNode * /*node*/, ShaderInput *input)
{
/* nasty exception .. */
@@ -447,6 +453,10 @@ void SVMCompiler::generate_node(ShaderNode *node, ShaderNodeSet& done)
current_shader->has_object_dependency = true;
}
+ if(node->has_attribute_dependency()) {
+ current_shader->has_attribute_dependency = true;
+ }
+
if(node->has_integrator_dependency()) {
current_shader->has_integrator_dependency = true;
}
@@ -830,6 +840,7 @@ void SVMCompiler::compile(Scene *scene,
shader->has_surface_spatial_varying = false;
shader->has_volume_spatial_varying = false;
shader->has_object_dependency = false;
+ shader->has_attribute_dependency = false;
shader->has_integrator_dependency = false;
/* generate bump shader */