Skip to content

Commit

Permalink
Refine wording & add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
vernalchen committed Jul 13, 2022
1 parent 6d672c6 commit 944de5d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
8 changes: 4 additions & 4 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -2332,8 +2332,8 @@

<!--
Node: <place2d> Supplemental Node
Transform incoming UV texture coordinates for 2D texture placement.
Sequence of transformation (in the order of application): -pivot, scale, rotate, translate, pivot.
Transform incoming UV texture coordinates from one 2D frame of reference to another.
The order of transformation is: -pivot, scale, rotate, translate, pivot.
-->
<nodedef name="ND_place2d_vector2" node="place2d" nodegroup="math">
<input name="texcoord" type="vector2" value="0.0, 0.0" />
Expand All @@ -2346,8 +2346,8 @@

<!--
Node: <place2dframe> Supplemental Node
Transform incoming UV texture coordinates for 2D texture placement.
Sequence of transformation (in the order of application): -pivot, translate, rotate, scale, pivot.
Transform incoming UV texture coordinates from one 2D frame of reference to another.
The order of transformation is: -pivot, translate, rotate, scale, pivot.
-->
<nodedef name="ND_place2dframe_vector2" node="place2dframe" nodegroup="math">
<input name="texcoord" type="vector2" value="0.0, 0.0" />
Expand Down
14 changes: 8 additions & 6 deletions libraries/stdlib/stdlib_ng.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1045,10 +1045,11 @@

<!--
Node: <place2d>
Transform incoming UV texture coordinates for 2D texture placement.
Sequence of transformation (in the order of application): -pivot, scale, rotate, translate, pivot.
Transform incoming UV texture coordinates from one 2D frame of reference to another.
The order of transformation is: -pivot, scale, rotate, translate, pivot.
-->
<nodegraph name="NG_place2d_vector2" nodedef="ND_place2d_vector2">
<implementation name="IMPL_place2d_vector2" nodedef="ND_place2d_vector2" nodegraph="NG_place2d_vector2" />
<nodegraph name="NG_place2d_vector2">
<subtract name="N_subpivot" type="vector2">
<input name="in1" type="vector2" interfacename="texcoord" />
<input name="in2" type="vector2" interfacename="pivot" />
Expand All @@ -1074,10 +1075,11 @@

<!--
Node: <place2dframe>
Transform incoming UV texture coordinates for 2D texture placement.
Sequence of transformation (in the order of application): -pivot, translate, rotate, scale, pivot.
Transform incoming UV texture coordinates from one 2D frame of reference to another.
The order of transformation is: -pivot, translate, rotate, scale, pivot.
-->
<nodegraph name="NG_place2dframe_vector2" nodedef="ND_place2dframe_vector2">
<implementation name="IMPL_place2dframe_vector2" nodedef="ND_place2dframe_vector2" nodegraph="NG_place2dframe_vector2" />
<nodegraph name="NG_place2dframe_vector2">
<subtract name="N_subpivot" type="vector2">
<input name="in1" type="vector2" interfacename="texcoord" />
<input name="in2" type="vector2" interfacename="pivot" />
Expand Down
35 changes: 35 additions & 0 deletions resources/Materials/TestSuite/stdlib/texture/image_transform.mtlx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<materialx version="1.38">
<nodegraph name="test_place2d">
<image name="image_number_1" type="color3">
<input name="file" type="filename" value="resources/Images/grid.png" />
<input name="default" type="color3" value="1.0, 0.0, 0.0" />
<input name="texcoord" type="vector2" nodename="a_place2d" />
</image>
<output name="out" type="color3" nodename="image_number_1" />
<texcoord name="texcoord1" type="vector2" />
<place2d name="a_place2d" type="vector2">
<input name="texcoord" type="vector2" nodename="texcoord1" />
<input name="offset" type="vector2" value="0.0, 0.0" />
<input name="rotate" type="float" value="30.0" unittype="angle" unit="degree" />
<input name="scale" type="vector2" value="2.0, 1.0" />
<input name="pivot" type="vector2" value="0.5, 0.5" />
</place2d>
</nodegraph>
<nodegraph name="test_place2dframe">
<image name="image_number_1" type="color3">
<input name="file" type="filename" value="resources/Images/grid.png" />
<input name="default" type="color3" value="1.0, 0.0, 0.0" />
<input name="texcoord" type="vector2" nodename="a_place2d" />
</image>
<output name="out" type="color3" nodename="image_number_1" />
<texcoord name="texcoord1" type="vector2" />
<place2dframe name="a_place2d" type="vector2">
<input name="texcoord" type="vector2" nodename="texcoord1" />
<input name="offset" type="vector2" value="0.2, 0.2" />
<input name="rotate" type="float" value="30.0" unittype="angle" unit="degree" />
<input name="scale" type="vector2" value="2.0, 1.0" />
<input name="pivot" type="vector2" value="0.5, 0.5" />
</place2dframe>
</nodegraph>
</materialx>

0 comments on commit 944de5d

Please sign in to comment.