Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/nodes.cpp
| Show First 20 Lines • Show All 315 Lines • ▼ Show 20 Lines | if (is_float == -1) { | ||||
| compress_as_srgb = metadata.compress_as_srgb; | compress_as_srgb = metadata.compress_as_srgb; | ||||
| known_colorspace = metadata.colorspace; | known_colorspace = metadata.colorspace; | ||||
| } | } | ||||
| if (slot != -1) { | if (slot != -1) { | ||||
| int vector_offset = tex_mapping.compile_begin(compiler, vector_in); | int vector_offset = tex_mapping.compile_begin(compiler, vector_in); | ||||
| uint flags = 0; | uint flags = 0; | ||||
| if (compress_as_srgb) { | |||||
| flags |= NODE_IMAGE_COMPRESS_AS_SRGB; | |||||
| } | |||||
| if (!alpha_out->links.empty()) { | if (!alpha_out->links.empty()) { | ||||
| 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); | ||||
| if (unassociate_alpha) { | if (unassociate_alpha) { | ||||
| flags |= NODE_IMAGE_ALPHA_UNASSOCIATE; | flags |= NODE_IMAGE_ALPHA_UNASSOCIATE; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | if (is_float == -1) { | ||||
| } | } | ||||
| is_float = metadata.is_float; | is_float = metadata.is_float; | ||||
| compress_as_srgb = metadata.compress_as_srgb; | compress_as_srgb = metadata.compress_as_srgb; | ||||
| known_colorspace = metadata.colorspace; | known_colorspace = metadata.colorspace; | ||||
| } | } | ||||
| if (slot == -1) { | if (slot == -1) { | ||||
| compiler.parameter_texture( | compiler.parameter_texture( | ||||
| "filename", filename, compress_as_srgb ? u_colorspace_raw : known_colorspace); | "filename", filename, compress_as_srgb ? ustring("sRGB") : known_colorspace); | ||||
brecht: This should be `u_colorspace_srgb`, and then the OSL code should somehow handle that builtin… | |||||
| } | } | ||||
| else { | else { | ||||
| compiler.parameter_texture("filename", slot); | compiler.parameter_texture("filename", 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); | ||||
| 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("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(this, "interpolation"); | compiler.parameter(this, "interpolation"); | ||||
| compiler.parameter(this, "extension"); | compiler.parameter(this, "extension"); | ||||
| compiler.add(this, "node_image_texture"); | compiler.add(this, "node_image_texture"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | if (slot == -1) { | ||||
| compress_as_srgb = metadata.compress_as_srgb; | compress_as_srgb = metadata.compress_as_srgb; | ||||
| known_colorspace = metadata.colorspace; | known_colorspace = metadata.colorspace; | ||||
| } | } | ||||
| if (slot != -1) { | if (slot != -1) { | ||||
| int vector_offset = tex_mapping.compile_begin(compiler, vector_in); | int vector_offset = tex_mapping.compile_begin(compiler, vector_in); | ||||
| uint flags = 0; | uint flags = 0; | ||||
| if (compress_as_srgb) { | |||||
| flags |= NODE_IMAGE_COMPRESS_AS_SRGB; | |||||
| } | |||||
| compiler.add_node(NODE_TEX_ENVIRONMENT, | compiler.add_node(NODE_TEX_ENVIRONMENT, | ||||
| slot, | slot, | ||||
| compiler.encode_uchar4(vector_offset, | compiler.encode_uchar4(vector_offset, | ||||
| compiler.stack_assign_if_linked(color_out), | compiler.stack_assign_if_linked(color_out), | ||||
| compiler.stack_assign_if_linked(alpha_out), | compiler.stack_assign_if_linked(alpha_out), | ||||
| flags), | flags), | ||||
| projection); | projection); | ||||
| Show All 39 Lines | if (is_float == -1) { | ||||
| } | } | ||||
| is_float = metadata.is_float; | is_float = metadata.is_float; | ||||
| compress_as_srgb = metadata.compress_as_srgb; | compress_as_srgb = metadata.compress_as_srgb; | ||||
| known_colorspace = metadata.colorspace; | known_colorspace = metadata.colorspace; | ||||
| } | } | ||||
| if (slot == -1) { | if (slot == -1) { | ||||
| compiler.parameter_texture( | compiler.parameter_texture( | ||||
| "filename", filename, compress_as_srgb ? u_colorspace_raw : known_colorspace); | "filename", filename, compress_as_srgb ? ustring("sRGB") : known_colorspace); | ||||
| } | } | ||||
| else { | else { | ||||
| compiler.parameter_texture("filename", slot); | compiler.parameter_texture("filename", slot); | ||||
| } | } | ||||
| compiler.parameter(this, "projection"); | compiler.parameter(this, "projection"); | ||||
| compiler.parameter(this, "interpolation"); | compiler.parameter(this, "interpolation"); | ||||
| 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("is_float", is_float); | compiler.parameter("is_float", is_float); | ||||
| compiler.add(this, "node_environment_texture"); | compiler.add(this, "node_environment_texture"); | ||||
| } | } | ||||
| /* Sky Texture */ | /* Sky Texture */ | ||||
| static float2 sky_spherical_coordinates(float3 dir) | static float2 sky_spherical_coordinates(float3 dir) | ||||
| ▲ Show 20 Lines • Show All 6,095 Lines • Show Last 20 Lines | |||||
This should be u_colorspace_srgb, and then the OSL code should somehow handle that builtin colorspace.
We can't assume that the OCIO configuration contains a colorspace named "sRGB", for example the ACES one does not.