Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/shaders/node_image_texture.osl
| Context not available. | |||||
| #include "stdosl.h" | #include "stdosl.h" | ||||
| #include "node_color.h" | #include "node_color.h" | ||||
| color image_texture_lookup(string filename, string color_space, float u, float v, output float Alpha, int use_alpha, int is_float) | 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 rgb = (color)texture(filename, u, 1.0 - v, "wrap", "periodic", "alpha", Alpha); | color rgb = (color)texture(filename, u, 1.0 - v, "wrap", "periodic", "interp", interpolation, "alpha", Alpha); | ||||
| if (use_alpha) { | if (use_alpha) { | ||||
| rgb = color_unpremultiply(rgb, Alpha); | rgb = color_unpremultiply(rgb, Alpha); | ||||
| Context not available. | |||||
| string filename = "", | string filename = "", | ||||
| string color_space = "sRGB", | string color_space = "sRGB", | ||||
| string projection = "Flat", | string projection = "Flat", | ||||
| string interpolation = "smartcubic", | |||||
| float projection_blend = 0.0, | float projection_blend = 0.0, | ||||
| int is_float = 1, | int is_float = 1, | ||||
| int use_alpha = 1, | int use_alpha = 1, | ||||
| Context not available. | |||||
| p = transform(mapping, p); | p = transform(mapping, p); | ||||
| if (projection == "Flat") { | if (projection == "Flat") { | ||||
| Color = image_texture_lookup(filename, color_space, p[0], p[1], Alpha, use_alpha, is_float); | Color = image_texture_lookup(filename, color_space, p[0], p[1], Alpha, use_alpha, is_float, interpolation); | ||||
| } | } | ||||
| else if (projection == "Box") { | else if (projection == "Box") { | ||||
| /* object space normal */ | /* object space normal */ | ||||
| Context not available. | |||||
| float tmp_alpha; | float tmp_alpha; | ||||
| if (weight[0] > 0.0) { | if (weight[0] > 0.0) { | ||||
| Color += weight[0] * image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha, use_alpha, is_float); | Color += weight[0] * image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha, use_alpha, is_float, interpolation); | ||||
| Alpha += weight[0] * tmp_alpha; | Alpha += weight[0] * tmp_alpha; | ||||
| } | } | ||||
| if (weight[1] > 0.0) { | if (weight[1] > 0.0) { | ||||
| Color += weight[1] * image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha, use_alpha, is_float); | Color += weight[1] * image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha, use_alpha, is_float, interpolation); | ||||
| Alpha += weight[1] * tmp_alpha; | Alpha += weight[1] * tmp_alpha; | ||||
| } | } | ||||
| if (weight[2] > 0.0) { | if (weight[2] > 0.0) { | ||||
| Color += weight[2] * image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha, use_alpha, is_float); | Color += weight[2] * image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha, use_alpha, is_float, interpolation); | ||||
| Alpha += weight[2] * tmp_alpha; | Alpha += weight[2] * tmp_alpha; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||