Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/scene/shader_nodes.cpp
| Show All 26 Lines | |||||
| #include "scene/scene.h" | #include "scene/scene.h" | ||||
| #include "scene/svm.h" | #include "scene/svm.h" | ||||
| #include "sky_model.h" | #include "sky_model.h" | ||||
| #include "util/color.h" | #include "util/color.h" | ||||
| #include "util/foreach.h" | #include "util/foreach.h" | ||||
| #include "util/log.h" | #include "util/log.h" | ||||
| #include "util/string.h" | |||||
| #include "util/transform.h" | #include "util/transform.h" | ||||
| #include "kernel/tables.h" | #include "kernel/tables.h" | ||||
| #include "kernel/svm/color_util.h" | #include "kernel/svm/color_util.h" | ||||
| #include "kernel/svm/mapping_util.h" | #include "kernel/svm/mapping_util.h" | ||||
| #include "kernel/svm/math_util.h" | #include "kernel/svm/math_util.h" | ||||
| #include "kernel/svm/ramp_util.h" | #include "kernel/svm/ramp_util.h" | ||||
| ▲ Show 20 Lines • Show All 414 Lines • ▼ Show 20 Lines | void ImageTextureNode::compile(OSLCompiler &compiler) | ||||
| } | } | ||||
| const ImageMetaData metadata = handle.metadata(); | const ImageMetaData metadata = handle.metadata(); | ||||
| const bool is_float = metadata.is_float(); | const bool is_float = metadata.is_float(); | ||||
| const bool compress_as_srgb = metadata.compress_as_srgb; | const bool compress_as_srgb = metadata.compress_as_srgb; | ||||
| const ustring known_colorspace = metadata.colorspace; | const ustring known_colorspace = metadata.colorspace; | ||||
| if (handle.svm_slot() == -1) { | if (handle.svm_slot() == -1) { | ||||
| /* OIIO currently does not support <UVTILE> substitutions natively. Replace with a format they | |||||
| * understand. */ | |||||
| std::string osl_filename = filename.string(); | |||||
| string_replace(osl_filename, "<UVTILE>", "<U>_<V>"); | |||||
| compiler.parameter_texture( | compiler.parameter_texture( | ||||
| "filename", filename, compress_as_srgb ? u_colorspace_raw : known_colorspace); | "filename", ustring(osl_filename), compress_as_srgb ? u_colorspace_raw : known_colorspace); | ||||
| } | } | ||||
| else { | else { | ||||
| compiler.parameter_texture("filename", handle.svm_slot()); | compiler.parameter_texture("filename", handle.svm_slot()); | ||||
| } | } | ||||
| const bool unassociate_alpha = !(ColorSpaceManager::colorspace_is_data(colorspace) || | const bool unassociate_alpha = !(ColorSpaceManager::colorspace_is_data(colorspace) || | ||||
| alpha_type == IMAGE_ALPHA_CHANNEL_PACKED || | alpha_type == IMAGE_ALPHA_CHANNEL_PACKED || | ||||
| alpha_type == IMAGE_ALPHA_IGNORE); | alpha_type == IMAGE_ALPHA_IGNORE); | ||||
| const bool is_tiled = (filename.find("<UDIM>") != string::npos); | const bool is_tiled = (filename.find("<UDIM>") != string::npos || | ||||
| filename.find("<UVTILE>") != string::npos); | |||||
| compiler.parameter(this, "projection"); | compiler.parameter(this, "projection"); | ||||
| compiler.parameter(this, "projection_blend"); | compiler.parameter(this, "projection_blend"); | ||||
| compiler.parameter("compress_as_srgb", compress_as_srgb); | compiler.parameter("compress_as_srgb", compress_as_srgb); | ||||
| compiler.parameter("ignore_alpha", alpha_type == IMAGE_ALPHA_IGNORE); | compiler.parameter("ignore_alpha", alpha_type == IMAGE_ALPHA_IGNORE); | ||||
| compiler.parameter("unassociate_alpha", !alpha_out->links.empty() && unassociate_alpha); | compiler.parameter("unassociate_alpha", !alpha_out->links.empty() && unassociate_alpha); | ||||
| compiler.parameter("is_float", is_float); | compiler.parameter("is_float", is_float); | ||||
| compiler.parameter("is_tiled", is_tiled); | compiler.parameter("is_tiled", is_tiled); | ||||
| ▲ Show 20 Lines • Show All 6,769 Lines • Show Last 20 Lines | |||||