Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report 0 for end and current in animation params/frame if appropriate; fix #312 #318

Merged
merged 1 commit into from Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion plugins/engines/ospray/ispc/geometry/ExtendedCones.ispc
Expand Up @@ -92,7 +92,7 @@ void ExtendedCones_intersect(uniform ExtendedCones *uniform geometry,
uniform float timestamp =
*((uniform float *)(conePtr + geometry->offset_timestamp));

if (timestamp > ray.time)
if (ray.time > 0 && timestamp > ray.time)
return;

uniform vec3f v0 = *((uniform vec3f *)(conePtr + geometry->offset_center));
Expand Down
Expand Up @@ -75,7 +75,7 @@ void ExtendedCylinders_intersect(uniform ExtendedCylinders *uniform geometry,
uniform float timestamp =
*((uniform float *)(cylinderPtr + geometry->offset_timestamp));

if (timestamp > ray.time)
if (ray.time > 0 && timestamp > ray.time)
return;

if (geometry->offset_radius >= 0)
Expand Down
2 changes: 1 addition & 1 deletion plugins/engines/ospray/ispc/geometry/ExtendedSpheres.ispc
Expand Up @@ -149,7 +149,7 @@ void ExtendedSpheres_intersect(uniform ExtendedSpheres *uniform geometry,
uniform float timestamp =
*((uniform float *)(spherePtr + geometry->offset_timestamp));

if (timestamp > ray.time)
if (ray.time > 0 && timestamp > ray.time)
return;

uniform float radius = geometry->radius;
Expand Down
3 changes: 1 addition & 2 deletions tests/brayns.cpp
Expand Up @@ -123,8 +123,7 @@ BOOST_AUTO_TEST_CASE(defaults)
std::numeric_limits<float>::min());

const auto& animParams = pm.getAnimationParameters();
BOOST_CHECK_EQUAL(animParams.getFrame(),
std::numeric_limits<uint32_t>::max());
BOOST_CHECK_EQUAL(animParams.getFrame(), 0);

const auto& volumeParams = pm.getVolumeParameters();
BOOST_CHECK_EQUAL(volumeParams.getDimensions(), brayns::Vector3ui(0, 0, 0));
Expand Down