42 #ifndef INCLUDED_GLS_RUNTIME_UTIL_H 
   43 #define INCLUDED_GLS_RUNTIME_UTIL_H 
   45 #include "ConvertUTF.h" 
   66 #    define _CRT_FUNCTIONS_REQUIRED 1 
   77 #if defined( LINUX ) || defined( __VXWORKS__ ) || defined( __APPLE__ ) || defined( QNX ) 
   82 #    include <android/asset_manager.h> 
   85 const int DIALOG_MAX_DIRECTORY_LENGTH = 1024; 
 
   90 #if defined( GLS_DEBUG ) || !defined( NDEBUG ) 
   91 #    define GLS_DEBUG_CODE( x ) x 
   93 #    define GLS_DEBUG_CODE( x ) 
  111 inline int strcasecmp( 
const char* 
const x, 
const char* 
const y )
 
  113     return _stricmp( x, y );
 
  121 const char PARSER_CLEARSTRING_DELIMETER_START[] = 
"#$STRING_START$#";
 
  122 const char PARSER_CLEARSTRING_DELIMETER_END[]   = 
"#$STRING_END$#";
 
  124 const double HIT_TOLERANCE = 5.0;
 
  127 template<
class X, 
class X1, 
class X2>
 
  128 bool BETWEEN( 
const X& x, 
const X1& x1, 
const X2& x2 )
 
  130     return ( x >= x1 && x <= x2 )
 
  131            || ( x >= x2 && x <= x1 );
 
  136 bool IS_NEGATIVE( 
const X& x ) { 
return std::fabs( x ) > 0.0001 ? ( x < 0.0 ) : 0; }
 
  140 bool IS_POSITIVE( 
const X& x ) { 
return std::fabs( x ) > 0.0001 ? ( x > 0.0 ) : 0; }
 
  146     return std::fabs( x ) < threshold;
 
  164 #    define MIN( A, B ) ( ( A ) < ( B ) ? ( A ) : ( B ) ) 
  170 #    define MAX( A, B ) ( ( A ) > ( B ) ? ( A ) : ( B ) ) 
  179 GLS_EXPORT 
bool gltIsExtSupported( 
const char* extension );
 
  184 #    define GLSTUDIO_CLAMP_TO_EDGE ( OpenGLVersion() >= 1.2f ? 0x812F : GL_CLAMP ) 
  186 #    define GLSTUDIO_CLAMP_TO_EDGE GL_CLAMP_TO_EDGE 
  214     if( ( index < 0 ) || ( index >= GLS_COLOR_MAX ) )
 
  215         return glsDefinedColors[ 0 ];
 
  217         return glsDefinedColors[ index ];
 
  225     unsigned char       alpha )
 
  227     if( ( index >= 0 ) && ( index < GLS_COLOR_MAX ) )
 
  229         glsDefinedColors[ index ][ 0 ] = red;
 
  230         glsDefinedColors[ index ][ 1 ] = green;
 
  231         glsDefinedColors[ index ][ 2 ] = blue;
 
  232         glsDefinedColors[ index ][ 3 ] = alpha;
 
  243     typedef unsigned short char_type;
 
  244     typedef int            int_type;
 
  245     typedef std::streampos pos_type;
 
  246     typedef std::streamoff off_type;
 
  247     typedef std::mbstate_t state_type;
 
  249     static void assign( char_type& c1, 
const char_type& c2 )
 
  254     static bool eq( 
const char_type& c1, 
const char_type& c2 )
 
  259     static bool lt( 
const char_type& c1, 
const char_type& c2 )
 
  264     static int compare( 
const char_type* s1, 
const char_type* s2, 
size_t n )
 
  274                 return ( *s1 - *( s2 - 1 ) );
 
  284     static size_t length( 
const char_type* s )
 
  294     static const char_type* find( 
const char_type* s, 
size_t n, 
const char_type& a )
 
  307     static char_type* move( char_type* s1, 
const char_type* s2, 
size_t n )
 
  309         return static_cast<char_type*
