Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applied proper fix from jaMME for lines disappearing at certain angles #1239

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions code/cgame/FxPrimitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,30 @@ bool COrientedParticle::Update()
//
//----------------------------

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

VectorSubtract( mOrigin1, cg.refdef.vieworg, dir );

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

VectorSubtract( mOrigin2, cg.refdef.vieworg, dir );

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

return true; //all points behind viewer
}

//----------------------------
void CLine::Draw()
{
Expand Down
1 change: 1 addition & 0 deletions code/cgame/FxPrimitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ class CLine : public CParticle
virtual ~CLine() {}
virtual void Die() {}
virtual bool Update();
virtual bool Cull();


inline void SetOrigin2( const vec3_t org2 ) { VectorCopy( org2, mOrigin2 ); }
Expand Down
23 changes: 23 additions & 0 deletions codeJK2/cgame/FxPrimitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,29 @@ bool COrientedParticle::Update()
//
//----------------------------

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

VectorSubtract( mOrigin1, cg.refdef.vieworg, dir );

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

VectorSubtract( mOrigin2, cg.refdef.vieworg, dir );

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

return true; //all points behind viewer
}

//----------------------------
void CLine::Draw()
{
Expand Down
1 change: 1 addition & 0 deletions codeJK2/cgame/FxPrimitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ class CLine : public CParticle
virtual ~CLine() {}
virtual void Die() {}
virtual bool Update();
virtual bool Cull();


inline void SetOrigin2( const vec3_t org2 ) { VectorCopy( org2, mOrigin2 ); }
Expand Down
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
Loading