Cycles: support loading images from arbitrary OpenColorIO color space
[blender.git] / intern / cycles / kernel / osl / osl_services.cpp
index 7de596a..0257f56 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <string.h>
 
+#include "render/colorspace.h"
 #include "render/mesh.h"
 #include "render/object.h"
 #include "render/scene.h"
@@ -1116,6 +1117,9 @@ bool OSLRenderServices::texture(ustring filename,
          * other nasty stuff happening. */
         ts->geterror();
       }
+      else if (handle && handle->processor) {
+        ColorSpaceManager::to_scene_linear(handle->processor, result, nchannels);
+      }
       break;
     }
   }
@@ -1213,6 +1217,9 @@ bool OSLRenderServices::texture3d(ustring filename,
          * other nasty stuff happening. */
         ts->geterror();
       }
+      else if (handle && handle->processor) {
+        ColorSpaceManager::to_scene_linear(handle->processor, result, nchannels);
+      }
       break;
     }
     case OSLTextureHandle::IES:
@@ -1287,6 +1294,9 @@ bool OSLRenderServices::environment(ustring filename,
         result[3] = 1.0f;
     }
   }
+  else if (handle && handle->processor) {
+    ColorSpaceManager::to_scene_linear(handle->processor, result, nchannels);
+  }
 
   return status;
 }