mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-05 10:59:47 -05:00
Correctly update scale, rotation, and scale classes where multiple subtypes are involved
This commit is contained in:
@@ -64,6 +64,12 @@ MultiRotation::MultiRotation(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
}
|
||||
|
||||
void MultiRotation::update(const UpdateData& data) {
|
||||
for (const ghoul::mm_unique_ptr<Rotation>& rot : _rotations) {
|
||||
rot->update(data);
|
||||
}
|
||||
}
|
||||
|
||||
glm::dmat3 MultiRotation::matrix(const UpdateData& data) const {
|
||||
glm::dmat3 res = glm::dmat3(1.0);
|
||||
for (const ghoul::mm_unique_ptr<Rotation>& rot : _rotations) {
|
||||
|
||||
@@ -39,6 +39,7 @@ class MultiRotation : public Rotation {
|
||||
public:
|
||||
explicit MultiRotation(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
glm::dmat3 matrix(const UpdateData& data) const override;
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
@@ -83,6 +83,18 @@ TimelineRotation::TimelineRotation(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_shouldInterpolate);
|
||||
}
|
||||
|
||||
void TimelineRotation::update(const UpdateData& data) {
|
||||
const double now = data.time.j2000Seconds();
|
||||
using KeyframePointer = const Keyframe<ghoul::mm_unique_ptr<Rotation>>*;
|
||||
|
||||
if (KeyframePointer prev = _timeline.lastKeyframeBefore(now, true); prev) {
|
||||
prev->data->update(data);
|
||||
}
|
||||
if (KeyframePointer next = _timeline.firstKeyframeAfter(now, true); next) {
|
||||
next->data->update(data);
|
||||
}
|
||||
}
|
||||
|
||||
glm::dmat3 TimelineRotation::matrix(const UpdateData& data) const {
|
||||
const double now = data.time.j2000Seconds();
|
||||
using KeyframePointer = const Keyframe<ghoul::mm_unique_ptr<Rotation>>*;
|
||||
|
||||
@@ -40,6 +40,7 @@ class TimelineRotation : public Rotation {
|
||||
public:
|
||||
explicit TimelineRotation(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
glm::dmat3 matrix(const UpdateData& data) const override;
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
|
||||
@@ -63,6 +63,12 @@ MultiScale::MultiScale(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
}
|
||||
|
||||
void MultiScale::update(const UpdateData& data) {
|
||||
for (const ghoul::mm_unique_ptr<Scale>& scale : _scales) {
|
||||
scale->update(data);
|
||||
}
|
||||
}
|
||||
|
||||
glm::dvec3 MultiScale::scaleValue(const UpdateData& data) const {
|
||||
glm::dvec3 res = glm::dvec3(1.0);
|
||||
for (const ghoul::mm_unique_ptr<Scale>& scale : _scales) {
|
||||
|
||||
@@ -35,6 +35,7 @@ class MultiScale : public Scale {
|
||||
public:
|
||||
explicit MultiScale(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
glm::dvec3 scaleValue(const UpdateData& data) const override;
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
@@ -81,6 +81,18 @@ TimelineScale::TimelineScale(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_shouldInterpolate);
|
||||
}
|
||||
|
||||
void TimelineScale::update(const UpdateData& data) {
|
||||
const double now = data.time.j2000Seconds();
|
||||
using KeyframePointer = const Keyframe<ghoul::mm_unique_ptr<Scale>>*;
|
||||
|
||||
if (KeyframePointer prev = _timeline.lastKeyframeBefore(now, true); prev) {
|
||||
prev->data->update(data);
|
||||
}
|
||||
if (KeyframePointer next = _timeline.firstKeyframeAfter(now, true); next) {
|
||||
next->data->update(data);
|
||||
}
|
||||
}
|
||||
|
||||
glm::dvec3 TimelineScale::scaleValue(const UpdateData& data) const {
|
||||
const double now = data.time.j2000Seconds();
|
||||
using KeyframePointer = const Keyframe<ghoul::mm_unique_ptr<Scale>>*;
|
||||
|
||||
@@ -41,6 +41,7 @@ class TimelineScale : public Scale {
|
||||
public:
|
||||
explicit TimelineScale(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
glm::dvec3 scaleValue(const UpdateData& data) const override;
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
|
||||
@@ -64,6 +64,12 @@ MultiTranslation::MultiTranslation(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
}
|
||||
|
||||
void MultiTranslation::update(const UpdateData& data) {
|
||||
for (const ghoul::mm_unique_ptr<Translation>& rot : _translations) {
|
||||
rot->update(data);
|
||||
}
|
||||
}
|
||||
|
||||
glm::dvec3 MultiTranslation::position(const UpdateData& data) const {
|
||||
glm::dvec3 res = glm::dvec3(1.0);
|
||||
for (const ghoul::mm_unique_ptr<Translation>& rot : _translations) {
|
||||
|
||||
@@ -37,6 +37,7 @@ class MultiTranslation : public Translation {
|
||||
public:
|
||||
explicit MultiTranslation(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
glm::dvec3 position(const UpdateData& data) const override;
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
|
||||
@@ -83,6 +83,18 @@ TimelineTranslation::TimelineTranslation(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_shouldInterpolate);
|
||||
}
|
||||
|
||||
void TimelineTranslation::update(const UpdateData& data) {
|
||||
const double now = data.time.j2000Seconds();
|
||||
using KeyframePointer = const Keyframe<ghoul::mm_unique_ptr<Translation>>*;
|
||||
|
||||
if (KeyframePointer prev = _timeline.lastKeyframeBefore(now, true); prev) {
|
||||
prev->data->update(data);
|
||||
}
|
||||
if (KeyframePointer next = _timeline.firstKeyframeAfter(now, true); next) {
|
||||
next->data->update(data);
|
||||
}
|
||||
}
|
||||
|
||||
glm::dvec3 TimelineTranslation::position(const UpdateData& data) const {
|
||||
const double now = data.time.j2000Seconds();
|
||||
using KeyframePointer = const Keyframe<ghoul::mm_unique_ptr<Translation>>*;
|
||||
|
||||
@@ -41,6 +41,7 @@ class TimelineTranslation : public Translation {
|
||||
public:
|
||||
explicit TimelineTranslation(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
glm::dvec3 position(const UpdateData& data) const override;
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user