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:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-07-21 22:58:19 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-07-21 22:58:19 +0300
commitf2c54df625d65c40f6070294a5f66de3f2d18c10 (patch)
tree1f5b12ba40e6e9b563d84c9df5ebe47b24ead20e /intern/cycles/kernel/shaders
parentdc3563ff4801907ec8cd21a1589f0cb56d021a8f (diff)
Cycles: Expose image image extension mapping to the image manager
Currently only two mappings are supported by API, which is Repeat (old behavior) and new Clip behavior. Internally this extension is being converted to periodic flag which was already supported but wasn't exposed. There's no support for OpenCL yet because of the way how we pack images into a single texture. Those settings are not exposed to UI or anywhere else and there should be no functional changes so far.
Diffstat (limited to 'intern/cycles/kernel/shaders')
-rw-r--r--intern/cycles/kernel/shaders/node_image_texture.osl66
1 files changed, 56 insertions, 10 deletions
diff --git a/intern/cycles/kernel/shaders/node_image_texture.osl b/intern/cycles/kernel/shaders/node_image_texture.osl
index 46a02cab32e..d3a347b70db 100644
--- a/intern/cycles/kernel/shaders/node_image_texture.osl
+++ b/intern/cycles/kernel/shaders/node_image_texture.osl
@@ -55,9 +55,16 @@ point map_to_sphere(vector dir)
return point(u, v, 0.0);
}
-color image_texture_lookup(string filename, string color_space, float u, float v, output float Alpha, int use_alpha, int is_float, string interpolation)
+color image_texture_lookup(string filename,
+ string color_space,
+ float u, float v,
+ output float Alpha,
+ int use_alpha,
+ int is_float,
+ string interpolation,
+ string wrap)
{
- color rgb = (color)texture(filename, u, 1.0 - v, "wrap", "periodic", "interp", interpolation, "alpha", Alpha);
+ color rgb = (color)texture(filename, u, 1.0 - v, "wrap", wrap, "interp", interpolation, "alpha", Alpha);
if (use_alpha) {
rgb = color_unpremultiply(rgb, Alpha);
@@ -81,6 +88,7 @@ shader node_image_texture(
string color_space = "sRGB",
string projection = "Flat",
string interpolation = "smartcubic",
+ string wrap = "periodic",
float projection_blend = 0.0,
int is_float = 1,
int use_alpha = 1,
@@ -93,7 +101,14 @@ shader node_image_texture(
p = transform(mapping, p);
if (projection == "Flat") {
- Color = image_texture_lookup(filename, color_space, p[0], p[1], Alpha, use_alpha, is_float, interpolation);
+ Color = image_texture_lookup(filename,
+ color_space,
+ p[0], p[1],
+ Alpha,
+ use_alpha,
+ is_float,
+ interpolation,
+ wrap);
}
else if (projection == "Box") {
/* object space normal */
@@ -162,28 +177,59 @@ shader node_image_texture(
float tmp_alpha;
if (weight[0] > 0.0) {
- Color += weight[0] * image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha, use_alpha, is_float, interpolation);
+ Color += weight[0] * image_texture_lookup(filename,
+ color_space,
+ p[1], p[2],
+ tmp_alpha,
+ use_alpha,
+ is_float,
+ interpolation,
+ wrap);
Alpha += weight[0] * tmp_alpha;
}
if (weight[1] > 0.0) {
- Color += weight[1] * image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha, use_alpha, is_float, interpolation);
+ Color += weight[1] * image_texture_lookup(filename,
+ color_space,
+ p[0], p[2],
+ tmp_alpha,
+ use_alpha,
+ is_float,
+ interpolation,
+ wrap);
Alpha += weight[1] * tmp_alpha;
}
if (weight[2] > 0.0) {
- Color += weight[2] * image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha, use_alpha, is_float, interpolation);
+ Color += weight[2] * image_texture_lookup(filename,
+ color_space,
+ p[1], p[0],
+ tmp_alpha,
+ use_alpha,
+ is_float,
+ interpolation,
+ wrap);
Alpha += weight[2] * tmp_alpha;
}
}
else if (projection == "Sphere") {
point projected = map_to_sphere(texco_remap_square(p));
- Color = image_texture_lookup(filename, color_space,
+ Color = image_texture_lookup(filename,
+ color_space,
projected[0], projected[1],
- Alpha, use_alpha, is_float, interpolation);
+ Alpha,
+ use_alpha,
+ is_float,
+ interpolation,
+ wrap);
}
else if (projection == "Tube") {
point projected = map_to_tube(texco_remap_square(p));
- Color = image_texture_lookup(filename, color_space,
+ Color = image_texture_lookup(filename,
+ color_space,
projected[0], projected[1],
- Alpha, use_alpha, is_float, interpolation);
+ Alpha,
+ use_alpha,
+ is_float,
+ interpolation,
+ wrap);
}
}