@@ -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