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.

87 lines
1.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef BSPLIGHTINGTHREAD_H
  8. #define BSPLIGHTINGTHREAD_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "stdafx.h"
  13. #include "ibsplightingthread.h"
  14. #include "utlvector.h"
  15. class CBSPLightingThread : public IBSPLightingThread
  16. {
  17. public:
  18. CBSPLightingThread();
  19. // IBSPLightingThread functions.
  20. public:
  21. virtual ~CBSPLightingThread();
  22. virtual void Release();
  23. virtual void StartLighting( char const *pVMFFileWithEntities );
  24. virtual int GetCurrentState();
  25. virtual void Interrupt();
  26. virtual float GetPercentComplete();
  27. // Other functions.
  28. public:
  29. // This is called immediately after the constructor. It creates the thread.
  30. bool Init( IVRadDLL *pDLL );
  31. // Threadsafe functions.
  32. public:
  33. enum
  34. {
  35. THREADCMD_NONE=0,
  36. THREADCMD_LIGHT=1,
  37. THREADCMD_EXIT=2
  38. };
  39. // Get the current command to the thread. Resets to THREADCMD_NONE on exit.
  40. int GetThreadCmd();
  41. void SetThreadCmd( int cmd );
  42. // Returns an IBSPLightingThread::STATE_ define.
  43. int GetThreadState();
  44. void SetThreadState( int state );
  45. public:
  46. // The thread's run function.
  47. DWORD ThreadMainLoop();
  48. public:
  49. int m_ThreadCmd; // Next command for the thread to run.
  50. int m_ThreadState; // Current state of the thread.
  51. CUtlVector<char> m_VMFFileWithEntities;
  52. public:
  53. IVRadDLL *m_pVRadDLL;
  54. HANDLE m_hThread;
  55. DWORD m_ThreadID;
  56. CRITICAL_SECTION m_CS;
  57. };
  58. #endif // BSPLIGHTINGTHREAD_H