mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 19:50:03 -06:00
Fix globe transformations not updating from height map if simulation time paused (#1766)
This commit is contained in:
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
const glm::dmat3& matrix() const;
|
||||
virtual glm::dmat3 matrix(const UpdateData& time) const = 0;
|
||||
void update(const UpdateData& data);
|
||||
virtual void update(const UpdateData& data);
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ public:
|
||||
virtual ~Translation() = default;
|
||||
virtual bool initialize();
|
||||
|
||||
virtual void update(const UpdateData& data);
|
||||
glm::dvec3 position() const;
|
||||
void update(const UpdateData& data);
|
||||
|
||||
virtual glm::dvec3 position(const UpdateData& data) const = 0;
|
||||
|
||||
|
||||
@@ -174,22 +174,22 @@ glm::vec3 GlobeRotation::computeSurfacePosition(double latitude, double longitud
|
||||
);
|
||||
}
|
||||
|
||||
glm::dmat3 GlobeRotation::matrix(const UpdateData&) const {
|
||||
void GlobeRotation::update(const UpdateData& data) {
|
||||
if (!_globeNode) {
|
||||
// @TODO(abock): The const cast should be removed on a redesign of the rotation
|
||||
// to make the matrix function not constant. Const casting this
|
||||
// away is fine as the factories that create the rotations don't
|
||||
// create them as constant objects
|
||||
const_cast<GlobeRotation*>(this)->findGlobe();
|
||||
_matrixIsDirty = true;
|
||||
findGlobe();
|
||||
setUpdateVariables();
|
||||
}
|
||||
|
||||
if (_useHeightmap) {
|
||||
// If we use the heightmap, we have to compute the height every frame
|
||||
_matrixIsDirty = true;
|
||||
setUpdateVariables();
|
||||
}
|
||||
|
||||
if (!_matrixIsDirty) {
|
||||
Rotation::update(data);
|
||||
}
|
||||
|
||||
glm::dmat3 GlobeRotation::matrix(const UpdateData&) const {
|
||||
if (!_matrixIsDirty || !_globeNode) {
|
||||
return _matrix;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ class GlobeRotation : public Rotation {
|
||||
public:
|
||||
GlobeRotation(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
glm::dmat3 matrix(const UpdateData& data) const override;
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
@@ -153,22 +153,22 @@ void GlobeTranslation::setUpdateVariables() {
|
||||
requireUpdate();
|
||||
}
|
||||
|
||||
glm::dvec3 GlobeTranslation::position(const UpdateData&) const {
|
||||
void GlobeTranslation::update(const UpdateData& data) {
|
||||
if (!_attachedNode) {
|
||||
// @TODO(abock): The const cast should be removed on a redesign of the translation
|
||||
// to make the position function not constant. Const casting this
|
||||
// away is fine as the factories that create the translations don't
|
||||
// create them as constant objects
|
||||
const_cast<GlobeTranslation*>(this)->fillAttachedNode();
|
||||
_positionIsDirty = true;
|
||||
fillAttachedNode();
|
||||
setUpdateVariables();
|
||||
}
|
||||
|
||||
if (_useHeightmap) {
|
||||
// If we use the heightmap, we have to compute the height every frame
|
||||
_positionIsDirty = true;
|
||||
setUpdateVariables();
|
||||
}
|
||||
|
||||
if (!_positionIsDirty) {
|
||||
Translation::update(data);
|
||||
}
|
||||
|
||||
glm::dvec3 GlobeTranslation::position(const UpdateData&) const {
|
||||
if (!_positionIsDirty || !_attachedNode) {
|
||||
return _position;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ class GlobeTranslation : public Translation {
|
||||
public:
|
||||
GlobeTranslation(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