Skip to content

Commit

Permalink
Simplify OSL support library
Browse files Browse the repository at this point in the history
- Add 'mx' prefixes to OSL helper functions.
- Remove outdated OSL helper functions.
- Minor improvements to code style.
  • Loading branch information
jstone-lucasfilm committed Jan 1, 2023
1 parent cf0ff3c commit e610f4e
Show file tree
Hide file tree
Showing 25 changed files with 120 additions and 558 deletions.
626 changes: 94 additions & 532 deletions libraries/stdlib/genosl/include/mx_funcs.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_fractal3d_color3.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_color3(vector amplitude, int octaves, float lacunarity, float diminish, vector position, output color result)
{
color f = fBm(position, octaves, lacunarity, diminish, "snoise");
color f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * amplitude;
}
4 changes: 2 additions & 2 deletions libraries/stdlib/genosl/mx_fractal3d_color4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_color4(vector4 amplitude, int octaves, float lacunarity, float diminish, vector position, output color4 result)
{
color4 f = fBm(position, octaves, lacunarity, diminish, "snoise");
result = f * combine(amplitude.x, amplitude.y, amplitude.z, amplitude.w);
color4 f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * mx_combine(amplitude.x, amplitude.y, amplitude.z, amplitude.w);
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_fractal3d_fa_color3.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_fa_color3(float amplitude, int octaves, float lacunarity, float diminish, vector position, output color result)
{
color f = fBm(position, octaves, lacunarity, diminish, "snoise");
color f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * amplitude;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_fractal3d_fa_color4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_fa_color4(float amplitude, int octaves, float lacunarity, float diminish, vector position, output color4 result)
{
color4 f = fBm(position, octaves, lacunarity, diminish, "snoise");
color4 f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * amplitude;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_fractal3d_fa_vector2.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_fa_vector2(float amplitude, int octaves, float lacunarity, float diminish, vector position, output vector2 result)
{
vector2 f = fBm(position, octaves, lacunarity, diminish, "snoise");
vector2 f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * amplitude;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_fractal3d_fa_vector3.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_fa_vector3(float amplitude, int octaves, float lacunarity, float diminish, vector position, output vector result)
{
vector f = fBm(position, octaves, lacunarity, diminish, "snoise");
vector f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * amplitude;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_fractal3d_fa_vector4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_fa_vector4(float amplitude, int octaves, float lacunarity, float diminish, vector position, output vector4 result)
{
vector4 f = fBm(position, octaves, lacunarity, diminish, "snoise");
vector4 f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * amplitude;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_fractal3d_float.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_float(float amplitude, int octaves, float lacunarity, float diminish, vector position, output float result)
{
float f = fBm(position, octaves, lacunarity, diminish, "snoise");
float f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * amplitude;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_fractal3d_vector2.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_vector2(vector2 amplitude, int octaves, float lacunarity, float diminish, vector position, output vector2 result)
{
vector2 f = fBm(position, octaves, lacunarity, diminish, "snoise");
vector2 f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * amplitude;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_fractal3d_vector3.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_vector3(vector amplitude, int octaves, float lacunarity, float diminish, vector position, output vector result)
{
vector f = fBm(position, octaves, lacunarity, diminish, "snoise");
vector f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * amplitude;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_fractal3d_vector4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_fractal3d_vector4(vector4 amplitude, int octaves, float lacunarity, float diminish, vector position, output vector4 result)
{
vector4 f = fBm(position, octaves, lacunarity, diminish, "snoise");
vector4 f = mx_fbm(position, octaves, lacunarity, diminish, "snoise");
result = f * amplitude;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise2d_color4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise2d_color4(vector4 amplitude, float pivot, vector2 texcoord, output color4 result)
{
color4 value = noise("snoise", texcoord.x, texcoord.y);
color4 value = mx_noise("snoise", texcoord.x, texcoord.y);
result = value * color4(color(amplitude.x, amplitude.y, amplitude.z), amplitude.w) + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise2d_fa_color4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise2d_fa_color4(float amplitude, float pivot, vector2 texcoord, output color4 result)
{
color4 value = noise("snoise", texcoord.x, texcoord.y);
color4 value = mx_noise("snoise", texcoord.x, texcoord.y);
result = value * amplitude + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise2d_fa_vector2.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise2d_fa_vector2(float amplitude, float pivot, vector2 texcoord, output vector2 result)
{
vector2 value = noise("snoise", texcoord.x, texcoord.y);
vector2 value = mx_noise("snoise", texcoord.x, texcoord.y);
result = value * amplitude + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise2d_fa_vector4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise2d_fa_vector4(float amplitude, float pivot, vector2 texcoord, output vector4 result)
{
vector4 value = noise("snoise", texcoord.x, texcoord.y);
vector4 value = mx_noise("snoise", texcoord.x, texcoord.y);
result = value * amplitude + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise2d_vector2.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise2d_vector2(vector2 amplitude, float pivot, vector2 texcoord, output vector2 result)
{
vector2 value = noise("snoise", texcoord.x, texcoord.y);
vector2 value = mx_noise("snoise", texcoord.x, texcoord.y);
result = value * amplitude + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise2d_vector4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise2d_vector4(vector4 amplitude, float pivot, vector2 texcoord, output vector4 result)
{
vector4 value = noise("snoise", texcoord.x, texcoord.y);
vector4 value = mx_noise("snoise", texcoord.x, texcoord.y);
result = value * amplitude + pivot;
}
4 changes: 2 additions & 2 deletions libraries/stdlib/genosl/mx_noise3d_color4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise3d_color4(vector4 amplitude, float pivot, vector position, output color4 result)
{
color4 value = noise("snoise", position);
result = value * combine(amplitude.x, amplitude.y, amplitude.z, amplitude.w) + pivot;
color4 value = mx_noise("snoise", position);
result = value * mx_combine(amplitude.x, amplitude.y, amplitude.z, amplitude.w) + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise3d_fa_color4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise3d_fa_color4(float amplitude, float pivot, vector position, output color4 result)
{
color4 value = noise("snoise", position);
color4 value = mx_noise("snoise", position);
result = value * amplitude + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise3d_fa_vector2.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise3d_fa_vector2(float amplitude, float pivot, vector position, output vector2 result)
{
vector2 value = noise("snoise", position);
vector2 value = mx_noise("snoise", position);
result = value * amplitude + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise3d_fa_vector4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise3d_fa_vector4(float amplitude, float pivot, vector position, output vector4 result)
{
vector4 value = noise("snoise", position);
vector4 value = mx_noise("snoise", position);
result = value * amplitude + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise3d_vector2.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise3d_vector2(vector2 amplitude, float pivot, vector position, output vector2 result)
{
vector2 value = noise("snoise", position);
vector2 value = mx_noise("snoise", position);
result = value * amplitude + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_noise3d_vector4.osl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
void mx_noise3d_vector4(vector4 amplitude, float pivot, vector position, output vector4 result)
{
vector4 value = noise("snoise", position);
vector4 value = mx_noise("snoise", position);
result = value * amplitude + pivot;
}
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_remap.inline
Original file line number Diff line number Diff line change
@@ -1 +1 @@
remap({{in}}, {{inlow}}, {{inhigh}}, {{outlow}}, {{outhigh}}, 0)
mx_remap({{in}}, {{inlow}}, {{inhigh}}, {{outlow}}, {{outhigh}}, 0)

0 comments on commit e610f4e

Please sign in to comment.