- activate r_line_distance_cull in the hardware renderer

# Conflicts:
#	src/gl/scene/gl_bsp.cpp
This commit is contained in:
Rachael Alexanderson 2018-06-02 05:03:27 -04:00 committed by drfrag
parent 358718de05
commit 373870787f

View file

@ -77,6 +77,21 @@ void GLSceneDrawer::UnclipSubsector(subsector_t *sub)
//
//==========================================================================
EXTERN_CVAR(Float, r_line_distance_cull)
inline bool IsDistanceCulled(seg_t *line)
{
double dist3 = r_line_distance_cull * r_line_distance_cull;
if (dist3 <= 0.0)
return false;
double dist1 = (line->v1->fPos() - r_viewpoint.Pos).LengthSquared();
double dist2 = (line->v2->fPos() - r_viewpoint.Pos).LengthSquared();
if ((dist1 > dist3) && (dist2 > dist3))
return true;
return false;
}
void GLSceneDrawer::AddLine (seg_t *seg, bool portalclip)
{
#ifdef _DEBUG
@ -123,6 +138,8 @@ void GLSceneDrawer::AddLine (seg_t *seg, bool portalclip)
uint8_t ispoly = uint8_t(seg->sidedef->Flags & WALLF_POLYOBJ);
if (IsDistanceCulled(seg)) { clipper.SafeAddClipRange(startAngle, endAngle); return; }
if (!seg->backsector)
{
clipper.SafeAddClipRange(startAngle, endAngle);