>( memmove( s1, s2, n * 
sizeof( char_type ) ) );
 
  312     static char_type* copy( char_type* s1, 
const char_type* s2, 
size_t n )
 
  314         return static_cast<char_type*
>( memcpy( s1, s2, n * 
sizeof( char_type ) ) );
 
  317     static char_type* assign( char_type* s, 
size_t n, char_type a )
 
  319         for( 
size_t idx = 0u; idx < n; ++idx )
 
  326     static char_type to_char_type( 
const int_type& c )
 
  328         return static_cast<char_type
>( c );
 
  331     static int_type to_int_type( 
const char_type& c )
 
  333         return static_cast<int_type
>( c );
 
  336     static bool eq_int_type( 
const int_type& c1, 
const int_type& c2 )
 
  341     static int_type eof()
 
  343         return static_cast<int_type
>( EOF );
 
  346     static int_type not_eof( 
const int_type& c )
 
  348         return ( c == eof() ) ? 0 : c;
 
  352 typedef std::basic_string<unsigned short, CharTraitsUnsignedShort> UTF16String;
 
  353 typedef std::ofstream                                              UTF16Outfilestream;
 
  354 typedef std::ostream                                               UTF16Outstream;
 
  355 typedef std::string                                                UnicodeString;
 
  356 typedef std::ofstream                                              UnicodeOutfilestream;
 
  357 typedef std::ostream                                               UnicodeOutstream;
 
  361 typedef std::wstring   UTF16String;
 
  362 typedef std::wofstream UTF16Outfilestream;
 
  363 typedef std::wostream  UTF16Outstream;
 
  364 typedef std::wstring   UnicodeString;
 
  365 typedef std::wofstream UnicodeOutfilestream;
 
  366 typedef std::wostream  UnicodeOutstream;
 
  378     if( src.size() > 0u )
 
  381         const unsigned int srcLen      = (
unsigned int)src.size();
 
  382         const unsigned int utf16BufLen = (
unsigned int)( src.size() + 1u );
 
  383         UTF16*             utf16Buf    = 
new UTF16[ src.size() + 1u ];
 
  385         memset( utf16Buf, 0, ( utf16BufLen * 
sizeof( UTF16 ) ) );
 
  389             const UTF8* srcUTF8     = (
const UTF8*)( src.c_str() );
 
  390             UTF16*      targetUTF16 = utf16Buf;
 
  391             ConvertUTF8toUTF16( &srcUTF8, &srcUTF8[ srcLen ], &targetUTF16, &( targetUTF16[ utf16BufLen - 1u ] ), strictConversion );
 
  394         utf16Buf[ utf16BufLen - 1u ] = 0;
 
  397         ret.assign( (
wchar_t*)utf16Buf );
 
  399         ret.assign( (
unsigned short*)utf16Buf );
 
  403         delete[]( utf16Buf );
 
  422 template<
class T1, 
class T2>
 
  423 bool Equal( T1 x, T2 y, 
float precision = 0.001f )
 
  425     return ( x - precision ) <= y && y <= ( x + precision );
 
  434 const T& 
Min( 
const T& x, 
const T& y )
 
  436     return x < y ? x : y;
 
  445 const T& 
Max( 
const T& x, 
const T& y )
 
  447     return x < y ? y : x;
 
  455 template<
class T, 
class Pred>
 
  456 const T& 
Min( 
const T& x, 
const T& y, Pred pr )
 
  458     return pr( x, y ) ? x : y;
 
  466 template<
class T, 
class Pred>
 
  467 const T& 
Max( 
const T& x, 
const T& y, Pred pr )
 
  469     return pr( x, y ) ? y : x;
 
  534     rotation_scaling( 0, 0 ) = new_i.x;
 
  535     rotation_scaling( 0, 1 ) = new_j.x;
 
  536     rotation_scaling( 0, 2 ) = new_k.x;
 
  537     rotation_scaling( 1, 0 ) = new_i.y;
 
  538     rotation_scaling( 1, 1 ) = new_j.y;
 
  539     rotation_scaling( 1, 2 ) = new_k.y;
 
  540     rotation_scaling( 2, 0 ) = new_i.z;
 
  541     rotation_scaling( 2, 1 ) = new_j.z;
 
  542     rotation_scaling( 2, 2 ) = new_k.z;
 
  545     rotation_scaling.
