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.

55 lines
1.7 KiB

  1. //========= Copyright � 1996-2006, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Portals use polyhedrons to clip and carve their custom collision areas.
  4. // This file should provide caches of polyhedrons with the initial conversion
  5. // processes already completed.
  6. //
  7. // $NoKeywords: $
  8. //=====================================================================================//
  9. #include "IGameSystem.h"
  10. #include "mathlib/polyhedron.h"
  11. #include "tier1/utlvector.h"
  12. #include "tier1/utlstring.h"
  13. #include "tier1/utlmap.h"
  14. class CStaticCollisionPolyhedronCache : public CAutoGameSystem
  15. {
  16. public:
  17. CStaticCollisionPolyhedronCache( void );
  18. ~CStaticCollisionPolyhedronCache( void );
  19. void LevelInitPreEntity( void );
  20. void Shutdown( void );
  21. const CPolyhedron *GetBrushPolyhedron( int iBrushNumber );
  22. void ReleaseBrushPolyhedron( int iBrushNumber, const CPolyhedron *pPolyhedron );
  23. int GetStaticPropPolyhedrons( ICollideable *pStaticProp, const CPolyhedron **pOutputPolyhedronArray, int iOutputArraySize );
  24. void ReleaseStaticPropPolyhedrons( ICollideable *pStaticProp, const CPolyhedron **pPolyhedrons, int iPolyhedronCount );
  25. void ForceRefreshOnMapLoad( void ) { m_CachedMap.Clear(); };
  26. private:
  27. // See comments in LevelInitPreEntity for why these members are commented out
  28. CUtlString m_CachedMap;
  29. CUtlVector<CPolyhedron *> m_BrushPolyhedrons;
  30. struct StaticPropPolyhedronCacheInfo_t
  31. {
  32. int iStartIndex;
  33. int iNumPolyhedrons;
  34. };
  35. CUtlVector<CPolyhedron *> m_StaticPropPolyhedrons;
  36. CUtlMap<vcollide_t *, StaticPropPolyhedronCacheInfo_t> m_CollideableIndicesMap;
  37. void Clear( void );
  38. void Update( void );
  39. };
  40. extern CStaticCollisionPolyhedronCache g_StaticCollisionPolyhedronCache;