+++ /dev/null
-../../../branch-manager
\ No newline at end of file
maxSurfaceVerts = game->maxSurfaceVerts;
maxSurfaceIndexes = game->maxSurfaceIndexes;
emitFlares = game->emitFlares;
+ texturesRGB = game->texturesRGB;
/* process arguments */
for( i = 1; i < (argc - 1); i++ )
Sys_Printf( "Debug portal surfaces enabled\n" );
debugPortals = qtrue;
}
+ else if( !strcmp( argv[ i ], "-sRGBtex" ) )
+ {
+ texturesRGB = qtrue;
+ Sys_Printf( "Textures are in sRGB\n" );
+ }
+ else if( !strcmp( argv[ i ], "-nosRGBtex" ) )
+ {
+ texturesRGB = qfalse;
+ Sys_Printf( "Textures are linear\n" );
+ }
else if( !strcmp( argv[ i ], "-altsplit" ) )
{
Sys_Printf( "Alternate BSP splitting (by 27) enabled\n" );
0, /* lightmap width/height */
0, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
0, /* lightmap exposure */
0, /* lightmap compensate */
0, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
200.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
0.3f, /* lightgrid scale */
128, /* lightmap width/height */
1.2f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
200.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
0.3f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qtrue, /* lightmap sRGB */
+ qfalse, /* texture sRGB (yes, this is incorrect, but we better match ET:UT) */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
200.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
0.4f, /* lightgrid scale */
512, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
512, /* lightmap width/height */
2.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
1.0f, /* lightmap exposure */
1.0f, /* lightmap compensate */
1.0f, /* lightgrid scale */
else
Sys_Printf( " lightmap colorspace: linear\n" );
+ texturesRGB = game->texturesRGB;
+ if(texturesRGB)
+ Sys_Printf( " texture colorspace: sRGB\n" );
+ else
+ Sys_Printf( " texture colorspace: linear\n" );
+
lightmapCompensate = game->lightmapCompensate;
Sys_Printf( " lightning compensation: %f\n", lightmapCompensate );
i++;
}
- else if( !strcmp( argv[ i ], "-sRGB" ) )
+ else if( !strcmp( argv[ i ], "-sRGBlight" ) )
{
lightmapsRGB = qtrue;
Sys_Printf( "Lighting is in sRGB\n" );
}
- else if( !strcmp( argv[ i ], "-nosRGB" ) )
+ else if( !strcmp( argv[ i ], "-nosRGBlight" ) )
{
lightmapsRGB = qfalse;
Sys_Printf( "Lighting is linear\n" );
}
+ else if( !strcmp( argv[ i ], "-sRGBtex" ) )
+ {
+ texturesRGB = qtrue;
+ Sys_Printf( "Textures are in sRGB\n" );
+ }
+
+ else if( !strcmp( argv[ i ], "-nosRGBtex" ) )
+ {
+ texturesRGB = qfalse;
+ Sys_Printf( "Textures are linear\n" );
+ }
+
else if( !strcmp( argv[ i ], "-exposure" ) )
{
f = atof( argv[ i + 1 ] );
pixels += (y * width * 4) + (x * 4);
VectorCopy( pixels, color );
color[ 3 ] = pixels[ 3 ];
+
+ if(texturesRGB)
+ {
+ color[0] = Image_LinearFloatFromsRGBFloat(color[0] * (1.0 / 255.0)) * 255.0;
+ color[1] = Image_LinearFloatFromsRGBFloat(color[1] * (1.0 / 255.0)) * 255.0;
+ color[2] = Image_LinearFloatFromsRGBFloat(color[2] * (1.0 / 255.0)) * 255.0;
+ }
+
return qtrue;
}
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;
/* 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);
+ sample[0] = floor(Image_sRGBFloatFromLinearFloat(sample[0] * (1.0 / 255.0)) * 255.0 + 0.5);
+ sample[1] = floor(Image_sRGBFloatFromLinearFloat(sample[1] * (1.0 / 255.0)) * 255.0 + 0.5);
+ sample[2] = floor(Image_sRGBFloatFromLinearFloat(sample[2] * (1.0 / 255.0)) * 255.0 + 0.5);
}
/* store it off */
int lightmapSize; /* bsp lightmap width/height */
float lightmapGamma; /* default lightmap gamma */
qboolean lightmapsRGB; /* default lightmap sRGB mode */
+ qboolean texturesRGB; /* default texture 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 texturesRGB Q_ASSIGN( qfalse );
Q_EXTERN float lightmapExposure Q_ASSIGN( 1.0f );
Q_EXTERN float lightmapCompensate Q_ASSIGN( 1.0f );
#define AUTOEXPAND_BY_REALLOC_BSP(suffix, def) AUTOEXPAND_BY_REALLOC(bsp##suffix, numBSP##suffix, allocatedBSP##suffix, def)
+#define Image_LinearFloatFromsRGBFloat(c) (((c) <= 0.04045f) ? (c) * (1.0f / 12.92f) : (float)pow(((c) + 0.055f)*(1.0f/1.055f), 2.4f))
+#define Image_sRGBFloatFromLinearFloat(c) (((c) < 0.0031308f) ? (c) * 12.92f : 1.055f * (float)pow((c), 1.0f/2.4f) - 0.055f)
+
/* end marker */
#endif