Skip to content

Commit 5a9a577

Browse files
committed
NUKE leftover CPU lightGrid functionality
We do this in GLSL now, and the results of this code are not actually used for anything.
1 parent 45d6aa1 commit 5a9a577

8 files changed

Lines changed: 2 additions & 137 deletions

File tree

src/engine/renderer/tr_animation.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -679,12 +679,6 @@ void R_AddMD5Surfaces( trRefEntity_t *ent )
679679
return;
680680
}
681681

682-
// set up lighting now that we know we aren't culled
683-
if ( !personalModel || glConfig2.shadowMapping )
684-
{
685-
R_SetupEntityLighting( &tr.refdef, ent, nullptr );
686-
}
687-
688682
// see if we are in a fog volume
689683
fogNum = R_FogWorldBox( ent->worldBounds );
690684

src/engine/renderer/tr_bsp.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4338,14 +4338,6 @@ void R_LoadEntities( lump_t *l, std::string &externalEntities )
43384338
// check for ambient color
43394339
else if ( !Q_stricmp( keyname, "_color" ) || !Q_stricmp( keyname, "ambientColor" ) )
43404340
{
4341-
if ( r_forceAmbient->value <= 0 )
4342-
{
4343-
sscanf( value, "%f %f %f", &tr.worldEntity.ambientLight[ 0 ], &tr.worldEntity.ambientLight[ 1 ],
4344-
&tr.worldEntity.ambientLight[ 2 ] );
4345-
4346-
VectorCopy( tr.worldEntity.ambientLight, tr.worldEntity.ambientLight );
4347-
VectorScale( tr.worldEntity.ambientLight, r_ambientScale->value, tr.worldEntity.ambientLight );
4348-
}
43494341
}
43504342

43514343
// check for deluxe mapping support
@@ -5048,11 +5040,6 @@ void RE_LoadWorldMap( const char *name )
50485040

50495041
VectorNormalize( tr.sunDirection );
50505042

5051-
// set default ambient color
5052-
tr.worldEntity.ambientLight[ 0 ] = r_forceAmbient->value;
5053-
tr.worldEntity.ambientLight[ 1 ] = r_forceAmbient->value;
5054-
tr.worldEntity.ambientLight[ 2 ] = r_forceAmbient->value;
5055-
50565043
tr.worldMapLoaded = true;
50575044

50585045
// load it

src/engine/renderer/tr_light.cpp

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -260,98 +260,6 @@ int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, ve
260260
return true;
261261
}
262262

263-
/*
264-
=================
265-
R_SetupEntityLightingGrid
266-
=================
267-
*/
268-
static void R_SetupEntityLightingGrid( trRefEntity_t *ent, vec3_t forcedOrigin )
269-
{
270-
vec3_t lightOrigin;
271-
272-
if ( forcedOrigin )
273-
{
274-
VectorCopy( forcedOrigin, lightOrigin );
275-
}
276-
else
277-
{
278-
if ( ent->e.renderfx & RF_LIGHTING_ORIGIN )
279-
{
280-
// separate lightOrigins are needed so an object that is
281-
// sinking into the ground can still be lit, and so
282-
// multi-part models can be lit identically
283-
VectorCopy( ent->e.lightingOrigin, lightOrigin );
284-
}
285-
else
286-
{
287-
VectorCopy( ent->e.origin, lightOrigin );
288-
}
289-
}
290-
291-
R_LightForPoint( lightOrigin, ent->ambientLight, ent->directedLight,
292-
ent->lightDir );
293-
}
294-
295-
/*
296-
=================
297-
R_SetupEntityLighting
298-
299-
Calculates all the lighting values that will be used
300-
by the Calc_* functions
301-
=================
302-
*/
303-
void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent, vec3_t forcedOrigin )
304-
{
305-
// lighting calculations
306-
if ( ent->lightingCalculated )
307-
{
308-
return;
309-
}
310-
311-
ent->lightingCalculated = true;
312-
313-
// if NOWORLDMODEL, only use dynamic lights (menu system, etc)
314-
if ( !( refdef->rdflags & RDF_NOWORLDMODEL ) && tr.world
315-
&& tr.world->lightGridData1 && tr.world->lightGridData2 )
316-
{
317-
R_SetupEntityLightingGrid( ent, forcedOrigin );
318-
}
319-
else
320-
{
321-
/* Historically those values were multiplied by
322-
tr.identityLight but tr.identityLight is always 1.0f
323-
in Dæmon engine as the overbright bit implementation
324-
is fully software. */
325-
326-
//% ent->ambientLight[0] = ent->ambientLight[1] = ent->ambientLight[2] = 150.0f;
327-
//% ent->directedLight[0] = ent->directedLight[1] = ent->directedLight[2] = 150.0f;
328-
//% VectorCopy( tr.sunDirection, ent->lightDir );
329-
ent->ambientLight[ 0 ] = 64.0f / 255.0f;
330-
ent->ambientLight[ 1 ] = 64.0f / 255.0f;
331-
ent->ambientLight[ 2 ] = 96.0f / 255.0f;
332-
333-
ent->directedLight[ 0 ] = 255.0f / 255.0f;
334-
ent->directedLight[ 1 ] = 232.0f / 255.0f;
335-
ent->directedLight[ 2 ] = 224.0f / 255.0f;
336-
337-
VectorSet( ent->lightDir, -1, 1, 1.25 );
338-
VectorNormalize( ent->lightDir );
339-
}
340-
341-
if ( ( ent->e.renderfx & RF_MINLIGHT ) ) // && VectorLength(ent->ambientLight) <= 0)
342-
{
343-
/* Historically those values were multiplied by
344-
tr.identityLight but tr.identityLight is always 1.0f
345-
in Dæmon engine as the as the overbright bit
346-
implementation is fully software. */
347-
348-
// give everything a minimum light add
349-
ent->ambientLight[ 0 ] += 0.125f;
350-
ent->ambientLight[ 1 ] += 0.125f;
351-
ent->ambientLight[ 2 ] += 0.125f;
352-
}
353-
}
354-
355263
/*
356264
=================
357265
R_SetupLightOrigin

src/engine/renderer/tr_local.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,6 @@ enum class shaderProfilerRenderSubGroupsMode {
465465

466466
// local
467467
float axisLength; // compensate for non-normalized axis
468-
bool lightingCalculated;
469-
vec3_t lightDir; // normalized direction towards light
470-
vec3_t ambientLight; // color normalized to 0-1
471-
vec3_t directedLight;
472468

473469
cullResult_t cull;
474470
vec3_t localBounds[ 2 ];
@@ -2755,6 +2751,8 @@ enum class shaderProfilerRenderSubGroupsMode {
27552751
std::vector<image_t *> lightmaps;
27562752
std::vector<image_t *> deluxemaps;
27572753

2754+
vec3_t ambientLight;
2755+
27582756
image_t *lightGrid1Image;
27592757
image_t *lightGrid2Image;
27602758

@@ -3563,7 +3561,6 @@ inline bool checkGLErrors()
35633561
*/
35643562

