@@ -77,10 +77,11 @@ Bit 2: color += lightFactor
7777Bit 3: alpha * 1
7878Bit 4: alpha * ( -1 )
7979Bit 5: alpha = 1
80- Bits 6-25: available for future usage
81- Bits 26-30: lightFactor:
82- Bit 31: intentionally left blank, some rewrite is required (see below)
83- if that bit has to be used once all the other bits are exhausted. */
80+ Bits 6-11: available for future usage
81+ Bits 12-15: lightFactor:
82+ Bit 16: intentionally left blank, some rewrite is required (see below)
83+ if that bit has to be used once all the other bits are exhausted.
84+ Bits 17-32: unusable as GLSL 1.20 int is 16-bit. */
8485
8586float colorModArray[3 ] = float [3 ] ( 0 .0f, 1 .0f, - 1 .0f );
8687
@@ -124,16 +125,16 @@ vec4 ColorModulateToColor( const in int colorMod, const in float lightFactor ) {
124125
125126float ColorModulateToLightFactor( const in int colorMod ) {
126127#if defined(HAVE_EXT_gpu_shader4)
127- /* The day the 31st bit is used, this should be done instead:
128- return float( ( colorMod >> 26 ) & 0xF ); */
129- return float ( colorMod >> 26 );
128+ /* The day the 16th bit is used, this should be done instead:
129+ return float( ( colorMod >> 12 ) & 0xF ); */
130+ return float ( colorMod >> 12 );
130131#else
131- /* The day the 31st bit used, this should be rewritten to
132+ /* The day the 16th bit used, this should be rewritten to
132133 extract the value without the sign, like that:
133134 int v = colorMod;
134- if ( v < 0 ) v = 2147483647 - abs( v ) + 1;
135- return float( v / 67108864 ); */
136- return float ( colorMod / 67108864 );
135+ if ( v < 0 ) v = 32767 - abs( v ) + 1;
136+ return float( v / 4096 ); */
137+ return float ( colorMod / 4096 );
137138#endif
138139}
139140
0 commit comments