/* ********************************************************************* * Caldron Engine °ø¿ëÇì´õÆÄÀÏ * ÆÄÀÏ : Caldron.h * ±â´É : Caldron Engine À» ÀÌ¿ëÇϴ°÷¿¡¼­ °øÅëÀûÀ¸·Î »ç¿ëÇϰԵǴ Çì´õÆÄÀÏ * ÀÛ¼ºÀÏ: 2003.10.23 * ÀÛ¼ºÀÚ: yundi ( 2003.10.23) * ¼öÁ¤ÀÚ: ********************************************************************** */ #pragma once #pragma warning(disable:4786) #pragma warning(disable:4251) #pragma warning(disable:4503) #include //#include #include #include #include #include #include #include #include #include #include #include #include namespace Caldron { // epsilon »ó¼ö extern const float MIN_EPSILON; extern const float MAX_EPSILON; // »ó¼ö ¼±¾ð const float FLOAT_RAD = 0.0174532925f; // radian °ª extern const float FLOAT_PI; // pi extern const float FLOAT_2PI; extern const int MAX_STRINGSIZE; const int MAX_RELOADING = 3; // Resource Loader ¿¡¼­ Object ·Îµù ½ÇÆÐ½Ã ÃÖ´ë Reloading ½Ãµµ Ƚ¼ö #define FLOAT_TO_INT(fValue) (*(int *)&(fValue)) #define IS_SIGNBIT(fValue) (FLOAT_TO_INT(fValue) & 0x80000000) // template function Á¤ÀÇ template inline void SafeDelete( _T ptr ) { if( NULL != ptr ) { delete (ptr); ptr = NULL; } } template inline void SafeDeleteA( _T ptr ) { if( NULL != ptr ) { delete[] (ptr); ptr = NULL; } } template inline void SafeRelease( _T ptr ) { if( NULL != ptr ) { ptr->Release(); ptr = NULL; } } inline bool Succeeded( HRESULT hr ) { return (hr >= 0); } inline bool Failed( HRESULT hr ) { return (hr < 0); } inline bool IsZero(float fValue) { if((fValue > -(MIN_EPSILON)) && (fValue < MIN_EPSILON)) return true; return false; } inline float Def2Rad( float fDeg ) { return fDeg*FLOAT_PI/180; } // CProfileMgr ¿¡¼­ »ç¿ë inline void ProfileGetTicks(_int64 * ticks) { __asm { push edx; push ecx; mov ecx,ticks; _emit 0Fh _emit 31h mov [ecx],eax; mov [ecx+4],edx; pop ecx; pop edx; } } inline float ProfileGetTickRate(void) { static float _CPUFrequency = -1.0f; if (_CPUFrequency == -1.0f) { __int64 curr_rate = 0; ::QueryPerformanceFrequency ((LARGE_INTEGER *)&curr_rate); _CPUFrequency = (float)curr_rate; } return _CPUFrequency; } // /* ********************************************************************* * CBitset * ÆÄÀÏ : Bitset.h * ±â´É : Caldron Engine³» Bitset Class * ÀÛ¼ºÀÏ : 2003.10.24 * History : wizardbug ( 2003.10.24) ********************************************************************** */ class CBitset { protected: unsigned int *m_pBits; // Bit Set ptr int m_iBitSize; // Bit Set Size public: CBitset() { m_pBits = NULL; m_iBitSize = 0; } ~CBitset() { if(m_pBits) { delete[] m_pBits; m_pBits = NULL; } } void ResizeBits(int iNewCount) { m_iBitSize = iNewCount / 32 + 1; // Get Inteager Size if(m_pBits) { delete[] m_pBits; m_pBits = NULL; } m_pBits = new unsigned int[m_iBitSize]; // Allocate Bits ClearBits(); } void ClearBits() { // Clear All Bits memset(m_pBits,0,sizeof(unsigned int) * m_iBitSize); } void ClearOneBit(int index) { m_pBits[ index >> 5 ] &= ~( 1 << ( index & 31 ) ); } void SetBit(int index) { // Set Bit m_pBits[ index >> 5 ] |= ( 1 << ( index & 31 ) ); } bool GetBit(int index) { // Return Bit's Setting : return true or false return (m_pBits[ index >> 5 ] & ( 1 << (index & 31 ) )) ? true : false; } }; /********************************************************************** */ }