forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add creatematrix nodes to build matrices from vectors (AcademySoftwar…
…eFoundation#1553) I'm opening this PR to add creatematrix, a constructor for Matrix33 from 3 Vector3s, Matrix44 from 4 Vector3s and Matrix44 from 4 Vector4s from the specification document (https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/documents/Specification/MaterialX.Specification.md#math-nodes).
- Loading branch information
1 parent
8ab122f
commit 5def239
Showing
11 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix33.glsl
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,6 @@ | ||
void mx_creatematrix_vector3_matrix33(vec3 in1, vec3 in2, vec3 in3, out mat3 result) | ||
{ | ||
result = mat3(in1.x, in1.y, in1.z, | ||
in2.x, in2.y, in2.z, | ||
in3.x, in3.y, in3.z); | ||
} |
7 changes: 7 additions & 0 deletions
7
libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix44.glsl
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,7 @@ | ||
void mx_creatematrix_vector3_matrix44(vec3 in1, vec3 in2, vec3 in3, vec3 in4, out mat4 result) | ||
{ | ||
result = mat4(in1.x, in1.y, in1.z, 0.0, | ||
in2.x, in2.y, in2.z, 0.0, | ||
in3.x, in3.y, in3.z, 0.0, | ||
in4.x, in4.y, in4.z, 1.0); | ||
} |
7 changes: 7 additions & 0 deletions
7
libraries/stdlib/genglsl/mx_creatematrix_vector4_matrix44.glsl
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,7 @@ | ||
void mx_creatematrix_vector4_matrix44(vec4 in1, vec4 in2, vec4 in3, vec4 in4, out mat4 result) | ||
{ | ||
result = mat4(in1.x, in1.y, in1.z, in1.w, | ||
in2.x, in2.y, in2.z, in2.w, | ||
in3.x, in3.y, in3.z, in3.w, | ||
in4.x, in4.y, in4.z, in4.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
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
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,23 @@ | ||
void mx_creatematrix_vector3_matrix33(vector in1, vector in2, vector in3, out matrix result) | ||
{ | ||
result = matrix(in1.x, in1.y, in1.z, 0.0, | ||
in2.x, in2.y, in2.z, 0.0, | ||
in3.x, in3.y, in3.z, 0.0, | ||
0.0, 0.0, 0.0, 1.0); | ||
} | ||
|
||
void mx_creatematrix_vector3_matrix44(vector3 in1, vector3 in2, vector3 in3, vector3 in4, out matrix result) | ||
{ | ||
result = matrix(in1.x, in1.y, in1.z, 0.0, | ||
in2.x, in2.y, in2.z, 0.0, | ||
in3.x, in3.y, in3.z, 0.0, | ||
in4.x, in4.y, in4.z, 1.0); | ||
} | ||
|
||
void mx_creatematrix_vector4_matrix44(vector4 in1, vector4 in2, vector4 in3, vector4 in4, out matrix result) | ||
{ | ||
result = matrix(in1.x, in1.y, in1.z, in1.w, | ||
in2.x, in2.y, in2.z, in2.w, | ||
in3.x, in3.y, in3.z, in3.w, | ||
in4.x, in4.y, in4.z, in4.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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0"?> | ||
<materialx version="1.38"> | ||
<nodegraph name="creatematrix_vector3_matrix33"> | ||
<creatematrix name="creatematrix_vector3_matrix33" type="matrix33"> | ||
<input name="in1" type="vector3" value="1, 0, 0" /> | ||
<input name="in2" type="vector3" value="0, 1, 0" /> | ||
<input name="in3" type="vector3" value="0, 0, 1" /> | ||
</creatematrix> | ||
<output name="out" type="matrix33" nodename="creatematrix_vector3_matrix33" /> | ||
</nodegraph> | ||
<nodegraph name="creatematrix_vector3_matrix44"> | ||
<creatematrix name="creatematrix_vector3_matrix44" type="matrix44"> | ||
<input name="in1" type="vector3" value="1, 0, 0" /> | ||
<input name="in2" type="vector3" value="0, 1, 0" /> | ||
<input name="in3" type="vector3" value="0, 0, 1" /> | ||
<input name="in4" type="vector3" value="0, 0, 0" /> | ||
</creatematrix> | ||
<output name="out" type="matrix44" nodename="creatematrix_vector3_matrix44" /> | ||
</nodegraph> | ||
<nodegraph name="creatematrix_vector4_matrix44"> | ||
<creatematrix name="creatematrix_vector4_matrix44" type="matrix44"> | ||
<input name="in1" type="vector4" value="1, 0, 0, 0" /> | ||
<input name="in2" type="vector4" value="0, 1, 0, 0" /> | ||
<input name="in3" type="vector4" value="0, 0, 1, 0" /> | ||
<input name="in4" type="vector4" value="0, 0, 0, 1" /> | ||
</creatematrix> | ||
<output name="out" type="matrix44" nodename="creatematrix_vector4_matrix44" /> | ||
</nodegraph> | ||
</materialx> |
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