mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-04 10:40:09 -06:00
Add animation mode to infinetly loop
This commit is contained in:
@@ -163,6 +163,7 @@ namespace {
|
||||
enum class AnimationMode {
|
||||
Once,
|
||||
LoopFromStart,
|
||||
LoopInfinitely,
|
||||
Bounce
|
||||
};
|
||||
|
||||
@@ -336,6 +337,9 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
case Parameters::AnimationMode::LoopFromStart:
|
||||
_animationMode = AnimationMode::LoopFromStart;
|
||||
break;
|
||||
case Parameters::AnimationMode::LoopInfinitely:
|
||||
_animationMode = AnimationMode::LoopInfinitely;
|
||||
break;
|
||||
case Parameters::AnimationMode::Bounce:
|
||||
_animationMode = AnimationMode::Bounce;
|
||||
break;
|
||||
@@ -587,6 +591,16 @@ void RenderableModel::update(const UpdateData& data) {
|
||||
_geometry->animationDuration()
|
||||
);
|
||||
break;
|
||||
case AnimationMode::LoopInfinitely:
|
||||
realtiveTime = std::fmod(
|
||||
data.time.j2000Seconds() - data.time.convertTime(_animationStart),
|
||||
_geometry->animationDuration()
|
||||
);
|
||||
|
||||
if (realtiveTime < 0) {
|
||||
realtiveTime += _geometry->animationDuration();
|
||||
}
|
||||
break;
|
||||
case AnimationMode::Once:
|
||||
default:
|
||||
realtiveTime =
|
||||
|
||||
@@ -73,6 +73,7 @@ private:
|
||||
enum class AnimationMode {
|
||||
Once = 0,
|
||||
LoopFromStart,
|
||||
LoopInfinitely,
|
||||
Bounce
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user