forked from bartvdbraak/blender
Fixed remaining syntax errors in OSL files. node_sepcomb_rgb.osl is split into 2 parts, since OSL only allows one shader per file.
This commit is contained in:
parent
ebbfc46bea
commit
092f6344c3
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
29
intern/cycles/kernel/osl/nodes/node_combine_rgb.osl
Normal file
29
intern/cycles/kernel/osl/nodes/node_combine_rgb.osl
Normal file
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user