Skip to content

Commit fd1f225

Browse files
committed
renderer: use mod() instead of %
1 parent 10060c8 commit fd1f225

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/engine/renderer/glsl_source/common.glsl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ vec4 ColorModulateToColor( const in int colorMod ) {
8989
int rgbIndex = colorMod & 3;
9090
int alphaIndex = ( colorMod & 24 ) >> 3;
9191
#else
92-
int rgbBit0 = colorMod % 2;
93-
int rgbBit1 = ( colorMod / 2 ) % 2;
94-
int alphaBit0 = ( colorMod / 8 ) % 2;
95-
int alphaBit1 = ( colorMod / 16 ) % 2;
92+
int rgbBit0 = int( mod( colorMod , 2 ) );
93+
int rgbBit1 = int( mod( int( colorMod / 2 ), 2 ) );
94+
int alphaBit0 = int( mod( int( colorMod / 8 ), 2 ) );
95+
int alphaBit1 = int( mod( int( colorMod / 16 ), 2 ) );
9696
int rgbIndex = rgbBit0 + ( rgbBit1 * 2 );
9797
int alphaIndex = alphaBit0 + ( alphaBit1 * 2 );
9898
#endif
@@ -108,11 +108,11 @@ vec4 ColorModulateToColor( const in int colorMod, const in float lightFactor ) {
108108
int alphaIndex = ( colorMod & 24 ) >> 3;
109109
int hasLight = ( colorMod & 4 ) >> 2;
110110
#else
111-
int rgbBit0 = colorMod % 2;
112-
int rgbBit1 = ( colorMod / 2 ) % 2;
113-
int hasLight = ( colorMod / 4 ) % 2;
114-
int alphaBit0 = ( colorMod / 8 ) % 2;
115-
int alphaBit1 = ( colorMod / 16 ) % 2;
111+
int rgbBit0 = int( mod( colorMod, 2 ) );
112+
int rgbBit1 = int( mod( int( colorMod / 2 ), 2 ) );
113+
int hasLight = int( mod( int( colorMod / 4 ), 2 ) );
114+
int alphaBit0 = int( mod( int( colorMod / 8 ), 2 ) );
115+
int alphaBit1 = int( mod( int( colorMod / 16 ), 2 ) );
116116
int rgbIndex = rgbBit0 + ( rgbBit1 * 2 );
117117
int alphaIndex = alphaBit0 + ( alphaBit1 * 2 );
118118
#endif
@@ -142,6 +142,6 @@ bool ColorModulateToVertexColor( const in int colorMod ) {
142142
#if defined(HAVE_EXT_gpu_shader4)
143143
return ( colorMod & 32 ) == 32;
144144
#else
145-
return ( colorMod / 32 ) % 2 == 1;
145+
return int( mod( int( colorMod / 32 ), 2 ) ) == 1;
146146
#endif
147147
}

0 commit comments

Comments
 (0)