Invert();
 
  548     return rotation_scaling * transform;
 
  554     GlsMatrixAffine<T> transform;
 
  555     GlsMatrixAffine<T> rotation_scaling;
 
  559     transform.Translate( -new_origin );
 
  563     rotation_scaling( 0, 0 ) = new_i.x;
 
  564     rotation_scaling( 0, 1 ) = new_j.x;
 
  565     rotation_scaling( 0, 2 ) = new_k.x;
 
  566     rotation_scaling( 1, 0 ) = new_i.y;
 
  567     rotation_scaling( 1, 1 ) = new_j.y;
 
  568     rotation_scaling( 1, 2 ) = new_k.y;
 
  569     rotation_scaling( 2, 0 ) = new_i.z;
 
  570     rotation_scaling( 2, 1 ) = new_j.z;
 
  571     rotation_scaling( 2, 2 ) = new_k.z;
 
  574     rotation_scaling.Invert();
 
  577     result = rotation_scaling * transform;
 
  649     int& index1, 
int& index2, 
int& index3,
 
  650     bool isVectorArray = 
true );
 
  673 GLS_EXPORT 
int EncodeString( 
char* dest, 
const char* src, 
const int dest_str_length );
 
  679 GLS_EXPORT std::string 
EncodeString( 
const std::string& src );
 
  692 GLS_EXPORT 
int C_EncodeString( 
char* dest, 
const char* src, 
const int dest_str_length );
 
  706 GLS_EXPORT 
int DecodeString( 
char* dest, 
const char* src, 
const int dest_str_length );
 
  712 GLS_EXPORT std::string 
DecodeString( 
const std::string& src );
 
  720     unsigned char* pixels;
 
  723 GLS_EXPORT 
char* MakeRelativePath( 
const char* originalPath, 
const char* relativePath );
 
  724 GLS_EXPORT 
void  ConvertBackslashToSlash( 
char* str );
 
  725 GLS_EXPORT 
void  ConvertBackslashToSlash( std::string& str );
 
  742 GLS_EXPORT 
int range_check( 
int num, 
double val, ... );
 
  751 GLS_EXPORT 
int Safe_fopen( 
const char* filename, 
char* flags, FILE** f );
 
  753 GLS_EXPORT 
int Safe_fopen( 
const char* filename, 
char* flags, std::fstream& outstr );
 
  762 GLS_EXPORT 
void EnableDirectAssetLoading( 
bool enableDirectAssetLoading );
 
  770 GLS_EXPORT 
bool HasAssetExtension( 
const char* filename );
 
  778 GLS_EXPORT 
bool AssetExists( 
const char* filename );
 
  785 GLS_EXPORT 
void SetAssetManager( AAssetManager* assetManager );
 
  788 #if defined( ANDROID ) || ( defined( __APPLE__ ) && defined( GLES ) ) || ( defined( LINUX ) && defined( GLES ) ) || defined( QNX ) || defined( INTEGRITY ) 
  794 GLS_EXPORT std::string 
ResolvePath( 
const char* filename_ );
 
  800 GLS_EXPORT 
void SetResourcePath( 
const char* resourcePath );
 
  811 GLS_EXPORT FILE* 
gls_fopen( 
const char* filename, 
const char* flags );
 
  836 GLS_EXPORT std::string 
ResolvePath( 
const char* path );
 
  839 inline std::string 
ResolvePath( 
const std::string& path )
 
  850 GLS_EXPORT FILE* 
gls_fopen( 
const char* filename, 
const char* flags );
 
  862 #if defined( __APPLE__ ) && defined( GLES ) 
  869 GLS_EXPORT std::string GetAbsolutePathAndFileNameInDefaultResourceBundle( 
const char* fileName );
 
  882 GLS_EXPORT 
bool FileExists( 
const char* filename );
 
  883 GLS_EXPORT 
bool FileExists( 
const std::string& filename );
 
  888 GLS_EXPORT 
