From be5aeda19586f1461171a7a14db654e6fbe59d98 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 1 Jun 2024 16:57:01 +0200 Subject: [PATCH] Write out ascii-based session recording files in scientific notation instead. Also store position and rotation in higher precision (closes #3050) --- include/openspace/network/messagestructures.h | 17 +++++++---------- src/navigation/keyframenavigator.cpp | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/openspace/network/messagestructures.h b/include/openspace/network/messagestructures.h index 2c342b6378..8fb79932bd 100644 --- a/include/openspace/network/messagestructures.h +++ b/include/openspace/network/messagestructures.h @@ -189,17 +189,14 @@ struct CameraKeyframe { void write(std::stringstream& out) const { // Add camera position - out << std::fixed << std::setprecision(7) << _position.x << ' ' - << std::fixed << std::setprecision(7) << _position.y << ' ' - << std::fixed << std::setprecision(7) << _position.z << ' '; + out << std::setprecision(std::numeric_limits::max_digits10); + out << _position.x << ' ' << _position.y << ' ' << _position.z << ' '; // Add camera rotation - out << std::fixed << std::setprecision(7) << _rotation.x << ' ' - << std::fixed << std::setprecision(7) << _rotation.y << ' ' - << std::fixed << std::setprecision(7) << _rotation.z << ' ' - << std::fixed << std::setprecision(7) << _rotation.w << ' '; - out << std::fixed - << std::setprecision(std::numeric_limits::max_digits10) - << _scale << ' '; + out << _rotation.x << ' ' + << _rotation.y << ' ' + << _rotation.z << ' ' + << _rotation.w << ' '; + out << std::scientific << _scale << ' '; if (_followNodeRotation) { out << "F "; } diff --git a/src/navigation/keyframenavigator.cpp b/src/navigation/keyframenavigator.cpp index 0c133d46c2..1e62597f17 100644 --- a/src/navigation/keyframenavigator.cpp +++ b/src/navigation/keyframenavigator.cpp @@ -155,7 +155,7 @@ bool KeyframeNavigator::updateCamera(Camera* camera, const CameraPose& prevPose, const float nextInvScaleExp = glm::log(1.f / nextPose.scale); const float interpolatedInvScaleExp = static_cast( prevInvScaleExp * (1.0 - t) + nextInvScaleExp * t - ); + ); camera->setScaling(1.f / glm::exp(interpolatedInvScaleExp)); }