#include "externals.hh" #include "utilities.hh" void disableButton( ) { ImGui::PushStyleColor( ImGuiCol_Button , ImVec4( .3 , .3 , .3 , 1 ) ); ImGui::PushStyleColor( ImGuiCol_ButtonHovered , ImVec4( .3 , .3 , .3 , 1 ) ); ImGui::PushStyleColor( ImGuiCol_ButtonActive , ImVec4( .3 , .3 , .3 , 1 ) ); } /*----------------------------------------------------------------------------*/ void updateAngle( float& initial , const float delta ) { initial = fmod( initial + delta + 540 , 360 ) - 180; } void anglesToMatrix( float const* angles , float* matrix ) { float c[3] , s[3]; for ( int i = 0 ; i < 3 ; i ++ ) { const float a = M_PI * angles[ i ] / 180; c[i] = cos( a ); s[i] = sin( a ); } matrix[0] = c[1]*c[2]; matrix[1] = s[0]*s[1]*c[2] - c[0]*s[2]; matrix[2] = s[0]*s[2] + c[0]*s[1]*c[2]; matrix[3] = c[1]*s[2]; matrix[4] = c[0]*c[2] + s[0]*s[1]*s[2]; matrix[5] = c[0]*s[1]*s[2] - s[0]*c[2]; matrix[6] = -s[1]; matrix[7] = s[0]*c[1]; matrix[8] = c[0]*c[1]; } /*----------------------------------------------------------------------------*/ T_String GetAbsolutePath( T_String const& path ) { char* const rp( realpath( (char*) path.toOSString( ).data( ) , nullptr ) ); if ( !rp ) { return {}; } const T_String rv( rp ); free( rp ); return rv; } T_String GetParentPath( T_String const& path ) { auto buffer( path.toOSString( ) ); char* const rp( realpath( dirname( (char*) buffer.data( ) ) , nullptr ) ); if ( !rp ) { return {}; } const T_String rv( rp ); free( rp ); return rv; } /*------------------------------------------------------------------------------*/ bool ImGui::MenuItemCheckbox( char const* name , bool* checked ) { bool rv{ MenuItem( name , "" , *checked , true ) }; if ( rv ) { *checked = !*checked; } return rv; }