mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
- Added GL version of sprite distance culling.
This commit is contained in:
parent
d47af90a56
commit
ba835a14a4
1 changed files with 18 additions and 0 deletions
|
@ -682,6 +682,21 @@ void GLSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingp
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
CVAR(Float, gl_sprite_distance_cull, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
inline bool IsDistanceCulled(AActor* thing)
|
||||
{
|
||||
double culldist = gl_sprite_distance_cull * gl_sprite_distance_cull;
|
||||
if (culldist <= 0.0)
|
||||
return false;
|
||||
|
||||
double dist = (thing->Pos() - r_viewpoint.Pos).LengthSquared();
|
||||
|
||||
if (dist > culldist)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
||||
{
|
||||
sector_t rs;
|
||||
|
@ -690,6 +705,9 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
|||
if (thing == nullptr)
|
||||
return;
|
||||
|
||||
if (IsDistanceCulled(thing))
|
||||
return;
|
||||
|
||||
// [ZZ] allow CustomSprite-style direct picnum specification
|
||||
bool isPicnumOverride = thing->picnum.isValid();
|
||||
|
||||
|
|
Loading…
Reference in a new issue