Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev-sge
Browse files Browse the repository at this point in the history
  • Loading branch information
sguionni committed Apr 9, 2024
2 parents 88acb9b + 0de92f0 commit 9a18ec8
Show file tree
Hide file tree
Showing 26 changed files with 648 additions and 215 deletions.
593 changes: 525 additions & 68 deletions DOCUMENTATION.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions IconsAuthors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Icons authors :

https://www.flaticon.com/authors/alfredo-hernandez
https://www.flaticon.com/authors/Becris
https://www.flaticon.com/authors/dinosoftlabs
https://www.flaticon.com/authors/freepik
https://www.flaticon.com/authors/good-ware
https://www.flaticon.com/authors/google
https://www.flaticon.com/authors/itim2101
https://www.flaticon.com/authors/kiranshastry
https://www.flaticon.com/authors/mavadee
https://www.flaticon.com/authors/pixel-perfect
https://www.flaticon.com/authors/roundicons
https://www.flaticon.com/authors/tanah-basah
https://www.flaticon.com/authors/tempo-doloe
https://www.flaticon.com/authors/vectors-market
28 changes: 14 additions & 14 deletions lib/app/include/app/component/scene/destroyed.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#ifndef __VTX_APP_COMPONENT_SCENE_TRANSFORM__
#define __VTX_APP_COMPONENT_SCENE_TRANSFORM__

#include "app/ecs/core/base_component.hpp"

namespace VTX::App::Component::Scene
{
class Transform : public ECS::Core::BaseComponent
{
public:
Transform() = default;
};
} // namespace VTX::App::Component::Scene
#endif
// #ifndef __VTX_APP_COMPONENT_SCENE_TRANSFORM__
// #define __VTX_APP_COMPONENT_SCENE_TRANSFORM__
//
// #include "app/ecs/core/base_component.hpp"
//
// namespace VTX::App::Component::Scene
//{
// class Transform : public ECS::Core::BaseComponent
// {
// public:
// Transform() = default;
// };
// } // namespace VTX::App::Component::Scene
// #endif
4 changes: 2 additions & 2 deletions lib/app/include/app/component/scene/enable_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#define __VTX_APP_COMPONENT_SCENE_ENABLE__

#include "app/application/system/ecs_system.hpp"
#include "app/ecs/core/base_component.hpp"
#include "app/core/ecs/base_component.hpp"