bool IsDirectory( 
const char* filename );
 
  889 GLS_EXPORT 
bool IsDirectory( 
const std::string& filename );
 
  894 GLS_EXPORT std::string 
FileExtension( 
const std::string& filepath );
 
  899 GLS_EXPORT std::string 
FileName( 
const std::string& filepath );
 
  905 GLS_EXPORT std::string 
FilePath( 
const std::string& filepath );
 
  913 GLS_EXPORT 
const char* 
GetFilePath( 
const char* name );
 
  939 GLS_EXPORT 
char* 
PathToOS( 
const char* path );
 
  946 GLS_EXPORT std::string 
GetExtension( 
const std::string& filename );
 
  952 GLS_EXPORT 
const char* 
GetBaseName( 
const char* path );
 
  977 GLS_EXPORT 
void TrimSpaces( std::string& entry );
 
  991 GLS_EXPORT 
bool ContainsNonBlank( 
const std::string& val );
 
  993 GLS_EXPORT 
bool GetNoSpaces( FILE* f, 
char* result, 
int maxLen );
 
  994 GLS_EXPORT 
bool GetToEnd( std::istream& instr, std::string& result, 
bool decode );
 
  995 GLS_EXPORT 
bool GetVertex( std::istream& instr, Vertex* vert, 
bool getColor );
 
 1000 GLS_EXPORT 
bool GetComponentClassNames( 
const char* dllFileName, DynamicArray<std::string>& nameList, 
const char* createClassTag = 
"CreateComponent_" );
 
 1016 #if !defined( GLES ) || defined( GLES_ANGLE ) 
 1017 GLS_EXPORT 
bool OpenFileDialog( Fl_Window* win, 
char* filePath, 
unsigned int filePathSize,
 
 1018     char* directory = NULL, 
const char* filterStr = NULL,
 
 1019     const char* defaultExt = NULL, 
const char* title = NULL,
 
 1020     bool multiSelect = 
false, 
bool createFile = 
false,
 
 1021     bool fileMustExist = 
false, 
bool pathMustExist = 
false,
 
 1022     bool noChangeDirectory = 
false );
 
 1024 GLS_EXPORT 
bool SaveFileDialog( Fl_Window* win, 
char* filePath, 
unsigned int filePathSize,
 
 1025     char* directory = NULL, 
const char* filterStr = NULL,
 
 1026     const char* defaultExt = NULL, 
const char* title = NULL,
 
 1027     bool createFile    = 
false,
 
 1028     bool fileMustExist = 
false, 
bool pathMustExist = 
false,
 
 1029     bool noChangeDirectory = 
false );
 
 1031 GLS_EXPORT 
void CheckGLError( 
void );
 
 1041 GLS_EXPORT std::string 
Uppercase( 
const std::string& str );
 
 1043 GLS_EXPORT std::string ReplaceEnvironmentVariables( 
const char* originalPath );
 
 1050     GLS_EXPORT 
void ReadCommandLine( 
int argc, 
char** argv );
 
 1051     GLS_EXPORT 
void Usage();
 
 1059     static GLS_EXPORT glsCommandLine* Instance();
 
 1075     GLS_EXPORT InterfaceDescriptionClass( 
const char* code, 
const char* usage, 
const char* comment );
 
 1077     GLS_EXPORT ~InterfaceDescriptionClass();
 
 1078     GLS_EXPORT InterfaceDescriptionClass( 
const InterfaceDescriptionClass& source );
 
 1079     GLS_EXPORT InterfaceDescriptionClass& operator=( 
const InterfaceDescriptionClass& source );
 
 1081     GLS_EXPORT 
void Code( 
const char* );
 
 1082     GLS_EXPORT 
void Usage( 
const char* );
 
 1083     GLS_EXPORT 
