Parcourir la source

MaterialX: added invert implementation (#29433)

* feat: added invert implementation

- allow invert to be a number, vec 2|3|4, or color, subtracting the value from an optionally inputted amount field (which is defaulted to all parts 1 of the input type)

* feat: update invert

- simplified invert function
- removed unneeded imports
- moved invert to math nodes
Andy il y a 1 an
Parent
commit
16dacdee45
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      examples/jsm/loaders/MaterialXLoader.js

+ 2 - 0
examples/jsm/loaders/MaterialXLoader.js

@@ -44,6 +44,7 @@ const mx_power = ( in1, in2 = float( 1 ) ) => pow( in1, in2 );
 const mx_atan2 = ( in1 = float( 0 ), in2 = float( 1 ) ) => atan2( in1, in2 );
 const mx_timer = () => timerLocal();
 const mx_frame = () => frameId;
+const mx_invert = ( in1, amount = float( 1 ) ) => sub( amount, in1 );
 
 const separate = ( in1, channel ) => split( in1, channel.at( - 1 ) );
 
@@ -77,6 +78,7 @@ const MXElements = [
 	new MXElement( 'magnitude', length, [ 'in1', 'in2' ] ),
 	new MXElement( 'dotproduct', dot, [ 'in1', 'in2' ] ),
 	new MXElement( 'crossproduct', cross, [ 'in' ] ),
+	new MXElement( 'invert', mx_invert, [ 'in', 'amount' ] ),
 	//new MtlXElement( 'transformpoint', ... ),
 	//new MtlXElement( 'transformvector', ... ),
 	//new MtlXElement( 'transformnormal', ... ),

粤ICP备19079148号