mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 19:50:03 -06:00
Fix the globetransformatons fix in previous commit (bc306c6f1b)
It broke the TimelineTranslation for when keyframes were using GlobeTranslations. The intial position was not set up correctly for these when the code for finding the globe was done in the update. Bringing back the check in the matrix/position methods solved the problem. Probably the globe is guaranteed to be created when reaching this function
This commit is contained in:
@@ -175,11 +175,6 @@ glm::vec3 GlobeRotation::computeSurfacePosition(double latitude, double longitud
|
||||
}
|
||||
|
||||
void GlobeRotation::update(const UpdateData& data) {
|
||||
if (!_globeNode) {
|
||||
findGlobe();
|
||||
setUpdateVariables();
|
||||
}
|
||||
|
||||
if (_useHeightmap) {
|
||||
// If we use the heightmap, we have to compute the height every frame
|
||||
setUpdateVariables();
|
||||
@@ -189,7 +184,16 @@ void GlobeRotation::update(const UpdateData& data) {
|
||||
}
|
||||
|
||||
glm::dmat3 GlobeRotation::matrix(const UpdateData&) const {
|
||||
if (!_matrixIsDirty || !_globeNode) {
|
||||
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;
|
||||
}
|
||||
|
||||
if (!_matrixIsDirty) {
|
||||
return _matrix;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,11 +154,6 @@ void GlobeTranslation::setUpdateVariables() {
|
||||
}
|
||||
|
||||
void GlobeTranslation::update(const UpdateData& data) {
|
||||
if (!_attachedNode) {
|
||||
fillAttachedNode();
|
||||
setUpdateVariables();
|
||||
}
|
||||
|
||||
if (_useHeightmap) {
|
||||
// If we use the heightmap, we have to compute the height every frame
|
||||
setUpdateVariables();
|
||||
@@ -168,7 +163,16 @@ void GlobeTranslation::update(const UpdateData& data) {
|
||||
}
|
||||
|
||||
glm::dvec3 GlobeTranslation::position(const UpdateData&) const {
|
||||
if (!_positionIsDirty || !_attachedNode) {
|
||||
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;
|
||||
}
|
||||
|
||||
if (!_positionIsDirty) {
|
||||
return _position;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user