namespace VTX::App::Component::Scene
{
class EnableComponent : public ECS::Core::BaseComponent
class EnableComponent : public Core::ECS::BaseComponent
{
private:
inline static Application::System::ECSSystem::ComponentStaticIDRegistration<EnableComponent> registration {
Expand Down
1 change: 1 addition & 0 deletions lib/app/include/app/core/ecs/registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace VTX::App::Core::ECS
Registry() = default;

BaseEntity createEntity() { return BaseEntity( _enttRegistry.create() ); }
void destroyEntity( const BaseEntity p_entity ) { _enttRegistry.destroy( p_entity ); }

template<ECS_Component C>
inline BaseEntity getEntity( const C & p_component ) const
Expand Down
1 change: 0 additions & 1 deletion lib/app/include/app/vtx_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ namespace VTX::App

void start( const std::vector<std::string> & );
void update( const float p_elapsedTime = 0 );
void goToState( const std::string &, void * const = nullptr );
void stop();

inline const Core::System::SystemHandler & getSystemHandler() const { return *_systemHandlerPtr; };
Expand Down
48 changes: 0 additions & 48 deletions lib/app/src/app/vtx_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,40 +57,11 @@ namespace VTX::App

// Regsiter loop events
onUpdate += []( const float p_elapsedTime ) { SCENE().update( p_elapsedTime ); };

onPostUpdate += []( const float p_elapsedTime ) { THREADING().lateUpdate(); };

// Event manager - Useless: nothing is delayed.
//_updateCallback.addCallback(
// this, []( const float p_elapsedTime ) { Event::EventManager::get().update( p_elapsedTime ); }
//);

// Useless while delayed actions are disabled
//_updateCallback.addCallback( this, []( const float p_elapsedTime ) { VTX_ACTION().update( p_elapsedTime );
//}
//);

// TODO: use camera callbacks.
//_preRenderCallback.addCallback( this, [ this ]( const float p_elapsedTime ) { _applyCameraUniforms(); } );
//_renderCallback.addCallback(
// this, [ this ]( const float p_elapsedTime ) { _renderer->render( p_elapsedTime ); }
//);

_tickChrono.start();

_handleArgs( p_args );

#ifndef VTX_PRODUCTION
if ( p_args.size() == 0 )
{
// VTX_ACTION(
// new Action::Main::Open( Internal::IO::Filesystem::getDataPath( FilePath( "4hhb.pdb" )
//).absolute() ) );
// VTX_ACTION( new Action::Main::OpenApi( "1aon" ) );
// VTX_ACTION( new Action::Main::OpenApi( "4hhb" ) );
// VTX_ACTION( new Action::Main::OpenApi( "1aga" ) );
}
#endif
}

void VTXApp::update( const float p_elapsedTime )
Expand Down Expand Up @@ -185,27 +156,8 @@ namespace VTX::App
// VTX::MVC_MANAGER().deleteModel( _renderEffectLibrary );

// Old::Application::Selection::SelectionManager::get().deleteModel();

// if ( _scene != nullptr )
//{
// delete _scene;
// }
}

void VTXApp::goToState( const std::string & p_name, void * const p_arg ) {}

// void VTXApp::deleteAtEndOfFrame( const Component::Generic::BaseAutoDelete * const p_object )
//{
// _deleteAtEndOfFrameObjects.emplace_back( p_object );
// }
// void VTXApp::_applyEndOfFrameDeletes()
//{
// for ( const Component::Generic::BaseAutoDelete * const p_object : _deleteAtEndOfFrameObjects )
// p_object->autoDelete();

// _deleteAtEndOfFrameObjects.clear();
//}

Application::Scene & VTXApp::getScene() { return _systemHandlerPtr->get<Application::Scene>( SCENE_KEY ); }
const Application::Scene & VTXApp::getScene() const
{
Expand Down
32 changes: 6 additions & 26 deletions lib/core/src/core/chemdb/residue.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
#include "core/chemdb/residue.hpp"
#include <algorithm>
#include <util/enum.hpp>
#include <optional>
#include <util/enum.hpp>
#include <util/string.hpp>

namespace VTX::Core::ChemDB::Residue
{

const SYMBOL getSymbolFromShortName( const std::string & p_residueName )
{
std::string upcasedName = std::string( p_residueName.begin(), p_residueName.end() );

// Upcase residue name
std::transform(
p_residueName.begin(),
p_residueName.end(),
upcasedName.begin(),
[]( unsigned char c ) { return std::toupper( c ); }
);
std::string upcasedName = Util::String::toUpper( p_residueName );

for ( int i = 0; i < int( SYMBOL::COUNT ); i++ )
{
Expand All @@ -29,15 +23,7 @@ namespace VTX::Core::ChemDB::Residue

const SYMBOL getSymbolFromName( const std::string & p_residueName )
{
std::string upcasedName = std::string( p_residueName.begin(), p_residueName.end() );

// Upcase residue name
std::transform(
p_residueName.begin(),
p_residueName.end(),
upcasedName.begin(),
[]( unsigned char c ) { return std::toupper( c ); }
);
std::string upcasedName = Util::String::toUpper( p_residueName );

// Convert name
const std::optional symbol = magic_enum::enum_cast<ChemDB::Residue::SYMBOL>( upcasedName );
Expand All @@ -49,7 +35,7 @@ namespace VTX::Core::ChemDB::Residue
std::string formattedName = std::string( p_residueName.begin(), p_residueName.end() );
formattedName[ 0 ] = std::toupper( formattedName[ 0 ] );

// Upcase residue name
// Downcase residue name
std::transform(
++p_residueName.begin(),
p_residueName.end(),
Expand Down Expand Up @@ -90,13 +76,7 @@ namespace VTX::Core::ChemDB::Residue

bool checkIfStandardFromName( const std::string & p_residueSymbol )
{
std::string residueSymbol = p_residueSymbol;
std::transform(
residueSymbol.begin(),
residueSymbol.end(),
residueSymbol.begin(),
[]( unsigned char c ) { return std::toupper( c ); }
);
const std::string residueSymbol = Util::String::toUpper( p_residueSymbol );

return std::find(
std::begin( ChemDB::Residue::SYMBOL_STR ), std::end( ChemDB::Residue::SYMBOL_STR ), residueSymbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace VTX::PythonBinding::Wrapper
{
// Manage Pybind11 "Extra" arguments
class Pybind11ExtraConvertor
{
public:
Expand Down
4 changes: 0 additions & 4 deletions lib/ui/include/ui/qt/application_qt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@

namespace VTX::UI::QT
{
namespace State
{
class StateMachine;
}
class MainWindow;

class ApplicationQt : public Core::BaseUIApplication, public QApplication
Expand Down
17 changes: 0 additions & 17 deletions lib/ui/include/ui/qt/main_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <QDockWidget>
#include <QKeySequence>
#include <QMainWindow>
#include <QShortcut>
#include <unordered_set>
#include <util/types.hpp>

Expand Down Expand Up @@ -47,20 +46,6 @@ namespace VTX::UI::QT
QT::Widget::MainMenu::MenuTooltabWidget & getMainMenuToolTab( const Core::ToolLayoutData & layoutData );
QT::Widget::MainMenu::MenuToolBlockWidget & getMainMenuToolBlock( const Core::ToolLayoutData & layoutData );

void addShortcut( const std::string & p_shortcut, QAction * const p_action );

template<typename Obj, typename Func>
void addShortcut( const std::string & p_shortcut, Obj p_obj, Func p_func )
{
assert( _shortcuts.find( p_shortcut ) == _shortcuts.end() );

connect(
new QShortcut( QKeySequence( tr( p_shortcut.c_str() ) ), this ), &QShortcut::activated, p_obj, p_func
);

_shortcuts.emplace( p_shortcut );
}

Core::WindowMode getWindowMode();
void setWindowMode( const Core::WindowMode & p_mode );
void toggleWindowState();
Expand Down Expand Up @@ -101,8 +86,6 @@ namespace VTX::UI::QT
private:
QT::Widget::MainMenu::MainMenuBar * _mainMenuBar = nullptr;

std::unordered_set<std::string> _shortcuts = std::unordered_set<std::string>();

// Actions.
void _onDockWindowVisibilityChange( bool p_visible );

Expand Down
16 changes: 0 additions & 16 deletions lib/ui/src/ui/qt/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,6 @@ namespace VTX::UI::QT
);
}

void MainWindow::addShortcut( const std::string & p_shortcut, QAction * const p_action )
{
assert( _shortcuts.find( p_shortcut ) == _shortcuts.end() );

p_action->setParent( this );

connect(
new QShortcut( QKeySequence( tr( p_shortcut.c_str() ) ), this ),
&QShortcut::activated,
p_action,
&QAction::trigger
);

_shortcuts.emplace( p_shortcut );
}

void MainWindow::_loadStyleSheet( const char * p_stylesheetPath )
{
QFile stylesheetFile( p_stylesheetPath );
Expand Down
11 changes: 11 additions & 0 deletions lib/util/include/util/algorithm/range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace VTX::Util::Algorithm::Range
template<std::integral T>
using RangeList = Math::RangeList<T>;

// Merge two RangeList and return the result
template<std::integral T>
RangeList<T> merge( const RangeList<T> & p_lhs, const RangeList<T> & p_rhs )
{
Expand All @@ -26,6 +27,8 @@ namespace VTX::Util::Algorithm::Range

return res;
}

// Merge RangeList p_other directly in p_obj
template<std::integral T>
void mergeInSitu( RangeList<T> & p_obj, const RangeList<T> & p_other )
{
Expand All @@ -36,6 +39,7 @@ namespace VTX::Util::Algorithm::Range
}
}

// Substract RangeList p_rhs to p_lhs and return the result
template<std::integral T>
RangeList<T> substract( const RangeList<T> & p_lhs, const RangeList<T> & p_rhs )
{
Expand All @@ -49,6 +53,7 @@ namespace VTX::Util::Algorithm::Range

return res;
}
// Substract directly RangeList p_other from p_obj
template<std::integral T>
void substractInSitu( RangeList<T> & p_obj, const RangeList<T> & p_other )
{
Expand All @@ -59,6 +64,7 @@ namespace VTX::Util::Algorithm::Range
}
}

// Return intersection between two RangeList (items which are in p_lhs and in p_rhs )
template<std::integral T>
RangeList<T> intersect( const RangeList<T> & p_lhs, const RangeList<T> & p_rhs )
{
Expand Down Expand Up @@ -103,24 +109,29 @@ namespace VTX::Util::Algorithm::Range
return RangeList<T>( newRange );
}

// Set p_obj as the intersection between itself and p_other
template<std::integral T>
void intersectInSitu( RangeList<T> & p_obj, const RangeList<T> & p_other )
{
p_obj = intersect( p_obj, p_other );
}

// Return exclusive between two RangeList (items which are in p_lhs but not in p_rhs and items which are in p_rhs
// but not in p_lhs )
template<std::integral T>
Math::RangeList<T> exclusive( const Math::RangeList<T> & p_lhs, const Math::RangeList<T> & p_rhs )
{
return Details::Range::Exclusive( p_lhs, p_rhs ).getRes();
}

// Set p_obj as the exclusive between itself and p_other
template<std::integral T>
void exclusiveInSitu( RangeList<T> & p_obj, const RangeList<T> & p_other )
{
p_obj = Details::Range::Exclusive( p_obj, p_other ).getRes();
}

// Generate a RangeList of index from any container following a predicate on its items
template<Container C, std::predicate<typename C::value_type> Predicate>
RangeList<typename C::size_type> generateIndexRangeList( const C & p_container, const Predicate & p_predicate )
{
Expand Down
1 change: 1 addition & 0 deletions lib/util/include/util/concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ namespace VTX
// https://en.cppreference.com/w/cpp/container/vector_bool
|| std::same_as<ContainerType, std::vector<bool>>;

// Concept to template any container of ValueType
template<typename ContainerType, typename ValueType>
concept ContainerOfType = requires( ContainerType p_container ) {
requires Container<ContainerType>;
Expand Down
3 changes: 3 additions & 0 deletions lib/util/include/util/enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@

namespace VTX::Util::Enum
{
// Get name of an enum
template<EnumConcept E>
inline constexpr std::string_view enumName( const E & p_enum )
{
return magic_enum::enum_name( p_enum );
}

// Get an enum from its name
template<EnumConcept E>
inline constexpr E enumCast( const std::string & p_name )
{
Expand Down Expand Up @@ -45,6 +47,7 @@ namespace VTX::Util::Enum
return magic_enum::enum_value<E>( p_index );
}

// Cast an enum to an other enum using it's name
template<EnumConcept E1, EnumConcept E2>
inline constexpr E2 enumToAnother( const E1 & p_enum )
{
Expand Down
Loading

0 comments on commit 9a18ec8

Please sign in to comment.