else
light->color[ 0 ] = light->color[ 1 ] = light->color[ 2 ] = 1.0f;
+ light->extraDist = FloatForKey( e, "_extradist" );
+ if(light->extraDist == 0.0f)
+ light->extraDist = extraDist;
+
intensity = intensity * pointScale;
light->photons = intensity;
else if( angle < 0.0f &&
(trace->twoSided || (light->flags & LIGHT_TWOSIDED)) )
angle = -angle;
+
+ /* clamp the distance to prevent super hot spots */
+ dist = sqrt(dist * dist + light->extraDist * light->extraDist);
+ if( dist < 16.0f )
+ dist = 16.0f;
+
add = light->photons / (dist * dist) * angle;
}
else
dist = SetupTrace( trace );
if( dist >= light->envelope )
return 0;
-
+
/* clamp the distance to prevent super hot spots */
+ dist = sqrt(dist * dist + light->extraDist * light->extraDist);
if( dist < 16.0f )
dist = 16.0f;
-
+
/* angle attenuation */
if( light->flags & LIGHT_ATTEN_ANGLE )
{
add = 0.0f;
}
else
- add = light->photons / (dist * dist) * angle;
+ add = (light->photons / (dist * dist)) * angle;
/* handle spotlights */
if( light->type == EMIT_SPOT )
if( light->type == EMIT_AREA && faster )
{
/* clamp the distance to prevent super hot spots */
+ dist = sqrt(dist * dist + light->extraDist * light->extraDist);
if( dist < 16.0f )
dist = 16.0f;
-
+
/* attenuate */
add = light->photons / (dist * dist);
}
else if( light->type == EMIT_POINT || light->type == EMIT_SPOT )
{
/* clamp the distance to prevent super hot spots */
+ dist = sqrt(dist * dist + light->extraDist * light->extraDist);
if( dist < 16.0f )
dist = 16.0f;
wolfLight = qfalse;
Sys_Printf( "Enabling Quake 3 lighting model (nonlinear default)\n" );
}
+
+ else if( !strcmp( argv[ i ], "-extradist" ) )
+ {
+ extraDist = atof( argv[ i + 1 ] );
+ if( extraDist < 0 )
+ extraDist = 0;
+ i++;
+ Sys_Printf( "Default extra radius set to %f units\n", extraDist );
+ }
else if( !strcmp( argv[ i ], "-sunonly" ) )
{
float radiusByDist; /* for spotlights */
float fade; /* ydnar: from wolf, for linear lights */
float angleScale; /* ydnar: stolen from vlight for K */
+ float extraDist; /* "extra dimension" distance of the light, to kill hot spots */
float add; /* ydnar: used for area lights */
float envelope; /* ydnar: units until falloff < tolerance */
/* commandline arguments */
Q_EXTERN qboolean wolfLight Q_ASSIGN( qfalse );
+Q_EXTERN float extraDist Q_ASSIGN( 0.0f );
Q_EXTERN qboolean loMem Q_ASSIGN( qfalse );
Q_EXTERN qboolean noStyles Q_ASSIGN( qfalse );
Q_EXTERN qboolean keepLights Q_ASSIGN( qfalse );