if ( scale <= 0.0f ) {
scale = 1.0f;
}
+ /* globally */
+ scale *= lightmapBrightness;
/* make a local copy */
VectorScale( color, scale, sample );
/* compensate for ingame overbrighting/bitshifting */
VectorScale( sample, ( 1.0f / lightmapCompensate ), sample );
+ /* contrast */
+ if ( lightmapContrast != 1.0f ){
+ for ( i = 0; i < 3; i++ ){
+ sample[i] = lightmapContrast * ( sample[i] - 128 ) + 128;
+ if ( sample[i] < 0 ){
+ sample[i] = 0;
+ }
+ }
+ if ( ( sample[0] > 255 ) || ( sample[1] > 255 ) || ( sample[2] > 255 ) ) {
+ max = sample[0] > sample[1] ? sample[0] : sample[1];
+ max = max > sample[2] ? max : sample[2];
+ sample[0] = sample[0] * 255 / max;
+ sample[1] = sample[1] * 255 / max;
+ sample[2] = sample[2] * 255 / max;
+ }
+ }
+
/* sRGB lightmaps */
if ( lightmapsRGB ) {
sample[0] = floor( Image_sRGBFloatFromLinearFloat( sample[0] * ( 1.0 / 255.0 ) ) * 255.0 + 0.5 );
origin2 = SUPER_ORIGIN( x, y );
//% normal2 = SUPER_NORMAL( x, y );
}
- else {
+ else{
Sys_FPrintf( SYS_WRN, "WARNING: Spurious lightmap T vector\n" );
}
}
/* set luxel filter radius */
- luxelFilterRadius = lm->sampleSize != 0 ? superSample * filterRadius / lm->sampleSize : 0;
+ luxelFilterRadius = superSample * filterRadius / lm->sampleSize;
if ( luxelFilterRadius == 0 && ( filterRadius > 0.0f || filter ) ) {
luxelFilterRadius = 1;
}
/* allocate sampling flags storage */
- if ( ( lightSamples > 1 || lightRandomSamples ) && luxelFilterRadius == 0 ) {
+ if ( lightSamples > 1 || lightRandomSamples ) {
size = lm->sw * lm->sh * SUPER_LUXEL_SIZE * sizeof( unsigned char );
if ( lm->superFlags == NULL ) {
lm->superFlags = safe_malloc( size );
}
/* check for evilness */
- if ( trace.forceSubsampling > 1.0f && ( lightSamples > 1 || lightRandomSamples ) && luxelFilterRadius == 0 ) {
- totalLighted++;
+ if ( trace.forceSubsampling > 1.0f && ( lightSamples > 1 || lightRandomSamples ) ) {
+ totalLighted++;
*flag |= FLAG_FORCE_SUBSAMPLING; /* force */
}
/* add to count */
/* secondary pass, adaptive supersampling (fixme: use a contrast function to determine if subsampling is necessary) */
/* 2003-09-27: changed it so filtering disamples supersampling, as it would waste time */
- if ( ( lightSamples > 1 || lightRandomSamples ) && luxelFilterRadius == 0 ) {
+ if ( lightSamples > 1 || lightRandomSamples ) {
/* walk luxels */
for ( y = 0; y < ( lm->sh - 1 ); y++ )
{
radVertLuxel[ 2 ] = ( verts[ i ].normal[ 2 ] + 1.0f ) * 127.5f;
}
+ else if ( info->si->noVertexLight ) {
+ VectorSet( radVertLuxel, 127.5f, 127.5f, 127.5f );
+ }
+
+ else if ( noVertexLighting > 0 ) {
+ VectorSet( radVertLuxel, 127.5f * noVertexLighting, 127.5f * noVertexLighting, 127.5f * noVertexLighting );
+ }
+
/* illuminate the vertex */
else
{
VectorCopy( debugColors[ num % 12 ], radVertLuxel );
}
+ else if ( info->si->noVertexLight ) {
+ VectorSet( radVertLuxel, 127.5f, 127.5f, 127.5f );
+ }
+
+ else if ( noVertexLighting > 0 ) {
+ VectorSet( radVertLuxel, 127.5f * noVertexLighting, 127.5f * noVertexLighting, 127.5f * noVertexLighting );
+ }
+
/* divine color from the superluxels */
else
{