From a5119c743c395e9390280906b7feedfa9c4cb525 Mon Sep 17 00:00:00 2001 From: Frieder Erdmann Date: Thu, 5 Oct 2023 17:29:43 +0200 Subject: [PATCH] renamed node to creatematrix added signature for vector4 --- .../stdlib/genglsl/mx_combine_v3_m3.glsl | 6 ----- libraries/stdlib/genglsl/mx_creatematrix.glsl | 14 ++++++++++++ .../stdlib/genglsl/stdlib_genglsl_impl.mtlx | 8 ++++--- .../stdlib/genmdl/stdlib_genmdl_impl.mtlx | 5 +++-- .../stdlib/genmsl/stdlib_genmsl_impl.mtlx | 5 +++-- libraries/stdlib/genosl/mx_combine_v3_m3.osl | 9 -------- libraries/stdlib/genosl/mx_creatematrix.osl | 17 ++++++++++++++ .../stdlib/genosl/stdlib_genosl_impl.mtlx | 5 +++-- libraries/stdlib/stdlib_defs.mtlx | 12 ++++++++-- .../TestSuite/stdlib/channel/matrix.mtlx | 6 ++--- .../MaterialXGenMdl/mdl/materialx/stdlib.mdl | 22 +++++++++++++++---- 11 files changed, 76 insertions(+), 33 deletions(-) delete mode 100644 libraries/stdlib/genglsl/mx_combine_v3_m3.glsl create mode 100644 libraries/stdlib/genglsl/mx_creatematrix.glsl delete mode 100644 libraries/stdlib/genosl/mx_combine_v3_m3.osl create mode 100644 libraries/stdlib/genosl/mx_creatematrix.osl diff --git a/libraries/stdlib/genglsl/mx_combine_v3_m3.glsl b/libraries/stdlib/genglsl/mx_combine_v3_m3.glsl deleted file mode 100644 index ecc4900886..0000000000 --- a/libraries/stdlib/genglsl/mx_combine_v3_m3.glsl +++ /dev/null @@ -1,6 +0,0 @@ -void mx_combine_v3_m3(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); -} \ No newline at end of file diff --git a/libraries/stdlib/genglsl/mx_creatematrix.glsl b/libraries/stdlib/genglsl/mx_creatematrix.glsl new file mode 100644 index 0000000000..7dc7317201 --- /dev/null +++ b/libraries/stdlib/genglsl/mx_creatematrix.glsl @@ -0,0 +1,14 @@ +void mx_creatematrix_vector3(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); +} + +void mx_creatematrix_vector4(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); +} \ No newline at end of file diff --git a/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx b/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx index 00e0677eaa..555dbd4c81 100644 --- a/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx +++ b/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx @@ -753,9 +753,11 @@ - - - + + + + + diff --git a/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx b/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx index 991e35f953..11424f0cbf 100644 --- a/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx +++ b/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx @@ -759,8 +759,9 @@ - - + + + diff --git a/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx b/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx index 6623f90df1..c7aea7f638 100644 --- a/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx +++ b/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx @@ -753,8 +753,9 @@ - - + + + diff --git a/libraries/stdlib/genosl/mx_combine_v3_m3.osl b/libraries/stdlib/genosl/mx_combine_v3_m3.osl deleted file mode 100644 index 566528ffed..0000000000 --- a/libraries/stdlib/genosl/mx_combine_v3_m3.osl +++ /dev/null @@ -1,9 +0,0 @@ -#include "lib/matrix33.h" - -void mx_combine_v3_m3(vector in1, vector in2, vector in3, out matrix33 result) -{ - result = matrix33.matrix44To33(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, 0.0)); -} \ No newline at end of file diff --git a/libraries/stdlib/genosl/mx_creatematrix.osl b/libraries/stdlib/genosl/mx_creatematrix.osl new file mode 100644 index 0000000000..b15b18673c --- /dev/null +++ b/libraries/stdlib/genosl/mx_creatematrix.osl @@ -0,0 +1,17 @@ +#include "lib/matrix33.h" + +void mx_creatematrix_vector3(vector in1, vector in2, vector in3, out matrix33 result) +{ + result = matrix33.matrix44To33(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, 0.0)); +} + +void mx_creatematrix_vector4(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); +} \ No newline at end of file diff --git a/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx b/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx index 439e5febee..760897a249 100644 --- a/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx +++ b/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx @@ -756,8 +756,9 @@ - - + + + diff --git a/libraries/stdlib/stdlib_defs.mtlx b/libraries/stdlib/stdlib_defs.mtlx index 6013db0006..5ecb7f1a8a 100644 --- a/libraries/stdlib/stdlib_defs.mtlx +++ b/libraries/stdlib/stdlib_defs.mtlx @@ -4360,16 +4360,24 @@ - + + + + + + + + +