Skip to content

Commit

Permalink
Report 0 for end and current in animation params/frame if appropriate;
Browse files Browse the repository at this point in the history
…fix #312
  • Loading branch information
tribal-tec committed Feb 22, 2018
1 parent 9c1b7cc commit f75caa9
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 22 deletions.
9 changes: 0 additions & 9 deletions brayns/Brayns.cpp
Expand Up @@ -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));
Expand Down Expand Up @@ -1070,12 +1067,6 @@ struct Brayns::Impl
animParams.setFrame(0);
}

void _infiniteAnimationFrame()
{
auto& animParams = _parametersManager.getAnimationParameters();
animParams.setFrame(std::numeric_limits<uint32_t>::max());
}

void _toggleShadows()
{
RenderingParameters& renderParams =
Expand Down
1 change: 0 additions & 1 deletion brayns/common/volume/VolumeHandler.cpp
Expand Up @@ -38,7 +38,6 @@ namespace brayns
VolumeHandler::VolumeHandler(const VolumeParameters& volumeParameters,
const IndexMode indexMode)
: _volumeParameters(volumeParameters)
, _currentIndex(std::numeric_limits<uint32_t>::max())
, _indexMode(indexMode)
{
}
Expand Down
4 changes: 2 additions & 2 deletions brayns/common/volume/VolumeHandler.h
Expand Up @@ -208,10 +208,10 @@ class VolumeHandler

const VolumeParameters& _volumeParameters;
std::map<uint32_t, VolumeDescriptorPtr> _volumeDescriptors;
uint32_t _currentIndex;
uint32_t _currentIndex{std::numeric_limits<uint32_t>::max()};
IndexMode _indexMode;
std::map<float, Histogram> _histograms;
uint64_t _nbFrames = 0;
uint64_t _nbFrames{0};
};
}

Expand Down
2 changes: 0 additions & 2 deletions brayns/io/simulation/CADiffusionSimulationHandler.cpp
Expand Up @@ -36,8 +36,6 @@ namespace brayns
{
CADiffusionSimulationHandler::CADiffusionSimulationHandler(
const std::string& simulationFolder)
: _currentFrame(std::numeric_limits<size_t>::max())
, _spheresCreated(false)
{
BRAYNS_DEBUG << "Loading Calcium simulation from " << simulationFolder
<< std::endl;
Expand Down
4 changes: 2 additions & 2 deletions brayns/io/simulation/CADiffusionSimulationHandler.h
Expand Up @@ -61,8 +61,8 @@ class CADiffusionSimulationHandler

std::map<size_t, std::string> _simulationFiles;
Vector3fs _calciumPositions;
size_t _currentFrame;
bool _spheresCreated;
size_t _currentFrame{std::numeric_limits<size_t>::max()};
bool _spheresCreated{false};
};
}
#endif // CADIFFUSIONSIMULATIONHANDLER_H
11 changes: 5 additions & 6 deletions brayns/parameters/AnimationParameters.h
Expand Up @@ -52,8 +52,8 @@ class AnimationParameters final : public AbstractParameters
uint32_t getEnd() const { return _end; }
void reset()
{
_updateValue(_end, std::numeric_limits<uint32_t>::max());
_updateValue(_current, std::numeric_limits<uint32_t>::max());
_updateValue(_end, 0u);
_updateValue(_current, 0u);
_updateValue(_unit, std::string());
_updateValue(_dt, 0.);
}
Expand All @@ -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<uint32_t>::max()
: _start + (newCurrent % nbFrames);
return nbFrames == 0 ? 0 : _start + (newCurrent % nbFrames);
}

uint32_t _start{0};
uint32_t _end{std::numeric_limits<uint32_t>::max()};
uint32_t _current{std::numeric_limits<uint32_t>::max()};
uint32_t _end{0};
uint32_t _current{0};
int32_t _delta{0};
double _dt{0};
std::string _unit;
Expand Down

0 comments on commit f75caa9

Please sign in to comment.