qfalse, /* wolf lighting model? */
0, /* lightmap width/height */
0, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
0, /* lightmap exposure */
0, /* lightmap compensate */
0, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
200.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
0.3f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.2f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
200.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
0.3f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
- 2.2f, /* lightmap gamma */
+ 1.0f, /* lightmap gamma */
+ qtrue, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
200.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
0.4f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
512, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
512, /* lightmap width/height */
2.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qtrue, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qtrue, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
qfalse, /* wolf lighting model? */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
lightmapGamma = game->lightmapGamma;
Sys_Printf( " lightning gamma: %f\n", lightmapGamma );
+ lightmapsRGB = game->lightmapsRGB;
+ if(lightmapsRGB)
+ Sys_Printf( " lightmap colorspace: sRGB\n" );
+ else
+ Sys_Printf( " lightmap colorspace: linear\n" );
+
lightmapCompensate = game->lightmapCompensate;
Sys_Printf( " lightning compensation: %f\n", lightmapCompensate );
i++;
}
+ else if( !strcmp( argv[ i ], "-sRGB" ) )
+ {
+ lightmapsRGB = qtrue;
+ Sys_Printf( "Lighting is in sRGB\n" );
+ i++;
+ }
+
else if( !strcmp( argv[ i ], "-exposure" ) )
{
f = atof( argv[ i + 1 ] );
ydnar: moved to here 2001-02-04
*/
+#define Image_sRGBFloatFromLinear(c) (((c) < 0.8014848f) ? (c) * 0.05046875f : 1.055f * (float)pow((c)*(1.0f/256.0f), 1.0f/2.4f) - 0.055f)
void ColorToBytes( const float *color, byte *colorBytes, float scale )
{
int i;
/* compensate for ingame overbrighting/bitshifting */
VectorScale( sample, (1.0f / lightmapCompensate), sample );
+
+ /* sRGB lightmaps */
+ if(lightmapsRGB)
+ {
+ sample[0] = floor(Image_sRGBFloatFromLinear(sample[0]) * 255.0 + 0.5);
+ sample[1] = floor(Image_sRGBFloatFromLinear(sample[1]) * 255.0 + 0.5);
+ sample[2] = floor(Image_sRGBFloatFromLinear(sample[2]) * 255.0 + 0.5);
+ }
/* store it off */
colorBytes[ 0 ] = sample[ 0 ];
qboolean wolfLight; /* when true, lights work like wolf q3map */
int lightmapSize; /* bsp lightmap width/height */
float lightmapGamma; /* default lightmap gamma */
+ qboolean lightmapsRGB; /* default lightmap sRGB mode */
float lightmapExposure; /* default lightmap exposure */
float lightmapCompensate; /* default lightmap compensate value */
float gridScale; /* vortex: default lightgrid scale (affects both directional and ambient spectres) */
/* ydnar: lightmap gamma/compensation */
Q_EXTERN float lightmapGamma Q_ASSIGN( 1.0f );
+Q_EXTERN float lightmapsRGB Q_ASSIGN( qfalse );
Q_EXTERN float lightmapExposure Q_ASSIGN( 1.0f );
Q_EXTERN float lightmapCompensate Q_ASSIGN( 1.0f );