Team Fortress 2 Source Code as on 22/4/2020
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.

52 lines
1.5 KiB

  1. //========= Copyright 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. int GetStaticPropPolyhedrons( ICollideable *pStaticProp, CPolyhedron **pOutputPolyhedronArray, int iOutputArraySize );
  23. private:
  24. // See comments in LevelInitPreEntity for why these members are commented out
  25. // CUtlString m_CachedMap;
  26. CUtlVector<CPolyhedron *> m_BrushPolyhedrons;
  27. struct StaticPropPolyhedronCacheInfo_t
  28. {
  29. int iStartIndex;
  30. int iNumPolyhedrons;
  31. int iStaticPropIndex; //helps us remap ICollideable pointers when the map is restarted
  32. };
  33. CUtlVector<CPolyhedron *> m_StaticPropPolyhedrons;
  34. CUtlMap<ICollideable *, StaticPropPolyhedronCacheInfo_t> m_CollideableIndicesMap;
  35. void Clear( void );
  36. void Update( void );
  37. };
  38. extern CStaticCollisionPolyhedronCache g_StaticCollisionPolyhedronCache;