summaryrefslogtreecommitdiff
path: root/hammer/bsplightingthread.h
diff options
context:
space:
mode:
Diffstat (limited to 'hammer/bsplightingthread.h')
-rw-r--r--hammer/bsplightingthread.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/hammer/bsplightingthread.h b/hammer/bsplightingthread.h
new file mode 100644
index 0000000..b6988c5
--- /dev/null
+++ b/hammer/bsplightingthread.h
@@ -0,0 +1,87 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef BSPLIGHTINGTHREAD_H
+#define BSPLIGHTINGTHREAD_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+#include "stdafx.h"
+#include "ibsplightingthread.h"
+#include "utlvector.h"
+
+
+class CBSPLightingThread : public IBSPLightingThread
+{
+public:
+
+ CBSPLightingThread();
+
+
+// IBSPLightingThread functions.
+public:
+ virtual ~CBSPLightingThread();
+ virtual void Release();
+ virtual void StartLighting( char const *pVMFFileWithEntities );
+ virtual int GetCurrentState();
+ virtual void Interrupt();
+ virtual float GetPercentComplete();
+
+
+// Other functions.
+public:
+
+ // This is called immediately after the constructor. It creates the thread.
+ bool Init( IVRadDLL *pDLL );
+
+
+
+// Threadsafe functions.
+public:
+
+ enum
+ {
+ THREADCMD_NONE=0,
+ THREADCMD_LIGHT=1,
+ THREADCMD_EXIT=2
+ };
+
+ // Get the current command to the thread. Resets to THREADCMD_NONE on exit.
+ int GetThreadCmd();
+ void SetThreadCmd( int cmd );
+
+ // Returns an IBSPLightingThread::STATE_ define.
+ int GetThreadState();
+ void SetThreadState( int state );
+
+
+public:
+
+ // The thread's run function.
+ DWORD ThreadMainLoop();
+
+
+public:
+
+ int m_ThreadCmd; // Next command for the thread to run.
+ int m_ThreadState; // Current state of the thread.
+
+ CUtlVector<char> m_VMFFileWithEntities;
+
+
+public:
+ IVRadDLL *m_pVRadDLL;
+
+ HANDLE m_hThread;
+ DWORD m_ThreadID;
+ CRITICAL_SECTION m_CS;
+};
+
+
+#endif // BSPLIGHTINGTHREAD_H