Permalink
Browse files

Remove support for elliptical lights.

  • Loading branch information...
1 parent 511a783 commit 0eb665f8a507a8f4df30893a54c9e0036b43fac2 @gimhael gimhael committed Feb 1, 2016
@@ -1817,8 +1817,8 @@ static void RB_SetupLightForLighting( trRefLight_t *light )
case refLightType_t::RL_OMNI:
{
MatrixAffineInverse( light->transformMatrix, light->viewMatrix );
- MatrixSetupScale( light->projectionMatrix, 1.0 / light->l.radius[ 0 ], 1.0 / light->l.radius[ 1 ],
- 1.0 / light->l.radius[ 2 ] );
+ MatrixSetupScale( light->projectionMatrix, 1.0 / light->l.radius, 1.0 / light->l.radius,
+ 1.0 / light->l.radius );
break;
}
@@ -4376,9 +4376,7 @@ void R_LoadEntities( lump_t *l )
light->l.scale = r_lightScale->value;
- light->l.radius[ 0 ] = 300;
- light->l.radius[ 1 ] = 300;
- light->l.radius[ 2 ] = 300;
+ light->l.radius = 300.0f;
VectorClear( light->l.projTarget );
VectorClear( light->l.projRight );
@@ -4476,7 +4474,10 @@ void R_LoadEntities( lump_t *l )
// check for radius
else if ( !Q_stricmp( keyname, "light_radius" ) )
{
- sscanf( value, "%f %f %f", &light->l.radius[ 0 ], &light->l.radius[ 1 ], &light->l.radius[ 2 ] );
+ vec_t rad_y, rad_z;
+ sscanf( value, "%f %f %f", &light->l.radius, &rad_y, &rad_z );
+ if( rad_y != light->l.radius || rad_z != light->l.radius )
+ ri.Printf( PRINT_WARNING, "WARNING: non-spherical light\n" );
s = &value[ 0 ];
}
// check for light_target
@@ -4517,12 +4518,7 @@ void R_LoadEntities( lump_t *l )
// check for radius
else if ( !Q_stricmp( keyname, "light" ) || !Q_stricmp( keyname, "_light" ) )
{
- vec_t value2;
-
- value2 = atof( value );
- light->l.radius[ 0 ] = value2;
- light->l.radius[ 1 ] = value2;
- light->l.radius[ 2 ] = value2;
+ light->l.radius = atof( value );
}
// check for scale
else if ( !Q_stricmp( keyname, "light_scale" ) )
@@ -389,12 +389,12 @@ void R_SetupLightLocalBounds( trRefLight_t *light )
case refLightType_t::RL_OMNI:
case refLightType_t::RL_DIRECTIONAL:
{
- light->localBounds[ 0 ][ 0 ] = -light->l.radius[ 0 ];
- light->localBounds[ 0 ][ 1 ] = -light->l.radius[ 1 ];
- light->localBounds[ 0 ][ 2 ] = -light->l.radius[ 2 ];
- light->localBounds[ 1 ][ 0 ] = light->l.radius[ 0 ];
- light->localBounds[ 1 ][ 1 ] = light->l.radius[ 1 ];
- light->localBounds[ 1 ][ 2 ] = light->l.radius[ 2 ];
+ light->localBounds[ 0 ][ 0 ] = -light->l.radius;
+ light->localBounds[ 0 ][ 1 ] = -light->l.radius;
+ light->localBounds[ 0 ][ 2 ] = -light->l.radius;
+ light->localBounds[ 1 ][ 0 ] = light->l.radius;
+ light->localBounds[ 1 ][ 1 ] = light->l.radius;
+ light->localBounds[ 1 ][ 2 ] = light->l.radius;
break;
}
@@ -612,7 +612,7 @@ void R_SetupLightFrustum( trRefLight_t *light )
for ( i = 0; i < 3; i++ )
{
- VectorMA( light->l.origin, light->l.radius[ i ], axis[ i ], planeOrigin );
+ VectorMA( light->l.origin, light->l.radius, axis[ i ], planeOrigin );
VectorNegate( axis[ i ], planeNormal );
VectorNormalize( planeNormal );
@@ -622,7 +622,7 @@ void R_SetupLightFrustum( trRefLight_t *light )
for ( i = 0; i < 3; i++ )
{
- VectorMA( light->l.origin, -light->l.radius[ i ], axis[ i ], planeOrigin );
+ VectorMA( light->l.origin, -light->l.radius, axis[ i ], planeOrigin );
VectorCopy( axis[ i ], planeNormal );
VectorNormalize( planeNormal );
@@ -734,7 +734,7 @@ void R_SetupLightProjection( trRefLight_t *light )
case refLightType_t::RL_OMNI:
case refLightType_t::RL_DIRECTIONAL:
{
- MatrixSetupScale( light->projectionMatrix, 1.0 / light->l.radius[ 0 ], 1.0 / light->l.radius[ 1 ], 1.0 / light->l.radius[ 2 ] );
+ MatrixSetupScale( light->projectionMatrix, 1.0 / light->l.radius, 1.0 / light->l.radius, 1.0 / light->l.radius );
break;
}
@@ -2026,7 +2026,7 @@ void R_TransformShadowLight( trRefLight_t *light ) {
VectorScale( up, 2.0f * radius, light->l.projUp );
VectorCopy( vec3_origin, light->l.projStart );
VectorCopy( vec3_origin, light->l.projEnd );
- VectorScale( forward, light->l.radius[0], light->l.projTarget );
+ VectorScale( forward, light->l.radius, light->l.projTarget );
}
/*
@@ -390,7 +390,7 @@ void RE_AddRefLightToScene( const refLight_t *l )
return;
}
- if ( l->radius[ 0 ] <= 0 && !VectorLength( l->radius ) && !VectorLength( l->projTarget ) )
+ if ( l->radius <= 0 && !VectorLength( l->projTarget ) )
{
return;
}
@@ -507,9 +507,7 @@ void RE_AddDynamicLightToSceneET( const vec3_t org, float radius, float intensit
// HACK: this will tell the renderer backend to use tr.defaultLightShader
light->l.attenuationShader = 0;
- light->l.radius[ 0 ] = radius;
- light->l.radius[ 1 ] = radius;
- light->l.radius[ 2 ] = radius;
+ light->l.radius = radius;
light->l.color[ 0 ] = r;
light->l.color[ 1 ] = g;
@@ -239,7 +239,7 @@ struct refLight_t
float scale; // r_lightScale if not set
// omni-directional light specific
- vec3_t radius;
+ float radius;
// projective light specific
vec3_t projTarget;

0 comments on commit 0eb665f

Please sign in to comment.