Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.7 KiB

  1. //========= Copyright � 1996-2009, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: 2d line occlusion for Fog of War
  4. //
  5. // $NoKeywords: $
  6. //=====================================================================================//
  7. #ifndef FOW_LINEOCCLUDER_H
  8. #define FOW_LINEOCCLUDER_H
  9. #if defined( COMPILER_MSVC )
  10. #pragma once
  11. #endif
  12. #include "mathlib/vector.h"
  13. #include "fow_2dplane.h"
  14. class CFoW;
  15. class CFoW_Viewer;
  16. class CFoW_LineOccluder
  17. {
  18. public:
  19. // construct a line occluder from the given points. the normal is supplied, though if it doesn't match up with the points, then the points are swapped.
  20. CFoW_LineOccluder( float bx, float by, float ex, float ey, Vector2D &vNormal, int nSliceNum );
  21. CFoW_LineOccluder( Vector2D &vStart, Vector2D &vEnd, CFOW_2DPlane &Plane, int nSliceNum );
  22. // get the starting point as determined by the normal
  23. inline Vector2D &GetStart( void ) { return m_vStart; }
  24. // get the ending point as determined by the normal
  25. inline Vector2D &GetEnd( void ) { return m_vEnd; }
  26. // get the plane normal
  27. inline Vector2D GetPlaneNormal( void ) { return m_Plane.GetNormal(); }
  28. // get the plane normal
  29. inline float GetPlaneDistance( void ) { return m_Plane.GetDistance(); }
  30. // get the slice index this occluder belongs to
  31. inline int GetSliceNum( void ) { return m_nSliceNum; }
  32. // determine the occlusion of this line for the viewer
  33. void ObstructViewer( CFoW *pFoW, CFoW_Viewer *pViewer );
  34. private:
  35. Vector2D m_vStart; // the starting point as determined by the normal
  36. Vector2D m_vEnd; // the ending point as determined by the normal
  37. CFOW_2DPlane m_Plane; // the plane that is formed
  38. int m_nSliceNum; // the slice index of this occluder
  39. };
  40. #endif // FOW_LINEOCCLUDER_H