From f75caa92d4690c6c23d985fbeb72a2d2c243526b Mon Sep 17 00:00:00 2001 From: Daniel Nachbaur Date: Thu, 22 Feb 2018 18:05:16 +0100 Subject: [PATCH] Report 0 for end and current in animation params/frame if appropriate; fix #312 --- brayns/Brayns.cpp | 9 --------- brayns/common/volume/VolumeHandler.cpp | 1 - brayns/common/volume/VolumeHandler.h | 4 ++-- brayns/io/simulation/CADiffusionSimulationHandler.cpp | 2 -- brayns/io/simulation/CADiffusionSimulationHandler.h | 4 ++-- brayns/parameters/AnimationParameters.h | 11 +++++------ 6 files changed, 9 insertions(+), 22 deletions(-) diff --git a/brayns/Brayns.cpp b/brayns/Brayns.cpp index 26332ab354..a627744a2e 100644 --- a/brayns/Brayns.cpp +++ b/brayns/Brayns.cpp @@ -878,9 +878,6 @@ struct Brayns::Impl _keyboardHandler.registerKeyboardShortcut( 'r', "Set animation frame to 0", std::bind(&Brayns::Impl::_resetAnimationFrame, this)); - _keyboardHandler.registerKeyboardShortcut( - 'R', "Set animation frame to infinity", - std::bind(&Brayns::Impl::_infiniteAnimationFrame, this)); _keyboardHandler.registerKeyboardShortcut( 'u', "Enable/Disable shadows", std::bind(&Brayns::Impl::_toggleShadows, this)); @@ -1070,12 +1067,6 @@ struct Brayns::Impl animParams.setFrame(0); } - void _infiniteAnimationFrame() - { - auto& animParams = _parametersManager.getAnimationParameters(); - animParams.setFrame(std::numeric_limits::max()); - } - void _toggleShadows() { RenderingParameters& renderParams = diff --git a/brayns/common/volume/VolumeHandler.cpp b/brayns/common/volume/VolumeHandler.cpp index 0b966c908a..6f5e4b7ae0 100644 --- a/brayns/common/volume/VolumeHandler.cpp +++ b/brayns/common/volume/VolumeHandler.cpp @@ -38,7 +38,6 @@ namespace brayns VolumeHandler::VolumeHandler(const VolumeParameters& volumeParameters, const IndexMode indexMode) : _volumeParameters(volumeParameters) - , _currentIndex(std::numeric_limits::max()) , _indexMode(indexMode) { } diff --git a/brayns/common/volume/VolumeHandler.h b/brayns/common/volume/VolumeHandler.h index 8bf2c2914c..af70209087 100644 --- a/brayns/common/volume/VolumeHandler.h +++ b/brayns/common/volume/VolumeHandler.h @@ -208,10 +208,10 @@ class VolumeHandler const VolumeParameters& _volumeParameters; std::map _volumeDescriptors; - uint32_t _currentIndex; + uint32_t _currentIndex{std::numeric_limits::max()}; IndexMode _indexMode; std::map _histograms; - uint64_t _nbFrames = 0; + uint64_t _nbFrames{0}; }; } diff --git a/brayns/io/simulation/CADiffusionSimulationHandler.cpp b/brayns/io/simulation/CADiffusionSimulationHandler.cpp index 088fcc6f50..77147c3322 100644 --- a/brayns/io/simulation/CADiffusionSimulationHandler.cpp +++ b/brayns/io/simulation/CADiffusionSimulationHandler.cpp @@ -36,8 +36,6 @@ namespace brayns { CADiffusionSimulationHandler::CADiffusionSimulationHandler( const std::string& simulationFolder) - : _currentFrame(std::numeric_limits::max()) - , _spheresCreated(false) { BRAYNS_DEBUG << "Loading Calcium simulation from " << simulationFolder << std::endl; diff --git a/brayns/io/simulation/CADiffusionSimulationHandler.h b/brayns/io/simulation/CADiffusionSimulationHandler.h index a5df1a0645..5c9031013a 100644 --- a/brayns/io/simulation/CADiffusionSimulationHandler.h +++ b/brayns/io/simulation/CADiffusionSimulationHandler.h @@ -61,8 +61,8 @@ class CADiffusionSimulationHandler std::map _simulationFiles; Vector3fs _calciumPositions; - size_t _currentFrame; - bool _spheresCreated; + size_t _currentFrame{std::numeric_limits::max()}; + bool _spheresCreated{false}; }; } #endif // CADIFFUSIONSIMULATIONHANDLER_H diff --git a/brayns/parameters/AnimationParameters.h b/brayns/parameters/AnimationParameters.h index a73d3c0fac..41e73a1092 100644 --- a/brayns/parameters/AnimationParameters.h +++ b/brayns/parameters/AnimationParameters.h @@ -52,8 +52,8 @@ class AnimationParameters final : public AbstractParameters uint32_t getEnd() const { return _end; } void reset() { - _updateValue(_end, std::numeric_limits::max()); - _updateValue(_current, std::numeric_limits::max()); + _updateValue(_end, 0u); + _updateValue(_current, 0u); _updateValue(_unit, std::string()); _updateValue(_dt, 0.); } @@ -66,13 +66,12 @@ class AnimationParameters final : public AbstractParameters uint32_t adjustCurrent(const uint32_t newCurrent) const { const auto nbFrames = _end - _start; - return nbFrames == 0 ? std::numeric_limits::max() - : _start + (newCurrent % nbFrames); + return nbFrames == 0 ? 0 : _start + (newCurrent % nbFrames); } uint32_t _start{0}; - uint32_t _end{std::numeric_limits::max()}; - uint32_t _current{std::numeric_limits::max()}; + uint32_t _end{0}; + uint32_t _current{0}; int32_t _delta{0}; double _dt{0}; std::string _unit;