35653563
void R_AddBrushModelInteractions( trRefEntity_t *ent, trRefLight_t *light, interactionType_t iaType );
3566-
void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent, vec3_t forcedOrigin );
35673564
float R_InterpolateLightGrid( world_t *w, int from[3], int to[3],
35683565
float *factors[3], vec3_t ambientLight,
35693566
vec3_t directedLight, vec3_t lightDir );

src/engine/renderer/tr_mesh.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,6 @@ void R_AddMDVSurfaces( trRefEntity_t *ent )
302302
return;
303303
}
304304

305-
// set up lighting now that we know we aren't culled
306-
if ( !personalModel || glConfig2.shadowMapping )
307-
{
308-
R_SetupEntityLighting( &tr.refdef, ent, nullptr );
309-
}
310-
311305
// see if we are in a fog volume
312306
fogNum = R_FogWorldBox( ent->worldBounds );
313307

src/engine/renderer/tr_model_iqm.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -948,10 +948,8 @@ void R_AddIQMSurfaces( trRefEntity_t *ent ) {
948948
personalModel = (ent->e.renderfx & RF_THIRD_PERSON) &&
949949
tr.viewParms.portalLevel == 0;
950950

951-
//
952951
// cull the entire model if merged bounding box of both frames
953952
// is outside the view frustum.
954-
//
955953
R_CullIQM( ent );
956954

957955
// HACK: Never cull first-person models, due to issues with a certain model's bounds
@@ -962,16 +960,7 @@ void R_AddIQMSurfaces( trRefEntity_t *ent ) {
962960
return;
963961
}
964962

965-
//
966-
// set up lighting now that we know we aren't culled
967-
//
968-
if ( !personalModel || glConfig2.shadowMapping ) {
969-
R_SetupEntityLighting( &tr.refdef, ent, nullptr );
970-
}
971-
972-
//
973963
// see if we are in a fog volume
974-
//
975964
fogNum = R_FogWorldBox( ent->worldBounds );
976965

977966
for ( i = 0 ; i < IQModel->num_surfaces ; i++ ) {

src/engine/renderer/tr_scene.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ void RE_AddRefEntityToScene( const refEntity_t *ent )
274274
}
275275

276276
backEndData[ tr.smpFrame ]->entities[ r_numEntities ].e = *ent;
277-
backEndData[ tr.smpFrame ]->entities[ r_numEntities ].lightingCalculated = false;
278277

279278
r_numEntities++;
280279
}

src/engine/renderer/tr_world.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,6 @@ void R_AddBSPModelSurfaces( trRefEntity_t *ent )
322322
return;
323323
}
324324

325-
// Tr3B: BSP inline models should always use vertex lighting
326-
R_SetupEntityLighting( &tr.refdef, ent, boundsCenter );
327-
328325
fogNum = R_FogWorldBox( ent->worldBounds );
329326

330327
for ( i = 0; i < bspModel->numSurfaces; i++ )

0 commit comments

Comments
 (0)