File tree Expand file tree Collapse file tree 6 files changed +74
-0
lines changed Expand file tree Collapse file tree 6 files changed +74
-0
lines changed Original file line number Diff line number Diff line change @@ -762,6 +762,30 @@ bool COrientedParticle::Update()
762
762
//
763
763
// ----------------------------
764
764
765
+ // ----------------------------
766
+ bool CLine::Cull ( void )
767
+ {
768
+ vec3_t dir;
769
+
770
+ VectorSubtract ( mOrigin1 , cg.refdef .vieworg , dir );
771
+
772
+ // Check if it's in front of the viewer
773
+ if ( (DotProduct ( cg.refdef .viewaxis [0 ], dir )) >= 0 )
774
+ {
775
+ return false ; // don't cull
776
+ }
777
+
778
+ VectorSubtract ( mOrigin2 , cg.refdef .vieworg , dir );
779
+
780
+ // Check if it's in front of the viewer
781
+ if ( (DotProduct ( cg.refdef .viewaxis [0 ], dir )) >= 0 )
782
+ {
783
+ return false ;
784
+ }
785
+
786
+ return true ; // all points behind viewer
787
+ }
788
+
765
789
// ----------------------------
766
790
void CLine::Draw ()
767
791
{
Original file line number Diff line number Diff line change @@ -360,6 +360,7 @@ class CLine : public CParticle
360
360
virtual ~CLine () {}
361
361
virtual void Die () {}
362
362
virtual bool Update ();
363
+ virtual bool Cull ();
363
364
364
365
365
366
inline void SetOrigin2 ( const vec3_t org2 ) { VectorCopy ( org2, mOrigin2 ); }
Original file line number Diff line number Diff line change @@ -667,6 +667,29 @@ bool COrientedParticle::Update()
667
667
//
668
668
// ----------------------------
669
669
670
+ bool CLine::Cull ( void )
671
+ {
672
+ vec3_t dir;
673
+
674
+ VectorSubtract ( mOrigin1 , cg.refdef .vieworg , dir );
675
+
676
+ // Check if it's in front of the viewer
677
+ if ( (DotProduct ( cg.refdef .viewaxis [0 ], dir )) >= 0 )
678
+ {
679
+ return false ; // don't cull
680
+ }
681
+
682
+ VectorSubtract ( mOrigin2 , cg.refdef .vieworg , dir );
683
+
684
+ // Check if it's in front of the viewer
685
+ if ( (DotProduct ( cg.refdef .viewaxis [0 ], dir )) >= 0 )
686
+ {
687
+ return false ;
688
+ }
689
+
690
+ return true ; // all points behind viewer
691
+ }
692
+
670
693
// ----------------------------
671
694
void CLine::Draw ()
672
695
{
Original file line number Diff line number Diff line change @@ -348,6 +348,7 @@ class CLine : public CParticle
348
348
virtual ~CLine () {}
349
349
virtual void Die () {}
350
350
virtual bool Update ();
351
+ virtual bool Cull ();
351
352
352
353
353
354
inline void SetOrigin2 ( const vec3_t org2 ) { VectorCopy ( org2, mOrigin2 ); }
Original file line number Diff line number Diff line change @@ -750,6 +750,30 @@ CLine::CLine(void)
750
750
mRefEnt .reType = RT_LINE;
751
751
}
752
752
753
+ // ----------------------------
754
+ bool CLine::Cull ( void )
755
+ {
756
+ vec3_t dir;
757
+
758
+ VectorSubtract ( mOrigin1 , theFxHelper.refdef ->vieworg , dir );
759
+
760
+ // Check if it's in front of the viewer
761
+ if ( (DotProduct ( theFxHelper.refdef ->viewaxis [0 ], dir )) >= 0 )
762
+ {
763
+ return false ; // don't cull
764
+ }
765
+
766
+ VectorSubtract ( mOrigin2 , theFxHelper.refdef ->vieworg , dir );
767
+
768
+ // Check if it's in front of the viewer
769
+ if ( (DotProduct ( theFxHelper.refdef ->viewaxis [0 ], dir )) >= 0 )
770
+ {
771
+ return false ;
772
+ }
773
+
774
+ return true ; // all points behind viewer
775
+ }
776
+
753
777
// ----------------------------
754
778
void CLine::Draw (void )
755
779
{
Original file line number Diff line number Diff line change @@ -401,6 +401,7 @@ class CLine : public CParticle
401
401
virtual void Die () {}
402
402
403
403
virtual bool Update ();
404
+ virtual bool Cull ();
404
405
405
406
inline void SetOrigin2 ( vec3_t org2 ) { VectorCopy ( org2, mOrigin2 ); }
406
407
};
You can’t perform that action at this time.
0 commit comments