Code refactor: add separate RGB to BW node and rename some sockets.
This commit is contained in:
@@ -59,10 +59,10 @@ float brick(point p, float mortar_size, float bias,
|
||||
shader node_brick_texture(
|
||||
int use_mapping = 0,
|
||||
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
float Offset = 0.5,
|
||||
int OffsetFrequency = 2,
|
||||
float Squash = 1.0,
|
||||
int SquashFrequency = 1,
|
||||
float offset = 0.5,
|
||||
int offset_frequency = 2,
|
||||
float squash = 1.0,
|
||||
int squash_frequency = 1,
|
||||
point Vector = P,
|
||||
color Color1 = 0.2,
|
||||
color Color2 = 0.8,
|
||||
@@ -84,7 +84,7 @@ shader node_brick_texture(
|
||||
color Col = Color1;
|
||||
|
||||
Fac = brick(p * Scale, MortarSize, Bias, BrickWidth, RowHeight,
|
||||
Offset, OffsetFrequency, Squash, SquashFrequency, tint);
|
||||
offset, offset_frequency, squash, squash_frequency, tint);
|
||||
|
||||
if (Fac != 1.0) {
|
||||
float facm = 1.0 - tint;
|
||||
|
@@ -17,18 +17,18 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_convert_from_color(
|
||||
color Color = 0.0,
|
||||
output string String = "",
|
||||
output float Val = 0.0,
|
||||
output int ValInt = 0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output point Point = point(0.0, 0.0, 0.0),
|
||||
output normal Normal = normal(0.0, 0.0, 0.0))
|
||||
color value_color = 0.0,
|
||||
output string value_string = "",
|
||||
output float value_float = 0.0,
|
||||
output int value_int = 0,
|
||||
output vector value_vector = vector(0.0, 0.0, 0.0),
|
||||
output point value_point = point(0.0, 0.0, 0.0),
|
||||
output normal value_normal = normal(0.0, 0.0, 0.0))
|
||||
{
|
||||
Val = Color[0] * 0.2126 + Color[1] * 0.7152 + Color[2] * 0.0722;
|
||||
ValInt = (int)(Color[0] * 0.2126 + Color[1] * 0.7152 + Color[2] * 0.0722);
|
||||
Vector = vector(Color[0], Color[1], Color[2]);
|
||||
Point = point(Color[0], Color[1], Color[2]);
|
||||
Normal = normal(Color[0], Color[1], Color[2]);
|
||||
value_float = value_color[0] * 0.2126 + value_color[1] * 0.7152 + value_color[2] * 0.0722;
|
||||
value_int = (int)(value_color[0] * 0.2126 + value_color[1] * 0.7152 + value_color[2] * 0.0722);
|
||||
value_vector = vector(value_color[0], value_color[1], value_color[2]);
|
||||
value_point = point(value_color[0], value_color[1], value_color[2]);
|
||||
value_normal = normal(value_color[0], value_color[1], value_color[2]);
|
||||
}
|
||||
|
||||
|
@@ -17,18 +17,18 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_convert_from_float(
|
||||
float Val = 0.0,
|
||||
output string String = "",
|
||||
output int ValInt = 0,
|
||||
output color Color = 0.0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output point Point = point(0.0, 0.0, 0.0),
|
||||
output normal Normal = normal(0.0, 0.0, 0.0))
|
||||
float value_float = 0.0,
|
||||
output string value_string = "",
|
||||
output int value_int = 0,
|
||||
output color value_color = 0.0,
|
||||
output vector value_vector = vector(0.0, 0.0, 0.0),
|
||||
output point value_point = point(0.0, 0.0, 0.0),
|
||||
output normal value_normal = normal(0.0, 0.0, 0.0))
|
||||
{
|
||||
ValInt = (int)Val;
|
||||
Color = color(Val, Val, Val);
|
||||
Vector = vector(Val, Val, Val);
|
||||
Point = point(Val, Val, Val);
|
||||
Normal = normal(Val, Val, Val);
|
||||
value_int = (int)value_float;
|
||||
value_color = color(value_float, value_float, value_float);
|
||||
value_vector = vector(value_float, value_float, value_float);
|
||||
value_point = point(value_float, value_float, value_float);
|
||||
value_normal = normal(value_float, value_float, value_float);
|
||||
}
|
||||
|
||||
|
@@ -17,19 +17,19 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_convert_from_int(
|
||||
int ValInt = 0,
|
||||
output string String = "",
|
||||
output float Val = 0.0,
|
||||
output color Color = 0.0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output point Point = point(0.0, 0.0, 0.0),
|
||||
output normal Normal = normal(0.0, 0.0, 0.0))
|
||||
int value_int = 0,
|
||||
output string value_string = "",
|
||||
output float value_float = 0.0,
|
||||
output color value_color = 0.0,
|
||||
output vector value_vector = vector(0.0, 0.0, 0.0),
|
||||
output point value_point = point(0.0, 0.0, 0.0),
|
||||
output normal value_normal = normal(0.0, 0.0, 0.0))
|
||||
{
|
||||
float f = (float)ValInt;
|
||||
Val = f;
|
||||
Color = color(f, f, f);
|
||||
Vector = vector(f, f, f);
|
||||
Point = point(f, f, f);
|
||||
Normal = normal(f, f, f);
|
||||
float f = (float)value_int;
|
||||
value_float = f;
|
||||
value_color = color(f, f, f);
|
||||
value_vector = vector(f, f, f);
|
||||
value_point = point(f, f, f);
|
||||
value_normal = normal(f, f, f);
|
||||
}
|
||||
|
||||
|
@@ -17,18 +17,18 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_convert_from_normal(
|
||||
normal Normal = normal(0.0, 0.0, 0.0),
|
||||
output string String = "",
|
||||
output float Val = 0.0,
|
||||
output int ValInt = 0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output color Color = 0.0,
|
||||
output point Point = point(0.0, 0.0, 0.0))
|
||||
normal value_normal = normal(0.0, 0.0, 0.0),
|
||||
output string value_string = "",
|
||||
output float value_float = 0.0,
|
||||
output int value_int = 0,
|
||||
output vector value_vector = vector(0.0, 0.0, 0.0),
|
||||
output color value_color = 0.0,
|
||||
output point value_point = point(0.0, 0.0, 0.0))
|
||||
{
|
||||
Val = (Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0);
|
||||
ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0));
|
||||
Vector = vector(Normal[0], Normal[1], Normal[2]);
|
||||
Color = color(Normal[0], Normal[1], Normal[2]);
|
||||
Point = point(Normal[0], Normal[1], Normal[2]);
|
||||
value_float = (value_normal[0] + value_normal[1] + value_normal[2]) * (1.0 / 3.0);
|
||||
value_int = (int)((value_normal[0] + value_normal[1] + value_normal[2]) * (1.0 / 3.0));
|
||||
value_vector = vector(value_normal[0], value_normal[1], value_normal[2]);
|
||||
value_color = color(value_normal[0], value_normal[1], value_normal[2]);
|
||||
value_point = point(value_normal[0], value_normal[1], value_normal[2]);
|
||||
}
|
||||
|
||||
|
@@ -17,18 +17,18 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_convert_from_point(
|
||||
point Point = point(0.0, 0.0, 0.0),
|
||||
output string String = "",
|
||||
output float Val = 0.0,
|
||||
output int ValInt = 0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output color Color = 0.0,
|
||||
output normal Normal = normal(0.0, 0.0, 0.0))
|
||||
point value_point = point(0.0, 0.0, 0.0),
|
||||
output string value_string = "",
|
||||
output float value_float = 0.0,
|
||||
output int value_int = 0,
|
||||
output vector value_vector = vector(0.0, 0.0, 0.0),
|
||||
output color value_color = 0.0,
|
||||
output normal value_normal = normal(0.0, 0.0, 0.0))
|
||||
{
|
||||
Val = (Point[0] + Point[1] + Point[2]) * (1.0 / 3.0);
|
||||
ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0));
|
||||
Vector = vector(Point[0], Point[1], Point[2]);
|
||||
Color = color(Point[0], Point[1], Point[2]);
|
||||
Normal = normal(Point[0], Point[1], Point[2]);
|
||||
value_float = (value_point[0] + value_point[1] + value_point[2]) * (1.0 / 3.0);
|
||||
value_int = (int)((value_normal[0] + value_normal[1] + value_normal[2]) * (1.0 / 3.0));
|
||||
value_vector = vector(value_point[0], value_point[1], value_point[2]);
|
||||
value_color = color(value_point[0], value_point[1], value_point[2]);
|
||||
value_normal = normal(value_point[0], value_point[1], value_point[2]);
|
||||
}
|
||||
|
||||
|
@@ -17,13 +17,13 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_convert_from_string(
|
||||
string String = "",
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output float Val = 0.0,
|
||||
output int ValInt = 0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output point Point = point(0.0, 0.0, 0.0),
|
||||
output normal Normal = normal(0.0, 0.0, 0.0))
|
||||
string value_string = "",
|
||||
output color value_color = color(0.0, 0.0, 0.0),
|
||||
output float value_float = 0.0,
|
||||
output int value_int = 0,
|
||||
output vector value_vector = vector(0.0, 0.0, 0.0),
|
||||
output point value_point = point(0.0, 0.0, 0.0),
|
||||
output normal value_normal = normal(0.0, 0.0, 0.0))
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -17,18 +17,18 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_convert_from_vector(
|
||||
vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output string String = "",
|
||||
output float Val = 0.0,
|
||||
output int ValInt = 0,
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output point Point = point(0.0, 0.0, 0.0),
|
||||
output normal Normal = normal(0.0, 0.0, 0.0))
|
||||
vector value_vector = vector(0.0, 0.0, 0.0),
|
||||
output string value_string = "",
|
||||
output float value_float = 0.0,
|
||||
output int value_int = 0,
|
||||
output color value_color = color(0.0, 0.0, 0.0),
|
||||
output point value_point = point(0.0, 0.0, 0.0),
|
||||
output normal value_normal = normal(0.0, 0.0, 0.0))
|
||||
{
|
||||
Val = (Vector[0] + Vector[1] + Vector[2]) * (1.0 / 3.0);
|
||||
ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0));
|
||||
Color = color(Vector[0], Vector[1], Vector[2]);
|
||||
Point = point(Vector[0], Vector[1], Vector[2]);
|
||||
Normal = normal(Vector[0], Vector[1], Vector[2]);
|
||||
value_float = (value_vector[0] + value_vector[1] + value_vector[2]) * (1.0 / 3.0);
|
||||
value_int = (int)((value_normal[0] + value_normal[1] + value_normal[2]) * (1.0 / 3.0));
|
||||
value_color = color(value_vector[0], value_vector[1], value_vector[2]);
|
||||
value_point = point(value_vector[0], value_vector[1], value_vector[2]);
|
||||
value_normal = normal(value_vector[0], value_vector[1], value_vector[2]);
|
||||
}
|
||||
|
||||
|
@@ -63,7 +63,7 @@ float gradient(point p, string type)
|
||||
shader node_gradient_texture(
|
||||
int use_mapping = 0,
|
||||
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
string Type = "Linear",
|
||||
string type = "Linear",
|
||||
point Vector = P,
|
||||
output float Fac = 0.0,
|
||||
output color Color = 0.0)
|
||||
@@ -73,7 +73,7 @@ shader node_gradient_texture(
|
||||
if (use_mapping)
|
||||
p = transform(mapping, p);
|
||||
|
||||
Fac = gradient(p, Type);
|
||||
Fac = gradient(p, type);
|
||||
Color = color(Fac, Fac, Fac);
|
||||
}
|
||||
|
||||
|
@@ -62,9 +62,9 @@ color image_texture_lookup(string filename,
|
||||
int use_alpha,
|
||||
int is_float,
|
||||
string interpolation,
|
||||
string wrap)
|
||||
string extension)
|
||||
{
|
||||
color rgb = (color)texture(filename, u, 1.0 - v, "wrap", wrap, "interp", interpolation, "alpha", Alpha);
|
||||
color rgb = (color)texture(filename, u, 1.0 - v, "wrap", extension, "interp", interpolation, "alpha", Alpha);
|
||||
|
||||
if (use_alpha) {
|
||||
rgb = color_unpremultiply(rgb, Alpha);
|
||||
|
@@ -93,7 +93,7 @@ color magic(point p, int n, float distortion)
|
||||
shader node_magic_texture(
|
||||
int use_mapping = 0,
|
||||
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
int Depth = 2,
|
||||
int depth = 2,
|
||||
float Distortion = 5.0,
|
||||
float Scale = 5.0,
|
||||
point Vector = P,
|
||||
@@ -105,7 +105,7 @@ shader node_magic_texture(
|
||||
if (use_mapping)
|
||||
p = transform(mapping, p);
|
||||
|
||||
Color = magic(p * Scale, Depth, Distortion);
|
||||
Color = magic(p * Scale, depth, Distortion);
|
||||
Fac = (Color[0] + Color[1] + Color[2]) * (1.0 / 3.0);
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,7 @@ float safe_log(float a, float b)
|
||||
|
||||
shader node_math(
|
||||
string type = "Add",
|
||||
int Clamp = 0,
|
||||
int use_clamp = 0,
|
||||
float Value1 = 0.0,
|
||||
float Value2 = 0.0,
|
||||
output float Value = 0.0)
|
||||
@@ -96,7 +96,7 @@ shader node_math(
|
||||
else if (type == "Absolute")
|
||||
Value = fabs(Value1);
|
||||
|
||||
if (Clamp)
|
||||
if (use_clamp)
|
||||
Value = clamp(Value, 0.0, 1.0);
|
||||
}
|
||||
|
||||
|
@@ -278,7 +278,7 @@ color node_mix_clamp(color col)
|
||||
|
||||
shader node_mix(
|
||||
string type = "Mix",
|
||||
int Clamp = 0,
|
||||
int use_clamp = 0,
|
||||
float Fac = 0.5,
|
||||
color Color1 = 0.0,
|
||||
color Color2 = 0.0,
|
||||
@@ -323,7 +323,7 @@ shader node_mix(
|
||||
if (type == "Linear Light")
|
||||
Color = node_mix_linear(t, Color1, Color2);
|
||||
|
||||
if (Clamp)
|
||||
if (use_clamp)
|
||||
Color = node_mix_clamp(Color);
|
||||
}
|
||||
|
||||
|
@@ -187,7 +187,7 @@ float noise_musgrave_ridged_multi_fractal(point p, float H, float lacunarity,
|
||||
shader node_musgrave_texture(
|
||||
int use_mapping = 0,
|
||||
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
string Type = "fBM",
|
||||
string type = "fBM",
|
||||
float Dimension = 2.0,
|
||||
float Lacunarity = 1.0,
|
||||
float Detail = 2.0,
|
||||
@@ -210,15 +210,15 @@ shader node_musgrave_texture(
|
||||
|
||||
p = p * Scale;
|
||||
|
||||
if (Type == "Multifractal")
|
||||
if (type == "Multifractal")
|
||||
Fac = intensity * noise_musgrave_multi_fractal(p, dimension, lacunarity, octaves);
|
||||
else if (Type == "fBM")
|
||||
else if (type == "fBM")
|
||||
Fac = intensity * noise_musgrave_fBm(p, dimension, lacunarity, octaves);
|
||||
else if (Type == "Hybrid Multifractal")
|
||||
else if (type == "Hybrid Multifractal")
|
||||
Fac = intensity * noise_musgrave_hybrid_multi_fractal(p, dimension, lacunarity, octaves, Offset, Gain);
|
||||
else if (Type == "Ridged Multifractal")
|
||||
else if (type == "Ridged Multifractal")
|
||||
Fac = intensity * noise_musgrave_ridged_multi_fractal(p, dimension, lacunarity, octaves, Offset, Gain);
|
||||
else if (Type == "Hetero Terrain")
|
||||
else if (type == "Hetero Terrain")
|
||||
Fac = intensity * noise_musgrave_hetero_terrain(p, dimension, lacunarity, octaves, Offset);
|
||||
|
||||
Color = color(Fac, Fac, Fac);
|
||||
|
@@ -17,12 +17,12 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_normal(
|
||||
normal Direction = normal(0.0, 0.0, 0.0),
|
||||
normal direction = normal(0.0, 0.0, 0.0),
|
||||
normal NormalIn = normal(0.0, 0.0, 0.0),
|
||||
output normal NormalOut = normal(0.0, 0.0, 0.0),
|
||||
output float Dot = 1.0)
|
||||
{
|
||||
NormalOut = normalize(Direction);
|
||||
NormalOut = normalize(direction);
|
||||
Dot = dot(NormalOut, normalize(NormalIn));
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
shader node_rgb_ramp(
|
||||
color ramp_color[] = {0.0},
|
||||
float ramp_alpha[] = {0.0},
|
||||
int ramp_interpolate = 1,
|
||||
int interpolate = 1,
|
||||
|
||||
float Fac = 0.0,
|
||||
output color Color = 0.0,
|
||||
@@ -38,7 +38,7 @@ shader node_rgb_ramp(
|
||||
Color = ramp_color[i];
|
||||
Alpha = ramp_alpha[i];
|
||||
|
||||
if (ramp_interpolate && t > 0.0) {
|
||||
if (interpolate && t > 0.0) {
|
||||
Color = (1.0 - t) * Color + t * ramp_color[i + 1];
|
||||
Alpha = (1.0 - t) * Alpha + t * ramp_alpha[i + 1];
|
||||
}
|
||||
|
@@ -22,13 +22,13 @@ shader node_subsurface_scattering(
|
||||
vector Radius = vector(0.1, 0.1, 0.1),
|
||||
float TextureBlur = 0.0,
|
||||
float Sharpness = 0.0,
|
||||
string Falloff = "Cubic",
|
||||
string falloff = "Cubic",
|
||||
normal Normal = N,
|
||||
output closure color BSSRDF = 0)
|
||||
{
|
||||
if (Falloff == "Gaussian")
|
||||
if (falloff == "Gaussian")
|
||||
BSSRDF = Color * bssrdf_gaussian(Normal, Scale * Radius, TextureBlur);
|
||||
else if (Falloff == "Cubic")
|
||||
else if (falloff == "Cubic")
|
||||
BSSRDF = Color * bssrdf_cubic(Normal, Scale * Radius, TextureBlur, Sharpness);
|
||||
else
|
||||
BSSRDF = Color * bssrdf_burley(Normal, Scale * Radius, TextureBlur, Color);
|
||||
|
@@ -22,7 +22,7 @@
|
||||
shader node_voronoi_texture(
|
||||
int use_mapping = 0,
|
||||
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
string Coloring = "Intensity",
|
||||
string coloring = "Intensity",
|
||||
float Scale = 5.0,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0,
|
||||
@@ -40,7 +40,7 @@ shader node_voronoi_texture(
|
||||
voronoi(p * Scale, 1.0, da, pa);
|
||||
|
||||
/* Colored output */
|
||||
if (Coloring == "Intensity") {
|
||||
if (coloring == "Intensity") {
|
||||
Fac = fabs(da[0]);
|
||||
Color = color(Fac);
|
||||
}
|
||||
|
@@ -48,8 +48,8 @@ float wave(point p, string type, string profile, float detail, float distortion,
|
||||
shader node_wave_texture(
|
||||
int use_mapping = 0,
|
||||
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
string Type = "Bands",
|
||||
string Profile = "Sine",
|
||||
string type = "Bands",
|
||||
string profile = "Sine",
|
||||
float Scale = 5.0,
|
||||
float Distortion = 0.0,
|
||||
float Detail = 2.0,
|
||||
@@ -63,7 +63,7 @@ shader node_wave_texture(
|
||||
if (use_mapping)
|
||||
p = transform(mapping, p);
|
||||
|
||||
Fac = wave(p * Scale, Type, Profile, Detail, Distortion, DetailScale);
|
||||
Fac = wave(p * Scale, type, profile, Detail, Distortion, DetailScale);
|
||||
Color = Fac;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user