Revision: 36685 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36685 Author: blendix Date: 2011-05-14 09:42:02 +0000 (Sat, 14 May 2011) Log Message: ----------- Cycles: OSL build fixes, based on patch from erwin94.
Modified Paths: -------------- branches/cycles/intern/cycles/kernel/osl/CMakeLists.txt branches/cycles/intern/cycles/kernel/osl/nodes/node_environment_texture.osl branches/cycles/intern/cycles/kernel/osl/nodes/node_image_texture.osl branches/cycles/intern/cycles/kernel/osl/osl_shader.cpp Added Paths: ----------- branches/cycles/intern/cycles/kernel/osl/nodes/node_color.h Modified: branches/cycles/intern/cycles/kernel/osl/CMakeLists.txt =================================================================== --- branches/cycles/intern/cycles/kernel/osl/CMakeLists.txt 2011-05-14 06:32:25 UTC (rev 36684) +++ branches/cycles/intern/cycles/kernel/osl/CMakeLists.txt 2011-05-14 09:42:02 UTC (rev 36685) @@ -27,7 +27,7 @@ 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) Added: branches/cycles/intern/cycles/kernel/osl/nodes/node_color.h =================================================================== --- branches/cycles/intern/cycles/kernel/osl/nodes/node_color.h (rev 0) +++ branches/cycles/intern/cycles/kernel/osl/nodes/node_color.h 2011-05-14 09:42:02 UTC (rev 36685) @@ -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])); +} + Modified: branches/cycles/intern/cycles/kernel/osl/nodes/node_environment_texture.osl =================================================================== --- branches/cycles/intern/cycles/kernel/osl/nodes/node_environment_texture.osl 2011-05-14 06:32:25 UTC (rev 36684) +++ branches/cycles/intern/cycles/kernel/osl/nodes/node_environment_texture.osl 2011-05-14 09:42:02 UTC (rev 36685) @@ -17,6 +17,7 @@ */ #include "stdosl.h" +#include "node_color.h" shader node_environment_texture( vector Vector = P, Modified: branches/cycles/intern/cycles/kernel/osl/nodes/node_image_texture.osl =================================================================== --- branches/cycles/intern/cycles/kernel/osl/nodes/node_image_texture.osl 2011-05-14 06:32:25 UTC (rev 36684) +++ branches/cycles/intern/cycles/kernel/osl/nodes/node_image_texture.osl 2011-05-14 09:42:02 UTC (rev 36685) @@ -17,6 +17,7 @@ */ #include "stdosl.h" +#include "node_color.h" shader node_image_texture( point Vector = P, Modified: branches/cycles/intern/cycles/kernel/osl/osl_shader.cpp =================================================================== --- branches/cycles/intern/cycles/kernel/osl/osl_shader.cpp 2011-05-14 06:32:25 UTC (rev 36684) +++ branches/cycles/intern/cycles/kernel/osl/osl_shader.cpp 2011-05-14 09:42:02 UTC (rev 36685) @@ -31,7 +31,7 @@ CCL_NAMESPACE_BEGIN -tls_ptr(ThreadData, OSLGlobals::thread_data); +tls_ptr(OSLGlobals::ThreadData, OSLGlobals::thread_data); /* Threads */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs