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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-14 13:42:02 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-14 13:42:02 +0400
commitfd5937fd1f581d521846f2849f6b5b463d917cf6 (patch)
treea78a1886e47a2ab34bc1d7b1e40a27e3ae3dc22e
parent922bb24865f451aabb1a3112ab8ffb592e3ff875 (diff)
Cycles: OSL build fixes, based on patch from erwin94.
-rw-r--r--intern/cycles/kernel/osl/CMakeLists.txt2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_color.h50
-rw-r--r--intern/cycles/kernel/osl/nodes/node_environment_texture.osl1
-rw-r--r--intern/cycles/kernel/osl/nodes/node_image_texture.osl1
-rw-r--r--intern/cycles/kernel/osl/osl_shader.cpp2
5 files changed, 54 insertions, 2 deletions
diff --git a/intern/cycles/kernel/osl/CMakeLists.txt b/intern/cycles/kernel/osl/CMakeLists.txt
index 3ca3fa4cd6b..31a162bdd0e 100644
--- a/intern/cycles/kernel/osl/CMakeLists.txt
+++ b/intern/cycles/kernel/osl/CMakeLists.txt
@@ -27,7 +27,7 @@ SET(headers
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}")
-ADD_LIBRARY(kernel_osl ${sources} ${headers})
+ADD_LIBRARY(cycles_kernel_osl ${sources} ${headers})
ADD_SUBDIRECTORY(nodes)
diff --git a/intern/cycles/kernel/osl/nodes/node_color.h b/intern/cycles/kernel/osl/nodes/node_color.h
new file mode 100644
index 00000000000..b92973d1dfe
--- /dev/null
+++ b/intern/cycles/kernel/osl/nodes/node_color.h
@@ -0,0 +1,50 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/* Color Management */
+
+float color_srgb_to_scene_linear(float c)
+{
+ if(c < 0.04045)
+ return (c < 0.0)? 0.0: c * (1.0/12.92);
+ else
+ return pow((c + 0.055)*(1.0/1.055), 2.4);
+}
+
+float color_scene_linear_to_srgb(float c)
+{
+ if(c < 0.0031308)
+ return (c < 0.0)? 0.0: c * 12.92;
+ else
+ return 1.055 * pow(c, 1.0/2.4) - 0.055;
+}
+
+color color_srgb_to_scene_linear(color c)
+{
+ return color(
+ color_srgb_to_scene_linear(c[0]),
+ color_srgb_to_scene_linear(c[1]),
+ color_srgb_to_scene_linear(c[2]));
+}
+
+color color_scene_linear_to_srgb(color c)
+{
+ return color(
+ color_scene_linear_to_srgb(c[0]),
+ color_scene_linear_to_srgb(c[1]),
+ color_scene_linear_to_srgb(c[2]));
+}
+
diff --git a/intern/cycles/kernel/osl/nodes/node_environment_texture.osl b/intern/cycles/kernel/osl/nodes/node_environment_texture.osl
index ee3fc44f0f8..267db7bad2d 100644
--- a/intern/cycles/kernel/osl/nodes/node_environment_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_environment_texture.osl
@@ -17,6 +17,7 @@
*/
#include "stdosl.h"
+#include "node_color.h"
shader node_environment_texture(
vector Vector = P,
diff --git a/intern/cycles/kernel/osl/nodes/node_image_texture.osl b/intern/cycles/kernel/osl/nodes/node_image_texture.osl
index e1efb787655..85025db7c74 100644
--- a/intern/cycles/kernel/osl/nodes/node_image_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_image_texture.osl
@@ -17,6 +17,7 @@
*/
#include "stdosl.h"
+#include "node_color.h"
shader node_image_texture(
point Vector = P,
diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp
index f4ae0248bef..a86946a680e 100644
--- a/intern/cycles/kernel/osl/osl_shader.cpp
+++ b/intern/cycles/kernel/osl/osl_shader.cpp
@@ -31,7 +31,7 @@
CCL_NAMESPACE_BEGIN
-tls_ptr(ThreadData, OSLGlobals::thread_data);
+tls_ptr(OSLGlobals::ThreadData, OSLGlobals::thread_data);
/* Threads */