123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- #ifndef __LIB_H__
- #define __LIB_H__
- #include <stddef.h>
- class idLib {
- private:
- static bool mainThreadInitialized;
- static ID_TLS isMainThread;
- public:
- static class idSys * sys;
- static class idCommon * common;
- static class idCVarSystem * cvarSystem;
- static class idFileSystem * fileSystem;
- static int frameNumber;
- static void Init();
- static void ShutDown();
-
- static void Printf( const char *fmt, ... );
- static void PrintfIf( const bool test, const char *fmt, ... );
- NO_RETURN static void Error( const char *fmt, ... );
- NO_RETURN static void FatalError( const char *fmt, ... );
- static void Warning( const char *fmt, ... );
- static void WarningIf( const bool test, const char *fmt, ... );
-
-
- static bool IsMainThread() { return ( 0 == mainThreadInitialized ) || ( 1 == isMainThread ); }
- };
- typedef int qhandle_t;
- class idFile;
- class idVec3;
- class idVec4;
- #ifndef NULL
- #define NULL ((void *)0)
- #endif
- #ifndef BIT
- #define BIT( num ) ( 1ULL << ( num ) )
- #endif
- #define MAX_STRING_CHARS 1024
- #define MAX_PRINT_MSG 16384
- #define MAX_WORLD_COORD ( 128 * 1024 )
- #define MIN_WORLD_COORD ( -128 * 1024 )
- #define MAX_WORLD_SIZE ( MAX_WORLD_COORD - MIN_WORLD_COORD )
- #define SIZE_KB( x ) ( ( (x) + 1023 ) / 1024 )
- #define SIZE_MB( x ) ( ( ( SIZE_KB( x ) ) + 1023 ) / 1024 )
- #define SIZE_GB( x ) ( ( ( SIZE_MB( x ) ) + 1023 ) / 1024 )
- extern idVec4 colorBlack;
- extern idVec4 colorWhite;
- extern idVec4 colorRed;
- extern idVec4 colorGreen;
- extern idVec4 colorBlue;
- extern idVec4 colorYellow;
- extern idVec4 colorMagenta;
- extern idVec4 colorCyan;
- extern idVec4 colorOrange;
- extern idVec4 colorPurple;
- extern idVec4 colorPink;
- extern idVec4 colorBrown;
- extern idVec4 colorLtGrey;
- extern idVec4 colorMdGrey;
- extern idVec4 colorDkGrey;
- dword PackColor( const idVec3 &color );
- void UnpackColor( const dword color, idVec3 &unpackedColor );
- dword PackColor( const idVec4 &color );
- void UnpackColor( const dword color, idVec4 &unpackedColor );
- short BigShort( short l );
- short LittleShort( short l );
- int BigLong( int l );
- int LittleLong( int l );
- float BigFloat( float l );
- float LittleFloat( float l );
- void BigRevBytes( void *bp, int elsize, int elcount );
- void LittleRevBytes( void *bp, int elsize, int elcount );
- void LittleBitField( void *bp, int elsize );
- void Swap_Init();
- bool Swap_IsBigEndian();
- void SixtetsForInt( byte *out, int src);
- int IntForSixtets( byte *in );
- class idException {
- public:
- static const int MAX_ERROR_LEN = 2048;
- idException( const char *text = "" ) {
- strncpy( error, text, MAX_ERROR_LEN );
- }
-
- const char * GetError() {
- return error;
- }
- protected:
-
- char * GetErrorBuffer() {
- return error;
- }
- int GetErrorBufferSize() {
- return MAX_ERROR_LEN;
- }
- private:
- friend class idFatalException;
- static char error[MAX_ERROR_LEN];
- };
- class idFatalException {
- public:
- static const int MAX_ERROR_LEN = 2048;
- idFatalException( const char *text = "" ) {
- strncpy( idException::error, text, MAX_ERROR_LEN );
- }
-
- const char * GetError() {
- return idException::error;
- }
- protected:
-
- char * GetErrorBuffer() {
- return idException::error;
- }
- int GetErrorBufferSize() {
- return MAX_ERROR_LEN;
- }
- };
- class idNetworkLoadException : public idException {
- public:
- idNetworkLoadException( const char * text = "" ) : idException( text ) { }
- };
- #include "sys/sys_assert.h"
- #include "sys/sys_threading.h"
- #include "Heap.h"
- #include "containers/Sort.h"
- #include "containers/List.h"
- #include "math/Simd.h"
- #include "math/Math.h"
- #include "math/Random.h"
- #include "math/Complex.h"
- #include "math/Vector.h"
- #include "math/VecX.h"
- #include "math/VectorI.h"
- #include "math/Matrix.h"
- #include "math/MatX.h"
- #include "math/Angles.h"
- #include "math/Quat.h"
- #include "math/Rotation.h"
- #include "math/Plane.h"
- #include "math/Pluecker.h"
- #include "math/Polynomial.h"
- #include "math/Extrapolate.h"
- #include "math/Interpolate.h"
- #include "math/Curve.h"
- #include "math/Ode.h"
- #include "math/Lcp.h"
- #include "bv/Sphere.h"
- #include "bv/Bounds.h"
- #include "bv/Box.h"
- #include "geometry/RenderMatrix.h"
- #include "geometry/JointTransform.h"
- #include "geometry/DrawVert.h"
- #include "geometry/Winding.h"
- #include "geometry/Winding2D.h"
- #include "geometry/Surface.h"
- #include "geometry/Surface_Patch.h"
- #include "geometry/Surface_Polytope.h"
- #include "geometry/Surface_SweptSpline.h"
- #include "geometry/TraceModel.h"
- #include "Str.h"
- #include "StrStatic.h"
- #include "Token.h"
- #include "Lexer.h"
- #include "Parser.h"
- #include "Base64.h"
- #include "CmdArgs.h"
- #include "containers/Array.h"
- #include "containers/BTree.h"
- #include "containers/BinSearch.h"
- #include "containers/HashIndex.h"
- #include "containers/HashTable.h"
- #include "containers/StaticList.h"
- #include "containers/LinkList.h"
- #include "containers/Hierarchy.h"
- #include "containers/Queue.h"
- #include "containers/Stack.h"
- #include "containers/StrList.h"
- #include "containers/StrPool.h"
- #include "containers/VectorSet.h"
- #include "containers/PlaneSet.h"
- #include "hashing/CRC32.h"
- #include "hashing/MD4.h"
- #include "hashing/MD5.h"
- #include "Dict.h"
- #include "LangDict.h"
- #include "DataQueue.h"
- #include "BitMsg.h"
- #include "MapFile.h"
- #include "Timer.h"
- #include "Thread.h"
- #include "Swap.h"
- #include "Callback.h"
- #include "ParallelJobList.h"
- #include "SoftwareCache.h"
- #endif
|