Skip to content

Commit

Permalink
Applied proper fix from jaMME for lines disappearing at certain angles (
Browse files Browse the repository at this point in the history
#214)

See entdark/jaMME@4dcef10

(cherry picked from commit 41af0cd)

Co-authored-by: Ensiform <ensiform@gmail.com>
  • Loading branch information
taysta and ensiform authored Oct 5, 2024
1 parent b779ff8 commit 78c1839
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions codemp/client/FxPrimitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,30 @@ CLine::CLine(void)
mRefEnt.reType = RT_LINE;
}

//----------------------------
bool CLine::Cull( void )
{
vec3_t dir;

VectorSubtract( mOrigin1, theFxHelper.refdef->vieworg, dir );

//Check if it's in front of the viewer
if ( (DotProduct( theFxHelper.refdef->viewaxis[0], dir )) >= 0 )
{
return false; //don't cull
}

VectorSubtract( mOrigin2, theFxHelper.refdef->vieworg, dir );

//Check if it's in front of the viewer
if ( (DotProduct( theFxHelper.refdef->viewaxis[0], dir )) >= 0 )
{
return false;
}

return true; //all points behind viewer
}

//----------------------------
void CLine::Draw(void)
{
Expand Down
1 change: 1 addition & 0 deletions codemp/client/FxPrimitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ class CLine : public CParticle
virtual void Die() {}

virtual bool Update();
virtual bool Cull();

inline void SetOrigin2( vec3_t org2 ) { VectorCopy( org2, mOrigin2 ); }
};
Expand Down

0 comments on commit 78c1839

Please sign in to comment.