Skip to content

Commit a9e677c

Browse files
committed
Remove field trRefEntity_t::cull
It was pointless since it was only read immediately after being written.
1 parent 99fcd19 commit a9e677c

File tree

5 files changed

+20
-45
lines changed

5 files changed

+20
-45
lines changed

src/engine/renderer/tr_animation.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static ListAnimationsCmd listAnimationsCmdRegistration;
610610
R_CullMD5
611611
=============
612612
*/
613-
static void R_CullMD5( trRefEntity_t *ent )
613+
static cullResult_t R_CullMD5( trRefEntity_t *ent )
614614
{
615615
int i;
616616

@@ -638,19 +638,16 @@ static void R_CullMD5( trRefEntity_t *ent )
638638
{
639639
case cullResult_t::CULL_IN:
640640
tr.pc.c_box_cull_md5_in++;
641-
ent->cull = cullResult_t::CULL_IN;
642-
return;
641+
return cullResult_t::CULL_IN;
643642

644643
case cullResult_t::CULL_CLIP:
645644
tr.pc.c_box_cull_md5_clip++;
646-
ent->cull = cullResult_t::CULL_CLIP;
647-
return;
645+
return cullResult_t::CULL_CLIP;
648646

649647
case cullResult_t::CULL_OUT:
650648
default:
651649
tr.pc.c_box_cull_md5_out++;
652-
ent->cull = cullResult_t::CULL_OUT;
653-
return;
650+
return cullResult_t::CULL_OUT;
654651
}
655652
}
656653

@@ -674,9 +671,7 @@ void R_AddMD5Surfaces( trRefEntity_t *ent )
674671

675672
// cull the entire model if merged bounding box of both frames
676673
// is outside the view frustum
677-
R_CullMD5( ent );
678-
679-
if ( ent->cull == cullResult_t::CULL_OUT )
674+
if ( R_CullMD5( ent ) == cullResult_t::CULL_OUT )
680675
{
681676
return;
682677
}

src/engine/renderer/tr_local.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@ enum class ssaoMode {
424424
// local
425425
float axisLength; // compensate for non-normalized axis
426426

427-
cullResult_t cull;
428427
vec3_t localBounds[ 2 ];
429428
vec3_t worldBounds[ 2 ];
430429
};

