Browse Source

TSL: Fix `mod()` negative values (#30796)

sunag 9 months ago
parent
commit
1ff22688cb
1 changed files with 3 additions and 5 deletions
  1. 3 5
      src/nodes/math/OperatorNode.js

+ 3 - 5
src/nodes/math/OperatorNode.js

@@ -359,15 +359,13 @@ class OperatorNode extends TempNode {
 
 			} else if ( op === '%' ) {
 
-				if ( isGLSL && builder.isInteger( typeB ) === false ) {
+				if ( builder.isInteger( typeB ) ) {
 
-					return builder.format( `${ builder.getMethod( 'mod', output ) }( ${ a }, ${ b } )`, type, output );
+					return builder.format( `( ${ a } % ${ b } )`, type, output );
 
 				} else {
 
-					// WGSL
-
-					return builder.format( `( ${ a } % ${ b } )`, type, output );
+					return builder.format( `${ builder.getMethod( 'mod', output ) }( ${ a }, ${ b } )`, type, output );
 
 				}
 

粤ICP备19079148号