@@ -77,10 +77,11 @@ Bit 2: color += lightFactor
77
77
Bit 3: alpha * 1
78
78
Bit 4: alpha * ( -1 )
79
79
Bit 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. */
84
85
85
86
float colorModArray[3 ] = float [3 ] ( 0 .0f, 1 .0f, - 1 .0f );
86
87
@@ -124,16 +125,16 @@ vec4 ColorModulateToColor( const in int colorMod, const in float lightFactor ) {
124
125
125
126
float ColorModulateToLightFactor( const in int colorMod ) {
126
127
#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 );
130
131
#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
132
133
extract the value without the sign, like that:
133
134
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 );
137
138
#endif
138
139
}
139
140
0 commit comments