src/engine/renderer/tr_mesh.cpp

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2929
R_CullMDV
3030
=============
3131
*/
32-
static void R_CullMDV( mdvModel_t *model, trRefEntity_t *ent )
32+
static cullResult_t R_CullMDV( mdvModel_t *model, trRefEntity_t *ent )
3333
{
3434
mdvFrame_t *oldFrame, *newFrame;
3535
int i;
@@ -59,13 +59,11 @@ static void R_CullMDV( mdvModel_t *model, trRefEntity_t *ent )
5959
{
6060
case cullResult_t::CULL_OUT:
6161
tr.pc.c_sphere_cull_mdv_out++;
62-
ent->cull = cullResult_t::CULL_OUT;
63-
return;
62+
return cullResult_t::CULL_OUT;
6463

6564
case cullResult_t::CULL_IN:
6665
tr.pc.c_sphere_cull_mdv_in++;
67-
ent->cull = cullResult_t::CULL_IN;
68-
return;
66+
return cullResult_t::CULL_IN;
6967

7068
case cullResult_t::CULL_CLIP:
7169
tr.pc.c_sphere_cull_mdv_clip++;
@@ -91,14 +89,12 @@ static void R_CullMDV( mdvModel_t *model, trRefEntity_t *ent )
9189
if ( sphereCull == cullResult_t::CULL_OUT )
9290
{
9391
tr.pc.c_sphere_cull_mdv_out++;
94-
ent->cull = cullResult_t::CULL_OUT;
95-
return;
92+
return cullResult_t::CULL_OUT;
9693
}
9794
else if ( sphereCull == cullResult_t::CULL_IN )
9895
{
9996
tr.pc.c_sphere_cull_mdv_in++;
100-
ent->cull = cullResult_t::CULL_IN;
101-
return;
97+
return cullResult_t::CULL_IN;
10298
}
10399
else
104100
{
@@ -112,19 +108,16 @@ static void R_CullMDV( mdvModel_t *model, trRefEntity_t *ent )
112108
{
113109
case cullResult_t::CULL_IN:
114110
tr.pc.c_box_cull_mdv_in++;
115-
ent->cull = cullResult_t::CULL_IN;
116-
return;
111+
return cullResult_t::CULL_IN;
117112

118113
case cullResult_t::CULL_CLIP:
119114
tr.pc.c_box_cull_mdv_clip++;
120-
ent->cull = cullResult_t::CULL_CLIP;
121-
return;
115+
return cullResult_t::CULL_CLIP;
122116

123117
case cullResult_t::CULL_OUT:
124118
default:
125119
tr.pc.c_box_cull_mdv_out++;
126-
ent->cull = cullResult_t::CULL_OUT;
127-
return;
120+
return cullResult_t::CULL_OUT;
128121
}
129122
}
130123

@@ -296,9 +289,7 @@ void R_AddMDVSurfaces( trRefEntity_t *ent )
296289

297290
// cull the entire model if merged bounding box of both frames
298291
// is outside the view frustum.
299-
R_CullMDV( model, ent );
300-
301-
if ( ent->cull == CULL_OUT )
292+
if ( R_CullMDV( model, ent ) == CULL_OUT )
302293
{
303294
return;
304295
}

src/engine/renderer/tr_model_iqm.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ bool R_LoadIQModel( model_t *mod, const void *buffer, int filesize,
930930
R_CullIQM
931931
=============
932932
*/
933-
static void R_CullIQM( trRefEntity_t *ent ) {
933+
static cullResult_t R_CullIQM( trRefEntity_t *ent ) {
934934
vec3_t localBounds[ 2 ];
935935
float scale = ent->e.skeleton.scale;
936936
IQModel_t *model = tr.currentModel->iqm;
@@ -962,17 +962,14 @@ static void R_CullIQM( trRefEntity_t *ent ) {
962962
{
963963
case cullResult_t::CULL_IN:
964964
tr.pc.c_box_cull_md5_in++;
965-
ent->cull = cullResult_t::CULL_IN;
966-
return;
965+
return cullResult_t::CULL_IN;
967966
case cullResult_t::CULL_CLIP:
968967
tr.pc.c_box_cull_md5_clip++;
969-
ent->cull = cullResult_t::CULL_CLIP;
970-
return;
968+
return cullResult_t::CULL_CLIP;
971969
case cullResult_t::CULL_OUT:
972970
default:
973971
tr.pc.c_box_cull_md5_out++;
974-
ent->cull = cullResult_t::CULL_OUT;
975-
return;
972+
return cullResult_t::CULL_OUT;
976973
}
977974
}
978975

@@ -999,14 +996,9 @@ void R_AddIQMSurfaces( trRefEntity_t *ent ) {
999996
personalModel = (ent->e.renderfx & RF_THIRD_PERSON) &&
1000997
tr.viewParms.portalLevel == 0;
1001998

1002-
// cull the entire model if merged bounding box of both frames
1003-
// is outside the view frustum.
1004-
R_CullIQM( ent );
1005-
1006999
// HACK: Never cull first-person models, due to issues with a certain model's bounds
10071000
// A first-person model not in the player's sight seems like something that should not happen in any case
1008-
// But R_CullIQM is always called because it sets some fields used by other code
1009-
if ( ent->cull == cullResult_t::CULL_OUT && !( ent->e.renderfx & RF_FIRST_PERSON ) )
1001+
if ( !( ent->e.renderfx & RF_FIRST_PERSON ) && R_CullIQM( ent ) == cullResult_t::CULL_OUT )
10101002
{
10111003
return;
10121004
}

src/engine/renderer/tr_world.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,7 @@ void R_AddBSPModelSurfaces( trRefEntity_t *ent )
185185
VectorAdd( ent->worldBounds[ 0 ], ent->worldBounds[ 1 ], boundsCenter );
186186
VectorScale( boundsCenter, 0.5f, boundsCenter );
187187

188-
ent->cull = R_CullBox( ent->worldBounds );
189-
190-
if ( ent->cull == CULL_OUT )
188+
if ( R_CullBox( ent->worldBounds ) == CULL_OUT )
191189
{
192190
return;
193191
}

0 commit comments

Comments
 (0)