void Comment( 
const char* );
 
 1085     const char* Code()
 const { 
return _code; }
 
 1086     const char* Usage()
 const { 
return _usage; }
 
 1087     const char* Comment()
 const { 
return _comment; }
 
 1089 #if defined( DISTI_HAS_RVAL_REFS ) 
 1090     InterfaceDescriptionClass( InterfaceDescriptionClass&& source )
 
 1095         StealFrom( source );
 
 1098     InterfaceDescriptionClass& operator=( InterfaceDescriptionClass&& source )
 
 1100         if( 
this != &source )
 
 1107             StealFrom( source );
 
 1113     void StealFrom( InterfaceDescriptionClass& source )
 
 1116         _code    = source._code;
 
 1117         _usage   = source._usage;
 
 1118         _comment = source._comment;
 
 1121         source._code    = NULL;
 
 1122         source._usage   = NULL;
 
 1123         source._comment = NULL;
 
 1137     typedef std::ostream ostreamType;
 
 1138     typedef std::istream istreamType;
 
 1140     virtual void StreamOut( ostreamType& outstr ) 
const = 0;
 
 1141     virtual void StreamIn( istreamType& instr )         = 0;
 
 1175         if( 
typeid( T2 ) != 
typeid( 
void* ) )
 
 1179         if( 
typeid( T3 ) != 
typeid( 
void* ) )
 
 1183         if( 
typeid( T4 ) != 
typeid( 
void* ) )
 
 1187         if( 
typeid( T5 ) != 
typeid( 
void* ) )
 
 1191         if( 
typeid( T6 ) != 
typeid( 
void* ) )
 
 1195         if( 
typeid( T7 ) != 
typeid( 
void* ) )
 
 1199         if( 
typeid( T8 ) != 
typeid( 
void* ) )
 
 1203         if( 
typeid( T9 ) != 
typeid( 
void* ) )
 
 1207         if( 
typeid( T10 ) != 
typeid( 
void* ) )
 
 1239         : _val1( src._val1 )
 
 1240         , _val2( src._val2 )
 
 1241         , _val3( src._val3 )
 
 1242         , _val4( src._val4 )
 
 1243         , _val5( src._val5 )
 
 1244         , _val6( src._val6 )
 
 1245         , _val7( src._val7 )
 
 1246         , _val8( src._val8 )
 
 1247         , _val9( src._val9 )
 
 1248         , _val10( src._val10 )
 
 1267         const T2&  val2  = T2(),
 
 1268         const T3&  val3  = T3(),
 
 1269         const T4&  val4  = T4(),
 
 1270         const T5&  val5  = T5(),
 
 1271         const T6&  val6  = T6(),
 
 1272         const T7&  val7  = T7(),
 
 1273         const T8&  val8  = T8(),
 
 1274         const T9&  val9  = T9(),
 
 1275         const T10& val10 = T10() )
 
 1298         case 10: rval &= ( _val10 == val._val10 );
 
 1299         case 9: rval &= ( _val9 == val._val9 );
 
 1300         case 8: rval &= ( _val8 == val._val8 );
 
 1301         case 7: rval &= ( _val7 == val._val7 );
 
 1302         case 6: rval &= ( _val6 == val._val6 );
 
 1303         case 5: rval &= ( _val5 == val._val5 );
 
 1304         case 4: rval &= ( _val4 == val._val4 );
 
 1305         case 3: rval &= ( _val3 == val._val3 );
 
 1306         case 2: rval &= ( _val2 == val._val2 );
 
 1308             rval &= ( _val1 == val._val1 );
 
 1319         return !( *
this == val );
 
 1330             outstr << 
" " << _val2;
 
 1332             outstr << 
" " << _val3;
 
 1334             outstr << 
" " << _val4;
 
 1336             outstr << 
" " << _val5;
 
 1338             outstr << 
" " << _val6;
 
 1340             outstr << 
" " << _val7;
 
 1342             outstr << 
" " << _val8;
 
 1344             outstr << 
" " << _val9;
 
 1345         if( _numVals >= 10 )
 
 1346             outstr << 
" " << _val10;
 
 1396         if( _numVals >= 10 )
 
 1404 GLS_EXPORT std::ostream& 
