diff --git a/modules/globebrowsing/src/geojson/geojsoncomponent.cpp b/modules/globebrowsing/src/geojson/geojsoncomponent.cpp index d3f6b43afc..ca3dbf5423 100644 --- a/modules/globebrowsing/src/geojson/geojsoncomponent.cpp +++ b/modules/globebrowsing/src/geojson/geojsoncomponent.cpp @@ -698,12 +698,13 @@ void GeoJsonComponent::parseSingleFeature(const geos::io::GeoJSONFeature& featur _featuresPropertyOwner.addPropertySubOwner(_features.back().get()); } - catch (const ghoul::MissingCaseException&) { + catch (const ghoul::RuntimeError& error) { LERROR(fmt::format( "Error creating GeoJson layer with identifier '{}'. Problem reading " "feature {} in GeoJson file '{}'.", identifier(), indexInFile, _geoJsonFile )); + LERRORC(error.component, error.message); // Do nothing } } diff --git a/modules/globebrowsing/src/geojson/globegeometryfeature.cpp b/modules/globebrowsing/src/geojson/globegeometryfeature.cpp index 74c699b874..170928cf2b 100644 --- a/modules/globebrowsing/src/geojson/globegeometryfeature.cpp +++ b/modules/globebrowsing/src/geojson/globegeometryfeature.cpp @@ -232,18 +232,18 @@ void GlobeGeometryFeature::createFromSingleGeosGeometry(const geos::geom::Geomet _type = GeometryType::Polygon; } catch (geos::util::IllegalStateException& e) { - LERROR(fmt::format( + throw ghoul::RuntimeError(fmt::format( "Non-simple (e.g. self-intersecting) polygons not supported yet. " "GEOS error: '{}'", e.what() )); - throw ghoul::MissingCaseException(); // TODO: handle self-intersections points // https://www.sciencedirect.com/science/article/pii/S0304397520304199 } catch (geos::util::GEOSException& e) { - LERROR(fmt::format("Unknown geos error: {}", e.what())); - throw ghoul::MissingCaseException(); + throw ghoul::RuntimeError(fmt::format( + "Unknown geos error: {}", e.what() + )); } break; } diff --git a/modules/video/src/videoplayer.cpp b/modules/video/src/videoplayer.cpp index b199aa898f..3b69a3f744 100644 --- a/modules/video/src/videoplayer.cpp +++ b/modules/video/src/videoplayer.cpp @@ -739,9 +739,8 @@ void VideoPlayer::handleMpvProperties(mpv_event* event) { } break; } - default: { + default: throw ghoul::MissingCaseException(); - } } } diff --git a/src/navigation/orbitalnavigator.cpp b/src/navigation/orbitalnavigator.cpp index 738ad8901a..992dce2a0e 100644 --- a/src/navigation/orbitalnavigator.cpp +++ b/src/navigation/orbitalnavigator.cpp @@ -746,6 +746,12 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) { .rotation = _camera->rotationQuaternion() }; + if (glm::length(pose.position) == 0.0) { + // If the position is 0.0, a lot of the calculations downstairs will fail as we + // calculate relative offsets from the center of the anchor node + return; + } + const bool hasPreviousPositions = _previousAnchorNodePosition.has_value() && _previousAimNodePosition.has_value(); @@ -872,6 +878,11 @@ void OrbitalNavigator::updateCameraScalingFromAnchor(double deltaTime) { const glm::dvec3 anchorPos = _anchorNode->worldPosition(); const glm::dvec3 cameraPos = _camera->positionVec3(); + if (glm::length(cameraPos) == 0.0) { + // Calculating the surface position fails for (0,0,0) vectors + return; + } + SurfacePositionHandle posHandle = calculateSurfacePositionHandle(*_anchorNode, cameraPos); @@ -1123,7 +1134,8 @@ void OrbitalNavigator::setRetargetInterpolationTime(float durationInSeconds) { bool OrbitalNavigator::shouldFollowAnchorRotation(const glm::dvec3& cameraPosition) const { - if (!_anchorNode || !_followAnchorNodeRotation) { + if (!_anchorNode || !_followAnchorNodeRotation || glm::length(cameraPosition) == 0.0) + { return false; } diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 25c45353a1..cbd7203a50 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -888,7 +888,7 @@ std::string makeIdentifier(std::string s) { std::replace_if( s.begin(), s.end(), - [](char c) { return std::ispunct(c) != 0; }, + [](unsigned char c) { return std::ispunct(c) != 0; }, '-' ); std::replace(s.begin(), s.end(), ' ', '_');