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:
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r--intern/cycles/render/nodes.cpp61
1 files changed, 33 insertions, 28 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 7ed07ab6453..7ac872b8416 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -182,6 +182,21 @@ static ShaderEnum image_projection_init()
return enm;
}
+static const char* get_osl_interpolation_parameter(InterpolationType interpolation)
+{
+ switch(interpolation) {
+ case INTERPOLATION_CLOSEST:
+ return "closest";
+ case INTERPOLATION_CUBIC:
+ return "cubic";
+ case INTERPOLATION_SMART:
+ return "smart";
+ case INTERPOLATION_LINEAR:
+ default:
+ return "linear";
+ }
+}
+
ShaderEnum ImageTextureNode::color_space_enum = color_space_init();
ShaderEnum ImageTextureNode::projection_enum = image_projection_init();
@@ -362,22 +377,7 @@ void ImageTextureNode::compile(OSLCompiler& compiler)
compiler.parameter("projection_blend", projection_blend);
compiler.parameter("is_float", is_float);
compiler.parameter("use_alpha", !alpha_out->links.empty());
-
- switch (interpolation) {
- case INTERPOLATION_CLOSEST:
- compiler.parameter("interpolation", "closest");
- break;
- case INTERPOLATION_CUBIC:
- compiler.parameter("interpolation", "cubic");
- break;
- case INTERPOLATION_SMART:
- compiler.parameter("interpolation", "smart");
- break;
- case INTERPOLATION_LINEAR:
- default:
- compiler.parameter("interpolation", "linear");
- break;
- }
+ compiler.parameter("interpolation", get_osl_interpolation_parameter(interpolation));
switch(extension) {
case EXTENSION_EXTEND:
@@ -421,6 +421,7 @@ EnvironmentTextureNode::EnvironmentTextureNode()
filename = "";
builtin_data = NULL;
color_space = ustring("Color");
+ interpolation = INTERPOLATION_LINEAR;
projection = ustring("Equirectangular");
animated = false;
@@ -434,7 +435,7 @@ EnvironmentTextureNode::~EnvironmentTextureNode()
if(image_manager) {
image_manager->remove_image(filename,
builtin_data,
- INTERPOLATION_LINEAR,
+ interpolation,
EXTENSION_REPEAT);
}
}
@@ -477,7 +478,7 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
0,
is_float_bool,
is_linear,
- INTERPOLATION_LINEAR,
+ interpolation,
EXTENSION_REPEAT,
use_alpha);
is_float = (int)is_float_bool;
@@ -546,7 +547,7 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler)
0,
is_float_bool,
is_linear,
- INTERPOLATION_LINEAR,
+ interpolation,
EXTENSION_REPEAT,
use_alpha);
is_float = (int)is_float_bool;
@@ -564,6 +565,9 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler)
compiler.parameter("color_space", "Linear");
else
compiler.parameter("color_space", "sRGB");
+
+ compiler.parameter("interpolation", get_osl_interpolation_parameter(interpolation));
+
compiler.parameter("is_float", is_float);
compiler.parameter("use_alpha", !alpha_out->links.empty());
compiler.add(this, "node_environment_texture");
@@ -1381,7 +1385,7 @@ PointDensityTextureNode::~PointDensityTextureNode()
image_manager->remove_image(filename,
builtin_data,
interpolation,
- EXTENSION_REPEAT);
+ EXTENSION_CLIP);
}
}
@@ -1413,10 +1417,10 @@ void PointDensityTextureNode::compile(SVMCompiler& compiler)
image_manager = compiler.image_manager;
- if (use_density || use_color) {
- if (use_density)
+ if(use_density || use_color) {
+ if(use_density)
compiler.stack_assign(density_out);
- if (use_color)
+ if(use_color)
compiler.stack_assign(color_out);
if(slot == -1) {
@@ -1425,7 +1429,7 @@ void PointDensityTextureNode::compile(SVMCompiler& compiler)
false, 0,
is_float, is_linear,
interpolation,
- EXTENSION_REPEAT,
+ EXTENSION_CLIP,
true);
}
@@ -1466,14 +1470,14 @@ void PointDensityTextureNode::compile(OSLCompiler& compiler)
image_manager = compiler.image_manager;
- if (use_density || use_color) {
+ if(use_density || use_color) {
if(slot == -1) {
bool is_float, is_linear;
slot = image_manager->add_image(filename, builtin_data,
false, 0,
is_float, is_linear,
interpolation,
- EXTENSION_REPEAT,
+ EXTENSION_CLIP,
true);
}
@@ -1484,7 +1488,7 @@ void PointDensityTextureNode::compile(OSLCompiler& compiler)
compiler.parameter("mapping", transform_transpose(tfm));
compiler.parameter("use_mapping", 1);
}
- switch (interpolation) {
+ switch(interpolation) {
case INTERPOLATION_CLOSEST:
compiler.parameter("interpolation", "closest");
break;
@@ -1675,7 +1679,7 @@ void ConvertNode::compile(SVMCompiler& compiler)
compiler.stack_assign(in);
compiler.stack_assign(out);
- compiler.add_node(NODE_VALUE_V, in->stack_offset);
+ compiler.add_node(NODE_VALUE_V, out->stack_offset);
compiler.add_node(NODE_VALUE_V, in->value);
}
}
@@ -2354,6 +2358,7 @@ HairBsdfNode::HairBsdfNode()
add_input("Offset", SHADER_SOCKET_FLOAT);
add_input("RoughnessU", SHADER_SOCKET_FLOAT);
add_input("RoughnessV", SHADER_SOCKET_FLOAT);
+ add_input("Tangent", SHADER_SOCKET_VECTOR);
}
void HairBsdfNode::compile(SVMCompiler& compiler)