Permalink
Browse files

Use conventional shadow mapping code for inverse lights.

This re-enables shadows for players in the tiled renderer.
  • Loading branch information...
1 parent 2330e44 commit ddc6b4a6de1c53ab82a33ef049df2135ef59f720 @gimhael gimhael committed Feb 12, 2016
Showing with 13 additions and 7 deletions.
  1. +6 −2 daemon/src/engine/renderer/tr_backend.cpp
  2. +7 −5 daemon/src/engine/renderer/tr_main.cpp
@@ -5291,8 +5291,12 @@ static const void *RB_SetupLights( const void *data )
0, numLights * sizeof( shaderLight_t ),
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT );
- for( int i = 0; i < numLights; i++ ) {
- trRefLight_t *light = &cmd->refdef.lights[i];
+ for( int i = 0, j = 0; i < numLights; i++, j++ ) {
+ trRefLight_t *light = &cmd->refdef.lights[j];
+
+ while( light->l.inverseShadows ) {
+ light = &cmd->refdef.lights[++j];
+ }
VectorCopy( light->l.origin, buffer[i].center );
buffer[i].radius = light->l.radius;
@@ -2062,8 +2062,7 @@ void R_AddLightInteractions()
{
light = tr.currentLight = &tr.refdef.lights[ i ];
- if ( light->isStatic )
- {
+ if ( light->isStatic ) {
if ( r_staticLight->integer != 1 || ( ( r_precomputedLighting->integer || r_vertexLighting->integer ) && !light->noRadiosity ) )
{
if( r_staticLight->integer == 2 ) {
@@ -2072,9 +2071,12 @@ void R_AddLightInteractions()
light->cull = cullResult_t::CULL_OUT;
continue;
}
- }
- else
- {
+ } else if ( light->l.inverseShadows ) {
+ if( !r_dynamicLight->integer ) {
+ light->cull = CULL_OUT;
+ continue;
+ }
+ } else {
if ( r_dynamicLight->integer != 1 )
{
if( r_dynamicLight->integer == 2 ) {

0 comments on commit ddc6b4a

Please sign in to comment.