Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ND_add_integer and ND_subtract_integer #1777

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions documents/Specification/MaterialX.Specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -1057,13 +1057,13 @@ Math nodes have one or two spatially-varying inputs, and are used to perform a m
<a id="node-add"> </a>

* **`add`**: add a value to the incoming float/color/vector/matrix.
* `in1` (float or color<em>N</em> or vector<em>N</em> or matrix<em>NN</em>): the value or nodename for the primary input
* `in1` (float or integer or color<em>N</em> or vector<em>N</em> or matrix<em>NN</em>): the value or nodename for the primary input
* `in2` (same type as `in1` or float): the value or nodename to add; for matrix types, the default is the zero matrix.

<a id="node-subtract"> </a>

* **`subtract`**: subtract a value from the incoming float/color/vector/matrix, outputting "in1-in2".
* `in1` (float or color<em>N</em> or vector<em>N</em> or matrix<em>NN</em>): the value or nodename for the primary input
* `in1` (float or integer or color<em>N</em> or vector<em>N</em> or matrix<em>NN</em>): the value or nodename for the primary input
* `in2` (same type as `in1` or float): the value or nodename to subtract; for matrix types, the default is the zero matrix

<a id="node-multiply"> </a>
Expand Down
2 changes: 2 additions & 0 deletions libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@

<!-- <add> -->
<implementation name="IM_add_float_genglsl" nodedef="ND_add_float" target="genglsl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_integer_genglsl" nodedef="ND_add_integer" target="genglsl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_color3_genglsl" nodedef="ND_add_color3" target="genglsl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_color3FA_genglsl" nodedef="ND_add_color3FA" target="genglsl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_color4_genglsl" nodedef="ND_add_color4" target="genglsl" sourcecode="{{in1}} + {{in2}}" />
Expand All @@ -204,6 +205,7 @@

<!-- <subtract> -->
<implementation name="IM_subtract_float_genglsl" nodedef="ND_subtract_float" target="genglsl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_integer_genglsl" nodedef="ND_subtract_integer" target="genglsl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_color3_genglsl" nodedef="ND_subtract_color3" target="genglsl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_color3FA_genglsl" nodedef="ND_subtract_color3FA" target="genglsl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_color4_genglsl" nodedef="ND_subtract_color4" target="genglsl" sourcecode="{{in1}} - {{in2}}" />
Expand Down
2 changes: 2 additions & 0 deletions libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@

<!-- <add> -->
<implementation name="IM_add_float_genmdl" nodedef="ND_add_float" sourcecode="{{in1}} + {{in2}}" target="genmdl" />
<implementation name="IM_add_integer_genmdl" nodedef="ND_add_integer" sourcecode="{{in1}} + {{in2}}" target="genmdl" />
<implementation name="IM_add_color3_genmdl" nodedef="ND_add_color3" sourcecode="{{in1}} + {{in2}}" target="genmdl" />
<implementation name="IM_add_color3FA_genmdl" nodedef="ND_add_color3FA" sourcecode="{{in1}} + {{in2}}" target="genmdl" />
<implementation name="IM_add_color4_genmdl" nodedef="ND_add_color4" sourcecode="mx_add({{in1}}, {{in2}})" target="genmdl" />
Expand All @@ -207,6 +208,7 @@

<!-- <subtract> -->
<implementation name="IM_subtract_float_genmdl" nodedef="ND_subtract_float" sourcecode="{{in1}} - {{in2}}" target="genmdl" />
<implementation name="IM_subtract_integer_genmdl" nodedef="ND_subtract_integer" sourcecode="{{in1}} - {{in2}}" target="genmdl" />
<implementation name="IM_subtract_color3_genmdl" nodedef="ND_subtract_color3" sourcecode="{{in1}} - {{in2}}" target="genmdl" />
<implementation name="IM_subtract_color3FA_genmdl" nodedef="ND_subtract_color3FA" sourcecode="{{in1}} - {{in2}}" target="genmdl" />
<implementation name="IM_subtract_color4_genmdl" nodedef="ND_subtract_color4" sourcecode="mx_subtract({{in1}}, {{in2}})" target="genmdl" />
Expand Down
2 changes: 2 additions & 0 deletions libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@

<!-- <add> -->
<implementation name="IM_add_float_genmsl" nodedef="ND_add_float" target="genmsl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_integer_genmsl" nodedef="ND_add_integer" target="genmsl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_color3_genmsl" nodedef="ND_add_color3" target="genmsl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_color3FA_genmsl" nodedef="ND_add_color3FA" target="genmsl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_color4_genmsl" nodedef="ND_add_color4" target="genmsl" sourcecode="{{in1}} + {{in2}}" />
Expand All @@ -205,6 +206,7 @@

