Code refactor: add separate RGB to BW node and rename some sockets.
This commit is contained in:
@@ -339,7 +339,7 @@ static ShaderNode *add_node(Scene *scene,
|
||||
node = new HSVNode();
|
||||
}
|
||||
else if(b_node.is_a(&RNA_ShaderNodeRGBToBW)) {
|
||||
node = new ConvertNode(SocketType::COLOR, SocketType::FLOAT);
|
||||
node = new RGBToBWNode();
|
||||
}
|
||||
else if(b_node.is_a(&RNA_ShaderNodeMath)) {
|
||||
BL::ShaderNodeMath b_math_node(b_node);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -343,6 +343,11 @@ typedef enum NodeNormalMapSpace {
|
||||
NODE_NORMAL_MAP_BLENDER_WORLD,
|
||||
} NodeNormalMapSpace;
|
||||
|
||||
typedef enum NodeImageColorSpace {
|
||||
NODE_COLOR_SPACE_NONE = 0,
|
||||
NODE_COLOR_SPACE_COLOR = 1,
|
||||
} NodeImageColorSpace;
|
||||
|
||||
typedef enum NodeImageProjection {
|
||||
NODE_IMAGE_PROJ_FLAT = 0,
|
||||
NODE_IMAGE_PROJ_BOX = 1,
|
||||
@@ -350,6 +355,11 @@ typedef enum NodeImageProjection {
|
||||
NODE_IMAGE_PROJ_TUBE = 3,
|
||||
} NodeImageProjection;
|
||||
|
||||
typedef enum NodeEnvironmentProjection {
|
||||
NODE_ENVIRONMENT_EQUIRECTANGULAR = 0,
|
||||
NODE_ENVIRONMENT_MIRROR_BALL = 1,
|
||||
} NodeEnvironmentProjection;
|
||||
|
||||
typedef enum NodeBumpOffset {
|
||||
NODE_BUMP_OFFSET_CENTER,
|
||||
NODE_BUMP_OFFSET_DX,
|
||||
|
@@ -433,14 +433,14 @@ void ImageTextureNode::compile(OSLCompiler& compiler)
|
||||
|
||||
switch(extension) {
|
||||
case EXTENSION_EXTEND:
|
||||
compiler.parameter("wrap", "clamp");
|
||||
compiler.parameter("extension", "clamp");
|
||||
break;
|
||||
case EXTENSION_CLIP:
|
||||
compiler.parameter("wrap", "black");
|
||||
compiler.parameter("extension", "black");
|
||||
break;
|
||||
case EXTENSION_REPEAT:
|
||||
default:
|
||||
compiler.parameter("wrap", "periodic");
|
||||
compiler.parameter("extension", "periodic");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -867,7 +867,7 @@ void GradientTextureNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
tex_mapping.compile(compiler);
|
||||
|
||||
compiler.parameter("Type", type);
|
||||
compiler.parameter("type", type);
|
||||
compiler.add(this, "node_gradient_texture");
|
||||
}
|
||||
|
||||
@@ -971,7 +971,7 @@ void VoronoiTextureNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
tex_mapping.compile(compiler);
|
||||
|
||||
compiler.parameter("Coloring", coloring);
|
||||
compiler.parameter("coloring", coloring);
|
||||
compiler.add(this, "node_voronoi_texture");
|
||||
}
|
||||
|
||||
@@ -1051,7 +1051,7 @@ void MusgraveTextureNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
tex_mapping.compile(compiler);
|
||||
|
||||
compiler.parameter("Type", type);
|
||||
compiler.parameter("type", type);
|
||||
|
||||
compiler.add(this, "node_musgrave_texture");
|
||||
}
|
||||
@@ -1135,8 +1135,8 @@ void WaveTextureNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
tex_mapping.compile(compiler);
|
||||
|
||||
compiler.parameter("Type", type);
|
||||
compiler.parameter("Profile", profile);
|
||||
compiler.parameter("type", type);
|
||||
compiler.parameter("profile", profile);
|
||||
|
||||
compiler.add(this, "node_wave_texture");
|
||||
}
|
||||
@@ -1186,7 +1186,7 @@ void MagicTextureNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
tex_mapping.compile(compiler);
|
||||
|
||||
compiler.parameter("Depth", depth);
|
||||
compiler.parameter("depth", depth);
|
||||
compiler.add(this, "node_magic_texture");
|
||||
}
|
||||
|
||||
@@ -1311,10 +1311,10 @@ void BrickTextureNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
tex_mapping.compile(compiler);
|
||||
|
||||
compiler.parameter("Offset", offset);
|
||||
compiler.parameter("OffsetFrequency", offset_frequency);
|
||||
compiler.parameter("Squash", squash);
|
||||
compiler.parameter("SquashFrequency", squash_frequency);
|
||||
compiler.parameter("offset", offset);
|
||||
compiler.parameter("offset_frequency", offset_frequency);
|
||||
compiler.parameter("squash", squash);
|
||||
compiler.parameter("squash_frequency", squash_frequency);
|
||||
compiler.add(this, "node_brick_texture");
|
||||
}
|
||||
|
||||
@@ -1504,7 +1504,7 @@ void NormalNode::compile(SVMCompiler& compiler)
|
||||
|
||||
void NormalNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
compiler.parameter_normal("Direction", direction);
|
||||
compiler.parameter_normal("direction", direction);
|
||||
compiler.add(this, "node_normal");
|
||||
}
|
||||
|
||||
@@ -1536,6 +1536,40 @@ void MappingNode::compile(OSLCompiler& compiler)
|
||||
compiler.add(this, "node_mapping");
|
||||
}
|
||||
|
||||
/* RGBToBW */
|
||||
|
||||
RGBToBWNode::RGBToBWNode()
|
||||
: ShaderNode("rgb_to_bw")
|
||||
{
|
||||
add_input("Color", SocketType::COLOR);
|
||||
add_output("Val", SocketType::FLOAT);
|
||||
}
|
||||
|
||||
bool RGBToBWNode::constant_fold(ShaderGraph * /*graph*/,
|
||||
ShaderOutput * /*socket*/,
|
||||
float3 *optimized_value)
|
||||
{
|
||||
if(inputs[0]->link == NULL) {
|
||||
optimized_value->x = linear_rgb_to_gray(inputs[0]->value());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void RGBToBWNode::compile(SVMCompiler& compiler)
|
||||
{
|
||||
compiler.add_node(NODE_CONVERT,
|
||||
NODE_CONVERT_CF,
|
||||
compiler.stack_assign(inputs[0]),
|
||||
compiler.stack_assign(outputs[0]));
|
||||
}
|
||||
|
||||
void RGBToBWNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
compiler.add(this, "node_convert_from_color");
|
||||
}
|
||||
|
||||
/* Convert */
|
||||
|
||||
ConvertNode::ConvertNode(SocketType::Type from_, SocketType::Type to_, bool autoconvert)
|
||||
@@ -1552,40 +1586,40 @@ ConvertNode::ConvertNode(SocketType::Type from_, SocketType::Type to_, bool auto
|
||||
}
|
||||
|
||||
if(from == SocketType::FLOAT)
|
||||
add_input("Val", SocketType::FLOAT);
|
||||
add_input("value_float", SocketType::FLOAT);
|
||||
else if(from == SocketType::INT)
|
||||
add_input("ValInt", SocketType::INT);
|
||||
add_input("value_int", SocketType::INT);
|
||||
else if(from == SocketType::COLOR)
|
||||
add_input("Color", SocketType::COLOR);
|
||||
add_input("value_color", SocketType::COLOR);
|
||||
else if(from == SocketType::VECTOR)
|
||||
add_input("Vector", SocketType::VECTOR);
|
||||
add_input("value_vector", SocketType::VECTOR);
|
||||
else if(from == SocketType::POINT)
|
||||
add_input("Point", SocketType::POINT);
|
||||
add_input("value_point", SocketType::POINT);
|
||||
else if(from == SocketType::NORMAL)
|
||||
add_input("Normal", SocketType::NORMAL);
|
||||
add_input("value_normal", SocketType::NORMAL);
|
||||
else if(from == SocketType::STRING)
|
||||
add_input("String", SocketType::STRING);
|
||||
add_input("value_string", SocketType::STRING);
|
||||
else if(from == SocketType::CLOSURE)
|
||||
add_input("Closure", SocketType::CLOSURE);
|
||||
add_input("value_closure", SocketType::CLOSURE);
|
||||
else
|
||||
assert(0);
|
||||
|
||||
if(to == SocketType::FLOAT)
|
||||
add_output("Val", SocketType::FLOAT);
|
||||
add_output("value_float", SocketType::FLOAT);
|
||||
else if(to == SocketType::INT)
|
||||
add_output("ValInt", SocketType::INT);
|
||||
add_output("value_int", SocketType::INT);
|
||||
else if(to == SocketType::COLOR)
|
||||
add_output("Color", SocketType::COLOR);
|
||||
add_output("value_color", SocketType::COLOR);
|
||||
else if(to == SocketType::VECTOR)
|
||||
add_output("Vector", SocketType::VECTOR);
|
||||
add_output("value_vector", SocketType::VECTOR);
|
||||
else if(to == SocketType::POINT)
|
||||
add_output("Point", SocketType::POINT);
|
||||
add_output("value_point", SocketType::POINT);
|
||||
else if(to == SocketType::NORMAL)
|
||||
add_output("Normal", SocketType::NORMAL);
|
||||
add_output("value_normal", SocketType::NORMAL);
|
||||
else if(to == SocketType::STRING)
|
||||
add_output("String", SocketType::STRING);
|
||||
add_output("value_string", SocketType::STRING);
|
||||
else if(to == SocketType::CLOSURE)
|
||||
add_output("Closure", SocketType::CLOSURE);
|
||||
add_output("value_closure", SocketType::CLOSURE);
|
||||
else
|
||||
assert(0);
|
||||
}
|
||||
@@ -2176,7 +2210,7 @@ void SubsurfaceScatteringNode::compile(SVMCompiler& compiler)
|
||||
|
||||
void SubsurfaceScatteringNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
compiler.parameter("Falloff", falloff_enum[closure]);
|
||||
compiler.parameter("falloff", falloff_enum[closure]);
|
||||
compiler.add(this, "node_subsurface_scattering");
|
||||
}
|
||||
|
||||
@@ -3366,7 +3400,7 @@ void MixNode::compile(SVMCompiler& compiler)
|
||||
void MixNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
compiler.parameter("type", type);
|
||||
compiler.parameter("Clamp", use_clamp);
|
||||
compiler.parameter("use_clamp", use_clamp);
|
||||
compiler.add(this, "node_mix");
|
||||
}
|
||||
|
||||
@@ -4128,7 +4162,7 @@ void MathNode::compile(SVMCompiler& compiler)
|
||||
void MathNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
compiler.parameter("type", type);
|
||||
compiler.parameter("Clamp", use_clamp);
|
||||
compiler.parameter("use_clamp", use_clamp);
|
||||
compiler.add(this, "node_math");
|
||||
}
|
||||
|
||||
@@ -4477,7 +4511,7 @@ void RGBRampNode::compile(OSLCompiler& compiler)
|
||||
|
||||
compiler.parameter_color_array("ramp_color", ramp);
|
||||
compiler.parameter_array("ramp_alpha", ramp_alpha.data(), ramp_alpha.size());
|
||||
compiler.parameter("ramp_interpolate", interpolate);
|
||||
compiler.parameter("interpolate", interpolate);
|
||||
|
||||
compiler.add(this, "node_rgb_ramp");
|
||||
}
|
||||
|
@@ -362,6 +362,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class RGBToBWNode : public ShaderNode {
|
||||
public:
|
||||
SHADER_NODE_CLASS(RGBToBWNode)
|
||||
|
||||
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, float3 *optimized_value);
|
||||
};
|
||||
|
||||
class ConvertNode : public ShaderNode {
|
||||
public:
|
||||
ConvertNode(SocketType::Type from, SocketType::Type to, bool autoconvert = false);
|
||||
|
Reference in New Issue
Block a user