Skip to content

Commit

Permalink
client: render: implemented PVS culling for Aurora particles
Browse files Browse the repository at this point in the history
  • Loading branch information
SNMetamorph committed Jan 5, 2025
1 parent 9ac7050 commit a33d368
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion client/render/gl_aurora.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ CParticleSystem :: CParticleSystem( cl_entity_t *ent, const char *szFilename, in
enable = true;

entityMatrix.Identity();
ClearBounds(m_vecAbsMin, m_vecAbsMax);

if( !c_bCosTableInit )
{
Expand Down Expand Up @@ -877,6 +878,10 @@ AURSTATE CParticleSystem :: UpdateSystem( float frametime )
CParticle *pParticle = m_pActiveParticle;
CParticle *pLast = NULL;

if (tr.frametime != 0.0) {
ClearBounds(m_vecAbsMin, m_vecAbsMax);
}

while( pParticle )
{
if( UpdateParticle( pParticle, frametime ))
Expand Down Expand Up @@ -905,7 +910,12 @@ AURSTATE CParticleSystem :: UpdateSystem( float frametime )
}
}

return AURORA_DRAW;
if (!Mod_CheckBoxVisible(m_vecAbsMin, m_vecAbsMax)) {
return AURORA_INVISIBLE; // culled with PVS check
}
else {
return AURORA_DRAW;
}
}

void CParticleSystem :: DrawSystem( void )
Expand Down Expand Up @@ -1044,6 +1054,10 @@ bool CParticleSystem :: UpdateParticle( CParticle *part, float frametime )
while( part->m_fAngle > 360 ) part->m_fAngle -= 360;
}

if (tr.frametime != 0.0) {
AddPointToBounds(part->origin, m_vecAbsMin, m_vecAbsMax);
}

return true;
}

Expand Down
2 changes: 2 additions & 0 deletions client/render/gl_aurora.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ class CParticleSystem
matrix3x3 entityMatrix;
int m_fHasProjectionLighting;
float m_fLifeTime; // for auto-removed particles
Vector m_vecAbsMin;
Vector m_vecAbsMax;
bool enable;

private:
Expand Down

0 comments on commit a33d368

Please sign in to comment.