<!-- <subtract> -->
<implementation name="IM_subtract_float_genmsl" nodedef="ND_subtract_float" target="genmsl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_integer_genmsl" nodedef="ND_subtract_integer" target="genmsl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_color3_genmsl" nodedef="ND_subtract_color3" target="genmsl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_color3FA_genmsl" nodedef="ND_subtract_color3FA" target="genmsl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_color4_genmsl" nodedef="ND_subtract_color4" target="genmsl" sourcecode="{{in1}} - {{in2}}" />
Expand Down
2 changes: 2 additions & 0 deletions libraries/stdlib/genosl/stdlib_genosl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@

<!-- <add> -->
<implementation name="IM_add_float_genosl" nodedef="ND_add_float" target="genosl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_integer_genosl" nodedef="ND_add_integer" target="genosl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_color3_genosl" nodedef="ND_add_color3" target="genosl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_color3FA_genosl" nodedef="ND_add_color3FA" target="genosl" sourcecode="{{in1}} + {{in2}}" />
<implementation name="IM_add_color4_genosl" nodedef="ND_add_color4" target="genosl" sourcecode="{{in1}} + {{in2}}" />
Expand All @@ -207,6 +208,7 @@

<!-- <subtract> -->
<implementation name="IM_subtract_float_genosl" nodedef="ND_subtract_float" target="genosl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_integer_genosl" nodedef="ND_subtract_integer" target="genosl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_color3_genosl" nodedef="ND_subtract_color3" target="genosl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_color3FA_genosl" nodedef="ND_subtract_color3FA" target="genosl" sourcecode="{{in1}} - {{in2}}" />
<implementation name="IM_subtract_color4_genosl" nodedef="ND_subtract_color4" target="genosl" sourcecode="{{in1}} - {{in2}}" />
Expand Down
14 changes: 12 additions & 2 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1396,13 +1396,18 @@

<!--
Node: <add>
Add "in2" value/stream to the incoming float/color/vector/matrix.
Add "in2" value/stream to the incoming float/integer/color/vector/matrix.
-->
<nodedef name="ND_add_float" node="add" nodegroup="math">
<input name="in1" type="float" value="0.0" />
<input name="in2" type="float" value="0.0" />
<output name="out" type="float" defaultinput="in1" />
</nodedef>
<nodedef name="ND_add_integer" node="add" nodegroup="math">
<input name="in1" type="integer" value="0" />
<input name="in2" type="integer" value="0" />
<output name="out" type="integer" defaultinput="in1" />
</nodedef>
<nodedef name="ND_add_color3" node="add" nodegroup="math">
<input name="in1" type="color3" value="0.0, 0.0, 0.0" />
<input name="in2" type="color3" value="0.0, 0.0, 0.0" />
Expand Down Expand Up @@ -1476,13 +1481,18 @@

<!--
Node: <subtract>
Subtract "in2" value/stream from the incoming float/color/vector/matrix.
Subtract "in2" value/stream from the incoming float/integer/color/vector/matrix.
-->
<nodedef name="ND_subtract_float" node="subtract" nodegroup="math">
<input name="in1" type="float" value="0.0" />
<input name="in2" type="float" value="0.0" />
<output name="out" type="float" defaultinput="in1" />
</nodedef>
<nodedef name="ND_subtract_integer" node="subtract" nodegroup="math">
<input name="in1" type="integer" value="0" />
<input name="in2" type="integer" value="0" />
<output name="out" type="integer" defaultinput="in1" />
</nodedef>
<nodedef name="ND_subtract_color3" node="subtract" nodegroup="math">
<input name="in1" type="color3" value="0.0, 0.0, 0.0" />
<input name="in2" type="color3" value="0.0, 0.0, 0.0" />
Expand Down
14 changes: 14 additions & 0 deletions resources/Materials/TestSuite/stdlib/math/math_operators.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
</add>
<output name="out" type="float" nodename="add1" />
</nodegraph>
<nodegraph name="add_integer">
<add name="add1" type="integer">
<input name="in1" type="integer" value="2" />
<input name="in2" type="integer" value="3" />
</add>
<output name="out" type="integer" nodename="add1" />
</nodegraph>
<nodegraph name="add_color3">
<add name="add1" type="color3">
<input name="in1" type="color3" value="0.2000, 0.3000, 0.0" />
Expand Down Expand Up @@ -84,6 +91,13 @@
</subtract>
<output name="out" type="float" nodename="subtract1" />
</nodegraph>
<nodegraph name="subtract_integer">
<subtract name="subtract1" type="integer">
<input name="in1" type="integer" value="3" />
<input name="in2" type="integer" value="2" />
</subtract>
<output name="out" type="integer" nodename="subtract1" />
</nodegraph>
<nodegraph name="subtract_color3">
<subtract name="subtract1" type="color3">
<input name="in1" type="color3" value="1.0000, 1.0000, 0.0" />
Expand Down