diff --git a/lib/app/include/app/component/chemistry/trajectory.hpp b/lib/app/include/app/component/chemistry/trajectory.hpp index 619267246..456a20abe 100644 --- a/lib/app/include/app/component/chemistry/trajectory.hpp +++ b/lib/app/include/app/component/chemistry/trajectory.hpp @@ -5,6 +5,7 @@ #include "app/application/system/ecs_system.hpp" #include "app/core/trajectory_player/base_player.hpp" #include "enum_trajectory.hpp" +#include namespace VTX::App::Component::Chemistry { @@ -23,11 +24,15 @@ namespace VTX::App::Component::Chemistry Molecule * const getMoleculePtr() const { return _moleculePtr; } size_t getCurrentFrame() const; + void setCurrentFrame( const size_t p_frameIndex ); + size_t getFrameCount() const; App::Core::TrajectoryPlayer::BasePlayer & getPlayer() const { return *_player; } void setPlayer( std::unique_ptr & p_player ); + Util::Callback onFrameChange; + private: void _update( const float p_deltaTime ); void _referenceUpdateFunction(); diff --git a/lib/app/include/app/component/render/proxy_molecule.hpp b/lib/app/include/app/component/render/proxy_molecule.hpp index f912a5bfd..7eea5656b 100644 --- a/lib/app/include/app/component/render/proxy_molecule.hpp +++ b/lib/app/include/app/component/render/proxy_molecule.hpp @@ -37,6 +37,7 @@ namespace VTX::App::Component::Render void _applyVisibilityCallbacks(); void _applySelectionCallbacks() const; + void _applyAtomPositionCallbacks() const; std::unique_ptr _proxyPtr = nullptr; }; diff --git a/lib/app/include/app/core/trajectory_player/base_player.hpp b/lib/app/include/app/core/trajectory_player/base_player.hpp index 70fe59873..1cf7fa49d 100644 --- a/lib/app/include/app/core/trajectory_player/base_player.hpp +++ b/lib/app/include/app/core/trajectory_player/base_player.hpp @@ -1,10 +1,11 @@ #ifndef __VTX_APP_CORE_TRAJECTORY_PLAYER_BASE_PLAYER__ #define __VTX_APP_CORE_TRAJECTORY_PLAYER_BASE_PLAYER__ +#include "app/component/chemistry/_fwd.hpp" #include "app/core/collection.hpp" -#include #include #include +#include #include namespace VTX::App::Core::TrajectoryPlayer @@ -14,16 +15,14 @@ namespace VTX::App::Core::TrajectoryPlayer public: BasePlayer() = default; BasePlayer( const BasePlayer & p_source ) = default; - BasePlayer( VTX::Core::Struct::Trajectory * const p_trajectory ) : _trajectoryPtr( p_trajectory ) {} virtual ~BasePlayer() = default; - bool isLinkedToTrajectory() const { return _trajectoryPtr != nullptr; } - void setTrajectory( VTX::Core::Struct::Trajectory & p_trajectory ); + size_t getCount() const { return _count; } + void setCount( const size_t p_count ); - size_t getCurrentFrameIndex() const; - void setCurrentFrameIndex( const size_t p_frameIndex ); - size_t getFrameCount() const; + size_t getCurrent() const; + void setCurrent( const size_t p_frameIndex ); virtual void play(); virtual void pause(); @@ -43,8 +42,15 @@ namespace VTX::App::Core::TrajectoryPlayer virtual const std::string & getDisplayName() const = 0; virtual const CollectionKey & getCollectionKey() const = 0; + Util::Callback<> onPlay; + Util::Callback<> onPause; + Util::Callback<> onStop; + Util::Callback onFrameChange; + Util::Callback onFPSChange; + private: - VTX::Core::Struct::Trajectory * _trajectoryPtr = nullptr; + size_t _count = 0; + size_t _current = 0; bool _isPlaying = true; uint _fps = 1u; diff --git a/lib/app/include/app/core/trajectory_player/loop.hpp b/lib/app/include/app/core/trajectory_player/loop.hpp index fdae70faa..27ad1d275 100644 --- a/lib/app/include/app/core/trajectory_player/loop.hpp +++ b/lib/app/include/app/core/trajectory_player/loop.hpp @@ -1,9 +1,7 @@ #ifndef __VTX_APP_CORE_TRAJECTORY_PLAYER_LOOP__ #define __VTX_APP_CORE_TRAJECTORY_PLAYER_LOOP__ -#include "app/core/collection.hpp" #include "base_player.hpp" -#include "ping_pong.hpp" #include "players.hpp" namespace VTX::App::Core::TrajectoryPlayer @@ -20,7 +18,6 @@ namespace VTX::App::Core::TrajectoryPlayer public: Loop() = default; Loop( const Loop & p_source ) = default; - Loop( VTX::Core::Struct::Trajectory * const p_trajectory ); const std::string & getDisplayName() const override { return DISPLAYED_NAME; } const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; } diff --git a/lib/app/include/app/core/trajectory_player/once.hpp b/lib/app/include/app/core/trajectory_player/once.hpp index 31ca90fcd..ed9eca589 100644 --- a/lib/app/include/app/core/trajectory_player/once.hpp +++ b/lib/app/include/app/core/trajectory_player/once.hpp @@ -3,7 +3,6 @@ #include "base_player.hpp" #include "players.hpp" -#include namespace VTX::App::Core::TrajectoryPlayer { @@ -19,7 +18,6 @@ namespace VTX::App::Core::TrajectoryPlayer public: Once() = default; Once( const Once & p_source ) = default; - Once( VTX::Core::Struct::Trajectory * const p_trajectory ); const std::string & getDisplayName() const override { return DISPLAYED_NAME; } const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; } diff --git a/lib/app/include/app/core/trajectory_player/ping_pong.hpp b/lib/app/include/app/core/trajectory_player/ping_pong.hpp index 33b9de475..abdc2708b 100644 --- a/lib/app/include/app/core/trajectory_player/ping_pong.hpp +++ b/lib/app/include/app/core/trajectory_player/ping_pong.hpp @@ -3,7 +3,6 @@ #include "base_player.hpp" #include "players.hpp" -#include namespace VTX::App::Core::TrajectoryPlayer { @@ -19,7 +18,6 @@ namespace VTX::App::Core::TrajectoryPlayer public: PingPong() = default; PingPong( const PingPong & p_source ) = default; - PingPong( VTX::Core::Struct::Trajectory * const p_trajectory ); const std::string & getDisplayName() const override { return DISPLAYED_NAME; } const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; } diff --git a/lib/app/include/app/core/trajectory_player/revert_loop.hpp b/lib/app/include/app/core/trajectory_player/revert_loop.hpp index cf2abbaa7..2cff1700a 100644 --- a/lib/app/include/app/core/trajectory_player/revert_loop.hpp +++ b/lib/app/include/app/core/trajectory_player/revert_loop.hpp @@ -3,7 +3,6 @@ #include "base_player.hpp" #include "players.hpp" -#include namespace VTX::App::Core::TrajectoryPlayer { @@ -19,7 +18,6 @@ namespace VTX::App::Core::TrajectoryPlayer public: RevertLoop() = default; RevertLoop( const RevertLoop & p_source ) = default; - RevertLoop( VTX::Core::Struct::Trajectory * const p_trajectory ); const std::string & getDisplayName() const override { return DISPLAYED_NAME; } const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; } diff --git a/lib/app/include/app/core/trajectory_player/revert_once.hpp b/lib/app/include/app/core/trajectory_player/revert_once.hpp index 8d46edfb3..5ba1520c1 100644 --- a/lib/app/include/app/core/trajectory_player/revert_once.hpp +++ b/lib/app/include/app/core/trajectory_player/revert_once.hpp @@ -3,7 +3,6 @@ #include "base_player.hpp" #include "players.hpp" -#include namespace VTX::App::Core::TrajectoryPlayer { @@ -19,7 +18,6 @@ namespace VTX::App::Core::TrajectoryPlayer public: RevertOnce() = default; RevertOnce( const RevertOnce & p_source ) = default; - RevertOnce( VTX::Core::Struct::Trajectory * const p_trajectory ); const std::string & getDisplayName() const override { return DISPLAYED_NAME; } const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; } diff --git a/lib/app/include/app/core/trajectory_player/stop.hpp b/lib/app/include/app/core/trajectory_player/stop.hpp index 759f347fb..b58694a18 100644 --- a/lib/app/include/app/core/trajectory_player/stop.hpp +++ b/lib/app/include/app/core/trajectory_player/stop.hpp @@ -3,7 +3,6 @@ #include "base_player.hpp" #include "players.hpp" -#include namespace VTX::App::Core::TrajectoryPlayer { @@ -19,7 +18,6 @@ namespace VTX::App::Core::TrajectoryPlayer public: Stop(); Stop( const Stop & p_source ); - Stop( VTX::Core::Struct::Trajectory * const p_trajectory ); void play() override; diff --git a/lib/app/src/app/component/chemistry/trajectory.cpp b/lib/app/src/app/component/chemistry/trajectory.cpp index 4dffe2e51..eb404d7ad 100644 --- a/lib/app/src/app/component/chemistry/trajectory.cpp +++ b/lib/app/src/app/component/chemistry/trajectory.cpp @@ -14,19 +14,28 @@ namespace VTX::App::Component::Chemistry Trajectory::Trajectory( Molecule * const p_molecule ) : _moleculePtr( p_molecule ) { _referenceUpdateFunction(); } - size_t Trajectory::getCurrentFrame() const + size_t Trajectory::getCurrentFrame() const { return _moleculePtr->getTrajectory().currentFrameIndex; } + void Trajectory::setCurrentFrame( const size_t p_frameIndex ) { - return _moleculePtr->getMoleculeStruct().trajectory.currentFrameIndex; + _moleculePtr->getTrajectory().currentFrameIndex = p_frameIndex; } - size_t Trajectory::getFrameCount() const { return _moleculePtr->getMoleculeStruct().trajectory.frames.size(); } + size_t Trajectory::getFrameCount() const { return _moleculePtr->getTrajectory().frames.size(); } void Trajectory::setPlayer( std::unique_ptr & p_player ) { const bool resetPlayer = _player == nullptr; + onFrameChange.clear(); + _player = std::move( p_player ); - _player->setTrajectory( _moleculePtr->getTrajectory() ); + _player->setCount( _moleculePtr->getTrajectory().getFrameCount() ); + + _player->onFrameChange += [ this ]( const size_t p_frameIndex ) + { + _moleculePtr->getTrajectory().currentFrameIndex = p_frameIndex; + onFrameChange( p_frameIndex ); + }; if ( resetPlayer ) _player->reset(); diff --git a/lib/app/src/app/component/render/proxy_molecule.cpp b/lib/app/src/app/component/render/proxy_molecule.cpp index 59b9af9ca..1db23257e 100644 --- a/lib/app/src/app/component/render/proxy_molecule.cpp +++ b/lib/app/src/app/component/render/proxy_molecule.cpp @@ -3,6 +3,7 @@ #include "app/application/selection/selection.hpp" #include "app/application/selection/selection_manager.hpp" #include "app/application/system/ecs_system.hpp" +#include "app/component/chemistry/trajectory.hpp" #include "app/component/scene/transform_component.hpp" #include #include @@ -63,6 +64,7 @@ namespace VTX::App::Component::Render { _applyVisibilityCallbacks(); _applySelectionCallbacks(); + _applyAtomPositionCallbacks(); } std::vector ProxyMolecule::_generateAtomColors( const VTX::Core::Struct::Molecule & p_molStruct ) const @@ -169,5 +171,22 @@ namespace VTX::App::Component::Render _proxyPtr->onAtomSelections( castedSelectionData.getAtomIds(), false ); }; } + void ProxyMolecule::_applyAtomPositionCallbacks() const + { + if ( MAIN_REGISTRY().hasComponent( *this ) ) + { + Component::Chemistry::Trajectory & trajectoryComponent + = MAIN_REGISTRY().getComponent( *this ); + + trajectoryComponent.onFrameChange += [ this ]( const size_t p_frameIndex ) + { + Component::Chemistry::Molecule & moleculeComponent + = MAIN_REGISTRY().getComponent( *this ); + + _proxyPtr->atomPositions = &moleculeComponent.getTrajectory().getCurrentFrame(); + _proxyPtr->onAtomPositions(); + }; + } + } } // namespace VTX::App::Component::Render diff --git a/lib/app/src/app/core/trajectory_player/base_player.cpp b/lib/app/src/app/core/trajectory_player/base_player.cpp index 5f7afe094..bc5be9c39 100644 --- a/lib/app/src/app/core/trajectory_player/base_player.cpp +++ b/lib/app/src/app/core/trajectory_player/base_player.cpp @@ -1,32 +1,44 @@ #include "app/core/trajectory_player/base_player.hpp" -#include +#include namespace VTX::App::Core::TrajectoryPlayer { - void BasePlayer::setTrajectory( VTX::Core::Struct::Trajectory & p_trajectory ) { _trajectoryPtr = &p_trajectory; } + void BasePlayer::setCount( const size_t p_count ) + { + _count = p_count; - size_t BasePlayer::getCurrentFrameIndex() const + if ( _current >= p_count ) + { + _current = p_count - 1; + onFrameChange( _current ); + } + } + + size_t BasePlayer::getCurrent() const { return _current; } + void BasePlayer::setCurrent( const size_t p_frameIndex ) { - assert( isLinkedToTrajectory() ); - return _trajectoryPtr->currentFrameIndex; + if ( _current = p_frameIndex ) + { + _current = p_frameIndex; + onFrameChange( p_frameIndex ); + } } - void BasePlayer::setCurrentFrameIndex( const size_t p_frameIndex ) + + void BasePlayer::play() { - assert( isLinkedToTrajectory() ); - _trajectoryPtr->currentFrameIndex = p_frameIndex; + _isPlaying = true; + onPlay(); } - size_t BasePlayer::getFrameCount() const + void BasePlayer::pause() { - assert( isLinkedToTrajectory() ); - return _trajectoryPtr->frames.size(); + _isPlaying = false; + onPause(); } - - void BasePlayer::play() { _isPlaying = true; } - void BasePlayer::pause() { _isPlaying = false; } void BasePlayer::stop() { - pause(); + _isPlaying = false; reset(); + onStop(); } void BasePlayer::update( const float p_deltaTime ) @@ -42,22 +54,29 @@ namespace VTX::App::Core::TrajectoryPlayer } else { - const size_t currentFrameIndex = getCurrentFrameIndex(); - size_t nextFrameIndex = currentFrameIndex; + const size_t previousCurrent = _current; + size_t nextIndex = _current; const float offset = 1.f / float( _fps ); while ( _trajectoryTimer >= offset ) { - nextFrameIndex++; + nextIndex++; _trajectoryTimer -= offset; } - if ( nextFrameIndex != currentFrameIndex ) + if ( nextIndex != previousCurrent ) { - nextFrame( nextFrameIndex - currentFrameIndex ); + nextFrame( nextIndex - previousCurrent ); } } } - void BasePlayer::setFPS( const uint p_fps ) { _fps = p_fps; } + void BasePlayer::setFPS( const uint p_fps ) + { + if ( _fps != p_fps ) + { + _fps = p_fps; + onFPSChange( p_fps ); + } + } } // namespace VTX::App::Core::TrajectoryPlayer diff --git a/lib/app/src/app/core/trajectory_player/loop.cpp b/lib/app/src/app/core/trajectory_player/loop.cpp index 8d07852bd..52dd6c2a9 100644 --- a/lib/app/src/app/core/trajectory_player/loop.cpp +++ b/lib/app/src/app/core/trajectory_player/loop.cpp @@ -2,13 +2,11 @@ namespace VTX::App::Core::TrajectoryPlayer { - Loop::Loop( VTX::Core::Struct::Trajectory * const p_trajectory ) : BasePlayer( p_trajectory ) {} - - void Loop::reset() { setCurrentFrameIndex( 0 ); } - void Loop::nextFrame( const size_t p_frameCount ) + void Loop::reset() { setCurrent( 0 ); } + void Loop::nextFrame( const size_t p_count ) { - const size_t newFrameIndex = ( getCurrentFrameIndex() + p_frameCount ) % getFrameCount(); - setCurrentFrameIndex( newFrameIndex ); + const size_t newFrameIndex = ( getCurrent() + p_count ) % getCount(); + setCurrent( newFrameIndex ); } } // namespace VTX::App::Core::TrajectoryPlayer diff --git a/lib/app/src/app/core/trajectory_player/once.cpp b/lib/app/src/app/core/trajectory_player/once.cpp index ac912f0a1..a36e3192e 100644 --- a/lib/app/src/app/core/trajectory_player/once.cpp +++ b/lib/app/src/app/core/trajectory_player/once.cpp @@ -2,20 +2,18 @@ namespace VTX::App::Core::TrajectoryPlayer { - Once::Once( VTX::Core::Struct::Trajectory * const p_trajectory ) : BasePlayer( p_trajectory ) {} - - void Once::reset() { setCurrentFrameIndex( 0 ); } - void Once::nextFrame( const size_t p_frameCount ) + void Once::reset() { setCurrent( 0 ); } + void Once::nextFrame( const size_t p_count ) { - const size_t newFrameIndex = getCurrentFrameIndex() + p_frameCount; + const size_t newFrameIndex = getCurrent() + p_count; - if ( newFrameIndex < getFrameCount() - 1 ) + if ( newFrameIndex < getCount() - 1 ) { - setCurrentFrameIndex( newFrameIndex ); + setCurrent( newFrameIndex ); } else { - setCurrentFrameIndex( getFrameCount() - 1 ); + setCurrent( getCount() - 1 ); pause(); } } diff --git a/lib/app/src/app/core/trajectory_player/ping_pong.cpp b/lib/app/src/app/core/trajectory_player/ping_pong.cpp index b7a8e9e86..d5597c718 100644 --- a/lib/app/src/app/core/trajectory_player/ping_pong.cpp +++ b/lib/app/src/app/core/trajectory_player/ping_pong.cpp @@ -2,40 +2,38 @@ namespace VTX::App::Core::TrajectoryPlayer { - PingPong::PingPong( VTX::Core::Struct::Trajectory * const p_trajectory ) : BasePlayer( p_trajectory ) {} - void PingPong::reset() { - setCurrentFrameIndex( 0 ); + setCurrent( 0 ); _forward = true; } - void PingPong::nextFrame( const size_t p_frameCount ) + void PingPong::nextFrame( const size_t p_count ) { - size_t newFrameIndex = getCurrentFrameIndex(); + size_t newFrameIndex = getCurrent(); if ( _forward ) { - newFrameIndex += p_frameCount; + newFrameIndex += p_count; } else { - if ( newFrameIndex < p_frameCount ) + if ( newFrameIndex < p_count ) { - newFrameIndex = p_frameCount - newFrameIndex; + newFrameIndex = p_count - newFrameIndex; _forward = !_forward; } else { - newFrameIndex -= p_frameCount; + newFrameIndex -= p_count; } } // Here forward always true - if ( newFrameIndex >= getFrameCount() ) + if ( newFrameIndex >= getCount() ) { - const size_t roundCount = newFrameIndex / getFrameCount(); - const size_t modulo = newFrameIndex % ( getFrameCount() - 1 ); + const size_t roundCount = newFrameIndex / getCount(); + const size_t modulo = newFrameIndex % ( getCount() - 1 ); _forward = ( roundCount % 2 == 0 ); @@ -45,10 +43,10 @@ namespace VTX::App::Core::TrajectoryPlayer } else { - newFrameIndex = ( getFrameCount() - 1 ) - modulo; + newFrameIndex = ( getCount() - 1 ) - modulo; } } - setCurrentFrameIndex( newFrameIndex ); + setCurrent( newFrameIndex ); } } // namespace VTX::App::Core::TrajectoryPlayer diff --git a/lib/app/src/app/core/trajectory_player/revert_loop.cpp b/lib/app/src/app/core/trajectory_player/revert_loop.cpp index e207cfd9f..d2e082d8f 100644 --- a/lib/app/src/app/core/trajectory_player/revert_loop.cpp +++ b/lib/app/src/app/core/trajectory_player/revert_loop.cpp @@ -2,20 +2,17 @@ namespace VTX::App::Core::TrajectoryPlayer { - RevertLoop::RevertLoop( VTX::Core::Struct::Trajectory * const p_trajectory ) : BasePlayer( p_trajectory ) {} - - void RevertLoop::reset() { setCurrentFrameIndex( getFrameCount() - 1 ); } - void RevertLoop::nextFrame( const size_t p_frameCount ) + void RevertLoop::reset() { setCurrent( getCount() - 1 ); } + void RevertLoop::nextFrame( const size_t p_count ) { - if ( p_frameCount > getCurrentFrameIndex() ) + if ( p_count > getCurrent() ) { - const size_t newFrameIndex - = getFrameCount() - ( ( p_frameCount - getCurrentFrameIndex() ) % getFrameCount() ); - setCurrentFrameIndex( newFrameIndex ); + const size_t newFrameIndex = getCount() - ( ( p_count - getCurrent() ) % getCount() ); + setCurrent( newFrameIndex ); } else { - setCurrentFrameIndex( getCurrentFrameIndex() - p_frameCount ); + setCurrent( getCurrent() - p_count ); } } diff --git a/lib/app/src/app/core/trajectory_player/revert_once.cpp b/lib/app/src/app/core/trajectory_player/revert_once.cpp index 49d549507..4317c98bc 100644 --- a/lib/app/src/app/core/trajectory_player/revert_once.cpp +++ b/lib/app/src/app/core/trajectory_player/revert_once.cpp @@ -2,19 +2,17 @@ namespace VTX::App::Core::TrajectoryPlayer { - RevertOnce::RevertOnce( VTX::Core::Struct::Trajectory * const p_trajectory ) : BasePlayer( p_trajectory ) {} - - void RevertOnce::reset() { setCurrentFrameIndex( getFrameCount() - 1 ); } + void RevertOnce::reset() { setCurrent( getCount() - 1 ); } void RevertOnce::nextFrame( const size_t p_frameCount ) { - if ( p_frameCount >= getCurrentFrameIndex() ) + if ( p_frameCount >= getCurrent() ) { - setCurrentFrameIndex( 0 ); + setCurrent( 0 ); pause(); } else { - setCurrentFrameIndex( getCurrentFrameIndex() - p_frameCount ); + setCurrent( getCurrent() - p_frameCount ); } } diff --git a/lib/app/src/app/core/trajectory_player/stop.cpp b/lib/app/src/app/core/trajectory_player/stop.cpp index 537cac678..65fc69409 100644 --- a/lib/app/src/app/core/trajectory_player/stop.cpp +++ b/lib/app/src/app/core/trajectory_player/stop.cpp @@ -4,15 +4,10 @@ namespace VTX::App::Core::TrajectoryPlayer { Stop::Stop() : BasePlayer() { pause(); } Stop::Stop( const Stop & p_source ) : BasePlayer( p_source ) { pause(); } - Stop::Stop( VTX::Core::Struct::Trajectory * const p_trajectory ) : BasePlayer( p_trajectory ) { pause(); } void Stop::play() {} - void Stop::reset() - { - if ( isLinkedToTrajectory() ) - setCurrentFrameIndex( 0 ); - } + void Stop::reset() { setCurrent( 0 ); } void Stop::nextFrame( const size_t p_frameCount ) {} } // namespace VTX::App::Core::TrajectoryPlayer diff --git a/lib/app/src/app/internal/serialization/app_serializers.cpp b/lib/app/src/app/internal/serialization/app_serializers.cpp index 922d94fa6..c916d76eb 100644 --- a/lib/app/src/app/internal/serialization/app_serializers.cpp +++ b/lib/app/src/app/internal/serialization/app_serializers.cpp @@ -74,13 +74,15 @@ namespace VTX::App::Internal::Serialization // TrajectoryPlayers Util::JSon::Object serialize( const App::Core::TrajectoryPlayer::BasePlayer & p_player ) { - return { { "CURRENT_FRAME", p_player.getCurrentFrameIndex() }, + return { { "COUNT", p_player.getCount() }, + { "CURRENT", p_player.getCurrent() }, { "FPS", p_player.getFPS() }, { "IS_PLAYING", p_player.isPlaying() } }; } void deserialize( const Util::JSon::Object & p_json, App::Core::TrajectoryPlayer::BasePlayer & p_player ) { - p_player.setCurrentFrameIndex( SERIALIZER().deserializeField( p_json, "CURRENT_FRAME" ) ); + p_player.setCount( SERIALIZER().deserializeField( p_json, "COUNT" ) ); + p_player.setCurrent( SERIALIZER().deserializeField( p_json, "CURRENT" ) ); p_player.setFPS( SERIALIZER().deserializeField( p_json, "FPS" ) ); if ( SERIALIZER().deserializeField( p_json, "IS_PLAYING", false ) ) diff --git a/lib/core/include/core/struct/trajectory.hpp b/lib/core/include/core/struct/trajectory.hpp index 46211a505..3721283ee 100644 --- a/lib/core/include/core/struct/trajectory.hpp +++ b/lib/core/include/core/struct/trajectory.hpp @@ -20,6 +20,8 @@ namespace VTX::Core::Struct const Frame & getCurrentFrame() const { return frames[ currentFrameIndex ]; } Frame & getCurrentFrame() { return frames[ currentFrameIndex ]; } + size_t getFrameCount() const { return frames.size(); } + std::vector frames; size_t currentFrameIndex = 0; };