diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-09-02 19:07:51 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-09-02 19:07:51 +0400 |
commit | 092f6344c3e63fed511acf71e059cdc39867f227 (patch) | |
tree | f65159b3009567a5a3e83d68f1c30f4a307936ca | |
parent | ebbfc46bea44c8900eca3deedd25bb990d1fa923 (diff) |
Fixed remaining syntax errors in OSL files. node_sepcomb_rgb.osl is split into 2 parts, since OSL only allows one shader per file.
-rw-r--r-- | intern/cycles/kernel/kernel_accumulate.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/CMakeLists.txt | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_brightness.osl | 11 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_checker_texture.osl | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_combine_rgb.osl | 29 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_gamma.osl | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_invert.osl | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_noise_texture.osl | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_normal.osl | 5 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_separate_rgb.osl (renamed from intern/cycles/kernel/osl/nodes/node_sepcomb_rgb.osl) | 16 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_wave_texture.osl | 2 |
11 files changed, 50 insertions, 36 deletions
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h index d99beb8905a..3f4cd0c4350 100644 --- a/intern/cycles/kernel/kernel_accumulate.h +++ b/intern/cycles/kernel/kernel_accumulate.h @@ -303,7 +303,7 @@ __device_inline void path_radiance_clamp(PathRadiance *L, float3 *L_sum, float c { float sum = fabsf((*L_sum).x) + fabsf((*L_sum).y) + fabsf((*L_sum).z); - if(!isfinite(sum)) { + if(!std::isfinite(sum)) { /* invalid value, reject */ *L_sum = make_float3(0.0f, 0.0f, 0.0f); diff --git a/intern/cycles/kernel/osl/nodes/CMakeLists.txt b/intern/cycles/kernel/osl/nodes/CMakeLists.txt index a4e50bd268f..575554b880f 100644 --- a/intern/cycles/kernel/osl/nodes/CMakeLists.txt +++ b/intern/cycles/kernel/osl/nodes/CMakeLists.txt @@ -8,6 +8,7 @@ set(SRC_OSL node_bump.osl node_camera.osl node_checker_texture.osl + node_combine_rgb.osl node_convert_from_color.osl node_convert_from_float.osl node_convert_from_normal.osl @@ -38,7 +39,7 @@ set(SRC_OSL node_output_displacement.osl node_output_surface.osl node_output_volume.osl - node_sepcomb_rgb.osl + node_separate_rgb.osl node_sky_texture.osl node_texture_coordinate.osl node_translucent_bsdf.osl diff --git a/intern/cycles/kernel/osl/nodes/node_brightness.osl b/intern/cycles/kernel/osl/nodes/node_brightness.osl index a93ff06d443..4f19a20f736 100644 --- a/intern/cycles/kernel/osl/nodes/node_brightness.osl +++ b/intern/cycles/kernel/osl/nodes/node_brightness.osl @@ -20,15 +20,16 @@ shader node_brightness( color ColorIn = color(0.8, 0.8, 0.8), - float Bright = 0.0, + float Brightness = 0.0, float Contrast = 0.0, - output ColorOut = color(0.8, 0.8, 0.8) + output color ColorOut = color(0.8, 0.8, 0.8)) { float delta = Contrast * (1.0/200.0); float a = 1.0 - delta * 2.0; float b; - Bright *= 1.0/100.0; + /* input value is a percentage */ + float bright_factor = Brightness / 100.0; /* * The algorithm is by Werner D. Streidt @@ -38,11 +39,11 @@ shader node_brightness( if (Contrast > 0.0) { a = (a < 0.0 ? 1.0/a : 0.0); - b = a * (Brightness - delta); + b = a * (bright_factor - delta); } else { delta *= -1.0; - b = a * (Brightness + delta); + b = a * (bright_factor + delta); } ColorOut = a * ColorIn + b; diff --git a/intern/cycles/kernel/osl/nodes/node_checker_texture.osl b/intern/cycles/kernel/osl/nodes/node_checker_texture.osl index 306798b645f..e92d7be34fc 100644 --- a/intern/cycles/kernel/osl/nodes/node_checker_texture.osl +++ b/intern/cycles/kernel/osl/nodes/node_checker_texture.osl @@ -49,10 +49,10 @@ shader node_checker_texture( { Fac = checker(Vector*Scale); if(Fac == 1.0) { - Color = color(Color1, Color1, Color1); + Color = Color1; } else { - Color = color(Color2, Color2, Color2); + Color = Color2; } } diff --git a/intern/cycles/kernel/osl/nodes/node_combine_rgb.osl b/intern/cycles/kernel/osl/nodes/node_combine_rgb.osl new file mode 100644 index 00000000000..546369f660e --- /dev/null +++ b/intern/cycles/kernel/osl/nodes/node_combine_rgb.osl @@ -0,0 +1,29 @@ +/* + * Copyright 2011, Blender Foundation. + * + * 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. + */ + +#include "stdosl.h" + +shader node_combine_rgb( + float R = 0.0, + float G = 0.0, + float B = 0.0, + output color Image = color(0.8, 0.8, 0.8)) +{ + Image = color(R, G, B); +} + diff --git a/intern/cycles/kernel/osl/nodes/node_gamma.osl b/intern/cycles/kernel/osl/nodes/node_gamma.osl index 4dae07d70bc..d55e908b0b7 100644 --- a/intern/cycles/kernel/osl/nodes/node_gamma.osl +++ b/intern/cycles/kernel/osl/nodes/node_gamma.osl @@ -21,13 +21,7 @@ shader node_gamma( color ColorIn = color(0.8, 0.8, 0.8), float Gamma = 1.0, - output ColorOut = color(0.8, 0.8, 0.8) + output color ColorOut = color(0.0, 0.0, 0.0)) { - int i; - for (i=0;i<3;i++) { - if (ColorIn[i] > 0.0) - ColorIn[i] = powf(ColorIn[i], Gamma); - } - - ColorOut = ColorIn; + ColorOut = pow(ColorIn, Gamma); } diff --git a/intern/cycles/kernel/osl/nodes/node_invert.osl b/intern/cycles/kernel/osl/nodes/node_invert.osl index 817198c4561..27021942558 100644 --- a/intern/cycles/kernel/osl/nodes/node_invert.osl +++ b/intern/cycles/kernel/osl/nodes/node_invert.osl @@ -21,7 +21,7 @@ shader node_invert( float Fac = 1.0, color ColorIn = color(0.8, 0.8, 0.8), - output ColorOut = color(0.8, 0.8, 0.8) + output color ColorOut = color(0.8, 0.8, 0.8)) { color ColorInv = color(1.0) - ColorIn; ColorOut = mix(ColorIn, ColorInv, Fac); diff --git a/intern/cycles/kernel/osl/nodes/node_noise_texture.osl b/intern/cycles/kernel/osl/nodes/node_noise_texture.osl index 7738902f529..bc59f115cce 100644 --- a/intern/cycles/kernel/osl/nodes/node_noise_texture.osl +++ b/intern/cycles/kernel/osl/nodes/node_noise_texture.osl @@ -35,7 +35,7 @@ float noise(point p, string basis, float distortion, float detail) p += r; } - fac = noise_turbulence(p, basis, detail, hard); + fac = noise_turbulence(p, basis, (int)detail, hard); return fac; diff --git a/intern/cycles/kernel/osl/nodes/node_normal.osl b/intern/cycles/kernel/osl/nodes/node_normal.osl index 06c409e5b78..d5f16acb88c 100644 --- a/intern/cycles/kernel/osl/nodes/node_normal.osl +++ b/intern/cycles/kernel/osl/nodes/node_normal.osl @@ -24,8 +24,7 @@ shader node_normal( output normal NormalOut = normal(0.0, 0.0, 0.0), output float Dot = 1.0) { - Direction = normalize(Direction); - NormalOut = Direction; - Dot = dot(Direction, NormalIn); + NormalOut = normalize(Direction); + Dot = dot(NormalOut, NormalIn); } diff --git a/intern/cycles/kernel/osl/nodes/node_sepcomb_rgb.osl b/intern/cycles/kernel/osl/nodes/node_separate_rgb.osl index a02f31f4b07..b48bd7e59d6 100644 --- a/intern/cycles/kernel/osl/nodes/node_sepcomb_rgb.osl +++ b/intern/cycles/kernel/osl/nodes/node_separate_rgb.osl @@ -24,17 +24,7 @@ shader node_separate_rgb( output float G = 0.0, output float B = 0.0) { - R = Image[0]; - G = Image[1]; - B = Image[2]; + R = Image[0]; + G = Image[1]; + B = Image[2]; } - -shader node_combine_rgb( - float R = 0.0, - float G = 0.0, - float B = 0.0, - output color Image = color(0.8, 0.8, 0.8) -{ - Image = color(R, G, B) -} - diff --git a/intern/cycles/kernel/osl/nodes/node_wave_texture.osl b/intern/cycles/kernel/osl/nodes/node_wave_texture.osl index 693f09ae24c..83f55631f98 100644 --- a/intern/cycles/kernel/osl/nodes/node_wave_texture.osl +++ b/intern/cycles/kernel/osl/nodes/node_wave_texture.osl @@ -38,7 +38,7 @@ float wave(point p, float scale, string type, float detail, float distortion, fl } if(distortion != 0.0) { - n = n +(distortion * noise_turbulence(p*dscale, "Perlin", detail, 0)); + n = n +(distortion * noise_turbulence(p*dscale, "Perlin", (int)detail, 0)); } result = noise_wave("Sine", n); |