#pragma once #include "ui-mousectrl.hh" /*= UI UTILITIES =============================================================*/ namespace ImGui { // Disable next ImGui controls void PushDisabled( ) noexcept; // Re-enable ImGui buttons void PopDisabled( ) noexcept; /*--------------------------------------------------------------------*/ // Display a menu item with a checkbox bool MenuItemCheckbox( char const* name , bool* checked ) noexcept; /*--------------------------------------------------------------------*/ // Display a separator for the toolbar void ToolbarSeparator( ) noexcept; // Display a toolbar button bool ToolbarButton( char const* const string , ImVec2 const& size , char const* const tooltip = nullptr , bool enabled = true ) noexcept; } // namespace ImGui /*----------------------------------------------------------------------------*/ #define GL_CHECK( FAIL ) \ do { \ auto err_( glGetError( ) ); \ if ( err_ != GL_NO_ERROR ) FAIL; \ } while ( 0 ) #define GL_ASSERT( ) \ GL_CHECK({ \ fprintf( stderr , "GL error %x in %s:%d\n" , \ err_ , __FILE__ , __LINE__ ); \ abort( ); \ }) /*= CAMERA ===================================================================*/ struct T_Camera; struct T_CameraMouseControl : public A_MouseCtrl { T_Camera& camera; explicit T_CameraMouseControl( T_Camera& cam ) : camera( cam ) {} void handleDragAndDrop( ImVec2 const& move , T_KeyboardModifiers modifiers , T_MouseButtons buttons ) noexcept override; void handleWheel( float wheel , T_KeyboardModifiers modifiers , T_MouseButtons buttons ) noexcept override; }; enum class E_CameraChange { FOV , MATRIX }; using T_CameraChanges = T_Flags< E_CameraChange >; T_CameraChanges CameraUI( T_Camera& camera ) noexcept;