operator<<( std::ostream& outstr, 
const GlsMultiValBase& multiVal );
 
 1405 GLS_EXPORT std::istream& operator>>( std::istream& instr, GlsMultiValBase& multiVal );
 
 1417     std::string _string;
 
 1438         : _string( str ? str : 
"" )
 
 1442     operator std::string()
 const 
 1458         return str1._string == str2._string;
 
 1464         return !( str1 == str2 );
 
 1468 inline std::ostream& 
operator<<( std::ostream& outstr, 
const GlsPropString& str )
 
 1473 inline std::istream& operator>>( std::istream& instr, GlsPropString& str )
 
 1476     disti::GetToEnd( instr, temp, 
false );
 
 1489     std::string _string;
 
 1512     operator std::string()
 const 
 1517     std::string& String()
 
 1524         return str._string == _string;
 
 1528 inline std::ostream& 
operator<<( std::ostream& outstr, 
const GlsPropStringQuoted& str )
 
 1534 inline std::istream& operator>>( std::istream& instr, GlsPropStringQuoted& str )
 
 1541     if( instr.peek() != 
'\"' )
 
 1543         disti::GetToEnd( instr, temp, 
false );
 
 1553         while( instr.good() )
 
 1555             lastChar = currChar;
 
 1556             currChar = instr.get();
 
 1557             if( currChar != -1 )
 
 1559                 if( currChar == 
'\"' && lastChar != 
'\\' )
 
 1561                 temp += (char)currChar;
 
 1572 void SpawnBrowser( 
const char* url );
 
 1582 GLS_EXPORT 
bool CheckDistiLicense( 
const char* licenseGroupName, 
const char* feature, 
const char* version, 
bool quiet );
 
 1616     T Clamp( 
const T& val, 
const T& min, 
const T& max )
 
 1618         return std::min( max, std::max( min, val ) );
 
 1631     inline void Split( 
const std::string& s, 
const char delim, std::vector<std::string>& elems, 
const std::size_t maxElems = 0 )
 
 1633         std::istringstream ss( s );
 
 1635         while( std::getline( ss, item, delim ) )
 
 1637             elems.push_back( DISTI_RVAL_MOVE( item ) );
 
 1638             if( elems.size() == maxElems )
 
 1643         if( elems.size() == maxElems && ss.good() && maxElems > 0 )
 
 1645             std::string remainder;
 
 1646             std::getline( ss, remainder, 
'\0' );
 
 1647             elems.back() += delim + remainder;
 
 1661     inline std::vector<std::string> Split( 
const std::string& s, 
const char delim, 
const std::size_t maxElems = 0 )
 
 1663         std::vector<std::string> elems;
 
 1664         Split( s, delim, elems, maxElems );
 
 1669     inline std::string MakeString( 
const char* 
const cStr )
 
 1671         return ( cStr ? cStr : 
"" );
 
 1678 class IGlsStateManager;
 
 1681 class TextureLoaderList;
 
 1715     void operator=( 
const GlsGlobals& ) DISTI_SPECIAL_MEM_FUN_DELETE;
 
 1722     inline void _checkPointerSize()
 
 1726                               || ( DISTI_IS_BITNESS( 32 ) && 
sizeof( 
void* ) == 4 ),
 
 1727             "Pointer size is unexpected for this bitness" );
 
 1728         DISTI_STATIC_ASSERT_STR( DISTI_IS_BITNESS( 64 ) ^ DISTI_IS_BITNESS( 32 ), 
"Expected one bitness to be detected." );
 
 1735 GLS_EXPORT 
void glsPerspective( 
double fovy, 
double aspect, 
double zNear, 
double zFar );
 
 1737 #ifdef MATRIX_TYPE_FLOAT 
 1738 GLS_EXPORT 
bool glsProject( 
double objx, 
double objy, 
double objz,
 
 1739     const float modelMatrix[ 16 ],
 
 1740     const float projMatrix[ 16 ],
 
 1741     const int   viewport[ 4 ],
 
 1742     double* winx, 
double* winy, 
double* winz );
 
 1744 GLS_EXPORT 
bool glsUnProject( 
double winx, 
double winy, 
double winz,
 
 1745     const float modelMatrix[ 16 ],
 
 1746     const float projMatrix[ 16 ],
 
 1747     const int   viewport[ 4 ],
 
 1748     double* objx, 
double* objy, 
double* objz );
 
 1750 GLS_EXPORT 
