forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify OSL node implementations (#1185)
This changelist simplifies the OSL implementations of common nodes such as 'if', 'add', and 'subtract', removing duplicate code and harmonizing inline implementations where possible.
- Loading branch information
1 parent
e610f4e
commit f66296b
Showing
12 changed files
with
74 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
mx_add({{in1}}, {{in2}}) | ||
{{in1}} + {{in2}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = mx_fbm(position, octaves, lacunarity, diminish, "snoise"); | ||
result = f * mx_combine(amplitude.x, amplitude.y, amplitude.z, amplitude.w); | ||
result = f * color4(color(amplitude.x, amplitude.y, amplitude.z), amplitude.w); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mx_ternary({{value1}} == {{value2}}, {{in1}}, {{in2}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mx_ternary({{value1}} > {{value2}}, {{in1}}, {{in2}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mx_ternary({{value1}} >= {{value2}}, {{in1}}, {{in2}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = mx_noise("snoise", position); | ||
result = value * mx_combine(amplitude.x, amplitude.y, amplitude.z, amplitude.w) + pivot; | ||
result = value * color4(color(amplitude.x, amplitude.y, amplitude.z), amplitude.w) + pivot; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
mx_sub({{in1}}, {{in2}}) | ||
{{in1}} - {{in2}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.