bool  glsProject( 
double objx, 
double objy, 
double objz,
 
 1751      const double modelMatrix[ 16 ],
 
 1752      const double projMatrix[ 16 ],
 
 1753      const int    viewport[ 4 ],
 
 1754      double* winx, 
double* winy, 
double* winz );
 
 1756 GLS_EXPORT 
bool glsUnProject( 
double winx, 
double winy, 
double winz,
 
 1757     const double modelMatrix[ 16 ],
 
 1758     const double projMatrix[ 16 ],
 
 1759     const int    viewport[ 4 ],
 
 1760     double* objx, 
double* objy, 
double* objz );
 
The DistiUnhideGlobalsDummyClass class. 
const T & Min(const T &x, const T &y)
Definition: util.h:434
int EncodedStringMinLength()
GlsPropStringQuoted(const std::string &str)
Definition: util.h:1499
virtual void StreamOut(ostreamType &outstr) const 
Definition: util.h:1326
#define DISTI_STATIC_ASSERT_STR(expr, msg)
Uses C++11's static_assert() because it is available on this platform. 
Definition: gls_cpp_lang_support.h:384
std::string GetExtension(const std::string &filename)
GlsDefinedColorEnum
Definition: util.h:191
bool IS_NEGATIVE(const X &x)
Definition: util.h:136
const int INLINE_TEXTURE_LINE_LENGTH
Definition: util.h:118
std::string & String()
Definition: util.h:1450
std::string FileExtension(const std::string &filepath)
void GlsGetPerspective(GlsMatrixType &m, double fovy, double aspect, double zNear, double zFar)
GlsPropString(const char *str)
Definition: util.h:1437
unsigned char glsDefinedColors[GLS_COLOR_MAX][4]
bool IsNearZero(X x)
Definition: util.h:155
virtual bool operator!=(const GlsMultiVal &val) const 
Definition: util.h:1317
Definition: dynamic_array.h:66
The disti::DynamicArray class. A templated array of objects capable of dynamically growing...
Class to contain current OpenGL view, projection and draw matrices. 
Definition: util.h:473
std::string FileName(const std::string &filepath)
const char * GetBaseName(const char *path)
bool VeryCloseToZero(X x)
Definition: util.h:151
int EncodeString(char *dest, const char *src, const int dest_str_length)
void TrimSpaces(std::string &entry)
The GlsMatrixAffine class. 
void AppendTrailingSlash(char *s)
GlsFontMan & GetFontMan()
Gets the global font manager. 
void RemoveDoubleSlashes(char *path, char slash= '/')
Definition: texture_loader.h:55
bool CheckDistiLicense(const char *licenseGroupName, const char *feature, const char *version, bool quiet)
std::string GetQualifiedInstanceName(const DisplayFrame *topFrame, const DisplayObject *obj)
Hold global objects so we can control order of destruction. 
Definition: util.h:1684
std::string GetDefaultComponentClassName(const char *dllFileName)
bool BETWEEN(const X &x, const X1 &x1, const X2 &x2)
Definition: util.h:128
GlsMultiVal()
Definition: util.h:1228
char * PathToOS(const char *path)
bool IS_ZERO(X x)
Definition: util.h:159
Definition: gls_state_manager_interface.h:67
void RemoveSpaces(std::string &entry)
const T & Max(const T &x, const T &y)
Definition: util.h:445
virtual bool operator==(const GlsMultiVal &val) const 
Definition: util.h:1291
GlsPropStringQuoted(const char *str)
Definition: util.h:1507
bool SilentMode() const 
Definition: util.h:1057
A file for all GL Studio files to include. 
Mutex & GetImageListMutex()
Gets the mutex for protecting the image list. 
int range_check(int num, double val,...)
std::ostream & operator<<(std::ostream &outstr, const AttributeName &name)
Defines the stream out operator. 
bool GetObjectCoordinatesTransformSameView(DisplayObject *from, DisplayObject *to, GlsMatrixType *outTransform)
UTF16String ConvertUTF8ToWide(const std::string &src)
Definition: util.h:375
float AngularDistanceRad(float angle1, float angle2)
std::string Uppercase(const std::string &str)
void ChangeGlsDefinedColor(GlsDefinedColorEnum index, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
Definition: util.h:220
Definition: scoped_ptr.h:53
GlsPropString()
Definition: util.h:1420
bool GetComponentClassNames(const char *dllFileName, DynamicArray< std::string > &nameList, const char *createClassTag="CreateComponent_")
VertexNoColor Vector
Definition: gls_font_base.h:66
DisplayFrame * GetTopLevelDisplayFrame(DisplayFrame *frame)
GlsMatrixAffine< T > FindCoordinateTransformation(const Vector &new_origin, const Vector &new_i, const Vector &new_j, const Vector &new_k)
Definition: util.h:523
bool FindNonColinearVertices(int arraySize, Vector array[], int &index1, int &index2, int &index3, bool isVectorArray=true)
bool GetObjectCoordinatesTransform(DisplayObject *from, DisplayObject *to, GlsMatrixType *outTransform)
int DecodeString(char *dest, const char *src, const int dest_str_length)
bool CalculateTexPointsFromTexCoords(DisplayObject *object)
TextureLoaderList & GetTextureLoaders()
Gets the global list of texture loaders. 
Definition: gls_mutex.h:52
friend bool operator!=(const GlsPropString &str1, const GlsPropString &str2)
Definition: util.h:1462
The disti::Vertex class. A class for manipulating 3D vertices. 
GlsMultiVal(const GlsMultiVal &src)
Definition: util.h:1238
void PushResourcePath(const char *resourcePath)
IGlsStateManager & GetStateManager()
Gets the global state manager instance. 
void Translate(Type x, Type y, Type z)
Definition: gls_matrix_affine.h:198
int gls_unlink(const char *filename)
bool FileExists(const char *filename)
int C_EncodeString(char *dest, const char *src, const int dest_str_length)
static GlsGlobals & Instance()
Singleton instance. 
virtual void StreamIn(istreamType &instr)
Definition: util.h:1353
GlsMultiVal(const T1 &val1, const T2 &val2=T2(), const T3 &val3=T3(), const T4 &val4=T4(), const T5 &val5=T5(), const T6 &val6=T6(), const T7 &val7=T7(), const T8 &val8=T8(), const T9 &val9=T9(), const T10 &val10=T10())
Definition: util.h:1265
FILE * gls_fopen(const char *filename, const char *flags)
bool IsDirectory(const char *filename)
float AngularDistanceDeg(float angle1, float angle2)
std::string FilePath(const std::string &filepath)
Definition: gls_font_man.h:59
bool Equal(T1 x, T2 y, float precision=0.001f)
Definition: util.h:423
char * GetFileName(const char *name)
List_c & GetImageList()
Gets the image list. 
bool NotColinear(const Vector &a, const Vector &b, const Vector &c)
const char * GetFilePath(const char *name)
std::string ResolveRuntimeResourcePath(const char *fileName)
void PushResourceFinder(std::string(*finder)(const std::string &))
A smart pointer with unique ownership – poor man's std::unique_ptr. 
std::string ResolvePath(const char *path)
bool CloseToZero(const X x, const X threshold=X(1e-1))
Definition: util.h:144
friend bool operator==(const GlsPropString &str1, const GlsPropString &str2)
Definition: util.h:1456
Contains the DistiAssert macro. 
Macros and helper code to determine what subset of C++11/14/17 is available. 
void GlsGetOrtho(GlsMatrixType &m, double left, double right, double bottom, double top, double zNear, double zFar)
GlsPropString(const std::string &str)
Definition: util.h:1428
int Safe_fopen(const char *filename, char *flags, FILE **f)
unsigned char * GlsDefinedColor(GlsDefinedColorEnum index)
Definition: util.h:212
Definition: bmpimage.h:46
GlsPropStringQuoted()
Definition: util.h:1492
bool IS_POSITIVE(const X &x)
Definition: util.h:140