From 65281e5ff413272d5ac52fc1179a623c6d0ea212 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 27 Oct 2025 17:50:06 +0100 Subject: [PATCH] Second phase WIP (something is broken) --- include/openspace/events/event.h | 2 +- include/openspace/rendering/renderengine.h | 2 - include/openspace/scene/scenegraphnode.h | 3 - .../lightsource/scenegraphlightsource.cpp | 3 +- modules/base/rendering/renderableprism.cpp | 106 +-- modules/base/rendering/renderableprism.h | 2 - modules/base/rotation/staticrotation.cpp | 8 - modules/base/rotation/staticrotation.h | 2 - modules/globebrowsing/globebrowsingmodule.cpp | 4 - .../shaders/globalrenderer_vs.glsl | 2 +- .../shaders/localrenderer_vs.glsl | 2 +- .../shaders/planetarytrail_blur_fs.glsl | 87 -- .../shaders/planetarytrail_blur_vs.glsl | 35 - .../shaders/planetarytrail_fs.glsl | 38 - .../shaders/planetarytrail_gs.glsl | 132 --- .../shaders/planetarytrail_point_fs.glsl | 39 - .../shaders/planetarytrail_vs.glsl | 39 - .../shaders/texturetilemapping.glsl | 6 - modules/globebrowsing/src/geodeticpatch.cpp | 14 - modules/globebrowsing/src/geodeticpatch.h | 6 - modules/globebrowsing/src/gpulayergroup.cpp | 2 - modules/globebrowsing/src/layer.cpp | 9 +- modules/globebrowsing/src/layergroupid.h | 12 +- .../globebrowsing/src/rawtiledatareader.cpp | 4 + .../forcehighresolutiontileprovider.cpp | 67 -- .../forcehighresolutiontileprovider.h | 49 -- .../planetarytrailtileprovider.cpp | 762 ------------------ .../tileprovider/planetarytrailtileprovider.h | 95 --- modules/video/include/videoplayer.h | 8 - shaders/framebuffer/renderframebuffer.frag | 3 +- src/navigation/keyframenavigator.cpp | 1 - src/navigation/navigationhandler.cpp | 1 - src/navigation/orbitalnavigator.cpp | 2 +- src/scene/scenegraphnode.cpp | 21 - 34 files changed, 23 insertions(+), 1545 deletions(-) delete mode 100644 modules/globebrowsing/shaders/planetarytrail_blur_fs.glsl delete mode 100644 modules/globebrowsing/shaders/planetarytrail_blur_vs.glsl delete mode 100644 modules/globebrowsing/shaders/planetarytrail_fs.glsl delete mode 100644 modules/globebrowsing/shaders/planetarytrail_gs.glsl delete mode 100644 modules/globebrowsing/shaders/planetarytrail_point_fs.glsl delete mode 100644 modules/globebrowsing/shaders/planetarytrail_vs.glsl delete mode 100644 modules/globebrowsing/src/tileprovider/forcehighresolutiontileprovider.cpp delete mode 100644 modules/globebrowsing/src/tileprovider/forcehighresolutiontileprovider.h delete mode 100644 modules/globebrowsing/src/tileprovider/planetarytrailtileprovider.cpp delete mode 100644 modules/globebrowsing/src/tileprovider/planetarytrailtileprovider.h diff --git a/include/openspace/events/event.h b/include/openspace/events/event.h index 563e4c5a44..179be598cf 100644 --- a/include/openspace/events/event.h +++ b/include/openspace/events/event.h @@ -617,7 +617,7 @@ struct CustomEvent : public Event { * * \pre subtype_ must not be empty */ - CustomEvent(std::string_view subtype_, std::string_view payload_); + CustomEvent(std::string_view subtype_, std::string_view payload_ = ""); const tstring subtype; const tstring payload; diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index 0f83d18a10..d1e2ceb207 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -151,7 +151,6 @@ public: */ static scripting::LuaLibrary luaLibrary(); - glm::ivec2 renderingResolution() const; glm::ivec2 fontResolution() const; @@ -177,7 +176,6 @@ private: ghoul::Dictionary _resolveData; ScreenLog* _log = nullptr; - ghoul::opengl::OpenGLStateCache* _openglStateCache = nullptr; properties::BoolProperty _showOverlayOnClients; diff --git a/include/openspace/scene/scenegraphnode.h b/include/openspace/scene/scenegraphnode.h index 3083b56e92..7f08699654 100644 --- a/include/openspace/scene/scenegraphnode.h +++ b/include/openspace/scene/scenegraphnode.h @@ -139,8 +139,6 @@ public: double reachFactor() const; double approachFactor() const; - double followRotationDistance() const; - bool supportsDirectInteraction() const; SceneGraphNode* childNode(const std::string& id); @@ -219,7 +217,6 @@ private: properties::DoubleProperty _screenSizeRadius; properties::FloatProperty _visibilityDistance; properties::BoolProperty _supportsDirectInteraction; - properties::DoubleProperty _followRotationDistance; // This variable is used for the rate-limiting of the screenspace positions (if they // are calculated when _computeScreenSpaceValues is true) diff --git a/modules/base/lightsource/scenegraphlightsource.cpp b/modules/base/lightsource/scenegraphlightsource.cpp index b7850316e2..0f71a9effb 100644 --- a/modules/base/lightsource/scenegraphlightsource.cpp +++ b/modules/base/lightsource/scenegraphlightsource.cpp @@ -102,8 +102,7 @@ float SceneGraphLightSource::intensity() const { return _intensity; } -glm::dvec3 SceneGraphLightSource::positionWorldSpace() const -{ +glm::dvec3 SceneGraphLightSource::positionWorldSpace() const { return _sceneGraphNode->modelTransform() * glm::dvec4(0.0, 0.0, 0.0, 1.0); } diff --git a/modules/base/rendering/renderableprism.cpp b/modules/base/rendering/renderableprism.cpp index aaec50730c..7d2c857b5e 100644 --- a/modules/base/rendering/renderableprism.cpp +++ b/modules/base/rendering/renderableprism.cpp @@ -59,22 +59,6 @@ namespace { openspace::properties::Property::Visibility::User }; - constexpr openspace::properties::Property::PropertyInfo WidthInfo = { - "Width", - "Width", - "The width of the prism's shape in meters", - // @VISIBILITY(2.8) - openspace::properties::Property::Visibility::User - }; - - constexpr openspace::properties::Property::PropertyInfo HeightInfo = { - "Height", - "Height", - "The height of the prism's shape in meters", - // @VISIBILITY(2.8) - openspace::properties::Property::Visibility::User - }; - constexpr openspace::properties::Property::PropertyInfo BaseRadiusInfo = { "BaseRadius", "Base radius", @@ -125,12 +109,6 @@ namespace { // [[codegen::verbatim(LengthInfo.description)]] std::optional length; - - // [[codegen::verbatim(WidthInfo.description)]] - std::optional width; - - // [[codegen::verbatim(HeightInfo.description)]] - std::optional height; }; #include "renderableprism_codegen.cpp" } // namespace @@ -146,8 +124,6 @@ RenderablePrism::RenderablePrism(const ghoul::Dictionary& dictionary) , _nShapeSegments(SegmentsInfo, 6, 3, 32) , _nLines(LinesInfo, 6, 0, 32) , _radius(RadiusInfo, 10.f, 0.f, 3e20f) - , _width(WidthInfo, 0.f, 0.f, 3e20f) - , _height(HeightInfo, 0.f, 0.f, 3e20f) , _baseRadius(BaseRadiusInfo, 10.f, 0.f, 3e20f) , _lineWidth(LineWidthInfo, 1.f, 1.f, 20.f) , _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f)) @@ -168,14 +144,6 @@ RenderablePrism::RenderablePrism(const ghoul::Dictionary& dictionary) _radius = p.radius.value_or(_radius); addProperty(_radius); - _width.onChange([this]() { _prismIsDirty = true; }); - _width = p.width.value_or(_width); - addProperty(_width); - - _height.onChange([this]() { _prismIsDirty = true; }); - _height = p.height.value_or(_height); - addProperty(_height); - _baseRadius.setExponent(12.f); _baseRadius.onChange([this]() { _prismIsDirty = true; }); // Use the "regular" radius as default if no value was provided @@ -250,14 +218,6 @@ void RenderablePrism::updateVertexData() { std::vector unitVertices = createRingXYZ(_nShapeSegments, 1.f); std::vector unitVerticesLines = createRingXYZ(_nLines, 1.f); - // hacked-up FOV adaptation - const auto doFOV = (_width > 0.f && _height > 0.f && _nShapeSegments == 4 && _nLines == 4); - const auto rot = glm::rotate(glm::mat4(1), glm::radians(-45.f), glm::vec3(0, 0, 1)); - const auto NW = rot * glm::vec4(-_width / 2, _height / 2, 0.f, 1.f); - const auto SW = rot * glm::vec4(-_width / 2, -_height / 2, 0.f, 1.f); - const auto SE = rot * glm::vec4(_width / 2, -_height / 2, 0.f, 1.f); - const auto NE = rot * glm::vec4(_width / 2, _height / 2, 0.f, 1.f); - // Put base vertices into array for (int j = 0; j < _nShapeSegments; j++) { const float ux = unitVertices[j].xyz[0]; @@ -268,34 +228,14 @@ void RenderablePrism::updateVertexData() { _vertexArray.push_back(0.f); // z } - if (doFOV) { - // Put top shape vertices into array - _vertexArray.push_back(NW.x); - _vertexArray.push_back(NW.y); - _vertexArray.push_back(_length); + // Put top shape vertices into array + for (int j = 0; j < _nShapeSegments; j++) { + const float ux = unitVertices[j].xyz[0]; + const float uy = unitVertices[j].xyz[1]; - _vertexArray.push_back(SW.x); - _vertexArray.push_back(SW.y); - _vertexArray.push_back(_length); - - _vertexArray.push_back(SE.x); - _vertexArray.push_back(SE.y); - _vertexArray.push_back(_length); - - _vertexArray.push_back(NE.x); - _vertexArray.push_back(NE.y); - _vertexArray.push_back(_length); - } - else { - // Put top shape vertices into array - for (int j = 0; j < _nShapeSegments; j++) { - const float ux = unitVertices[j].xyz[0]; - const float uy = unitVertices[j].xyz[1]; - - _vertexArray.push_back(ux * _radius); // x - _vertexArray.push_back(uy * _radius); // y - _vertexArray.push_back(_length); // z - } + _vertexArray.push_back(ux * _radius); // x + _vertexArray.push_back(uy * _radius); // y + _vertexArray.push_back(_length); // z } // Put the vertices for the connecting lines into array @@ -322,35 +262,9 @@ void RenderablePrism::updateVertexData() { _vertexArray.push_back(0.f); // z // Top - if (!doFOV) { - _vertexArray.push_back(ux * _radius); // x - _vertexArray.push_back(uy * _radius); // y - _vertexArray.push_back(_length); // z - } - else { - switch (j) { - case 0: - _vertexArray.push_back(NW.x); - _vertexArray.push_back(NW.y); - _vertexArray.push_back(_length); - break; - case 1: - _vertexArray.push_back(SW.x); - _vertexArray.push_back(SW.y); - _vertexArray.push_back(_length); - break; - case 2: - _vertexArray.push_back(SE.x); - _vertexArray.push_back(SE.y); - _vertexArray.push_back(_length); - break; - case 3: - _vertexArray.push_back(NE.x); - _vertexArray.push_back(NE.y); - _vertexArray.push_back(_length); - break; - } - } + _vertexArray.push_back(ux * _radius); // x + _vertexArray.push_back(uy * _radius); // y + _vertexArray.push_back(_length); // z } } diff --git a/modules/base/rendering/renderableprism.h b/modules/base/rendering/renderableprism.h index b37b0cdaa3..4005ea59d8 100644 --- a/modules/base/rendering/renderableprism.h +++ b/modules/base/rendering/renderableprism.h @@ -63,8 +63,6 @@ private: properties::IntProperty _nShapeSegments; properties::IntProperty _nLines; properties::FloatProperty _radius; - properties::FloatProperty _width; - properties::FloatProperty _height; properties::FloatProperty _baseRadius; properties::FloatProperty _lineWidth; properties::Vec3Property _lineColor; diff --git a/modules/base/rotation/staticrotation.cpp b/modules/base/rotation/staticrotation.cpp index ce1e381cc0..2106d11c24 100644 --- a/modules/base/rotation/staticrotation.cpp +++ b/modules/base/rotation/staticrotation.cpp @@ -36,13 +36,6 @@ namespace { openspace::properties::Property::Visibility::AdvancedUser }; - constexpr openspace::properties::Property::PropertyInfo SequenceInfo = { - "RotationSequence", - "Rotation Sequence", - "The rotation sequence to use for Euler angle rotations.", - openspace::properties::Property::Visibility::AdvancedUser - }; - // Conversion from rotation matrix to euler angles, given that the rotation is a pure // rotation matrix. // Inspired by: https://www.learnopencv.com/rotation-matrix-to-euler-angles/ @@ -99,7 +92,6 @@ StaticRotation::StaticRotation(const ghoul::Dictionary& dictionary) glm::vec3(-glm::pi()), glm::vec3(glm::pi()) ) - , _eulerSequence(SequenceInfo) { const Parameters p = codegen::bake(dictionary); diff --git a/modules/base/rotation/staticrotation.h b/modules/base/rotation/staticrotation.h index d5672e6084..81574e22cf 100644 --- a/modules/base/rotation/staticrotation.h +++ b/modules/base/rotation/staticrotation.h @@ -28,7 +28,6 @@ #include #include -#include namespace openspace { @@ -44,7 +43,6 @@ public: private: properties::Vec3Property _eulerRotation; - properties::OptionProperty _eulerSequence; mutable glm::dmat3 _cachedMatrix = glm::dmat3(1.0); mutable bool _matrixIsDirty = true; }; diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index 9e3e7ddc8a..ff765103a2 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -45,8 +45,6 @@ #include #include #include -#include -#include #include #include #include @@ -306,8 +304,6 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { fTileProvider->registerClass("TemporalTileProvider"); fTileProvider->registerClass("TileIndexTileProvider"); fTileProvider->registerClass("SizeReferenceTileProvider"); - fTileProvider->registerClass("PlanetaryTrailTileProvider"); - fTileProvider->registerClass("ForceHighResolutionTileProvider"); fTileProvider->registerClass("TileProviderByDate"); fTileProvider->registerClass("TileProviderByLevel"); fTileProvider->registerClass("TileProviderByIndex"); diff --git a/modules/globebrowsing/shaders/globalrenderer_vs.glsl b/modules/globebrowsing/shaders/globalrenderer_vs.glsl index 085fa879d6..876001a66b 100644 --- a/modules/globebrowsing/shaders/globalrenderer_vs.glsl +++ b/modules/globebrowsing/shaders/globalrenderer_vs.glsl @@ -153,7 +153,7 @@ void main() { #endif // SHADOW_MAPPING_ENABLED #if nDepthMaps > 0 - for (int idx = 0; idx < nDepthMaps; ++idx) { + for (int idx = 0; idx < nDepthMaps; idx++) { positions_lightspace[idx] = vec4(light_vps[idx] * (inv_vp * dvec4(positionCameraSpace, 1.0))); } #endif // nDepthMaps > 0 diff --git a/modules/globebrowsing/shaders/localrenderer_vs.glsl b/modules/globebrowsing/shaders/localrenderer_vs.glsl index a5aa125a2c..502c05ee3f 100644 --- a/modules/globebrowsing/shaders/localrenderer_vs.glsl +++ b/modules/globebrowsing/shaders/localrenderer_vs.glsl @@ -138,7 +138,7 @@ void main() { #endif // SHADOW_MAPPING_ENABLED #if nDepthMaps > 0 - for (int idx = 0; idx < nDepthMaps; ++idx) { + for (int idx = 0; idx < nDepthMaps; idx++) { positions_lightspace[idx] = vec4(light_vps[idx] * (inv_vp * dvec4(p, 1.0))); } #endif // nDepthMaps > 0 diff --git a/modules/globebrowsing/shaders/planetarytrail_blur_fs.glsl b/modules/globebrowsing/shaders/planetarytrail_blur_fs.glsl deleted file mode 100644 index 039ded939d..0000000000 --- a/modules/globebrowsing/shaders/planetarytrail_blur_fs.glsl +++ /dev/null @@ -1,87 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2023 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include "fragment.glsl" - -uniform sampler2D tex0; -uniform vec2 resolution; -uniform vec2 direction; -uniform int kernelSize; - -in vec2 uv; - -vec4 blur5(sampler2D tex, vec2 uv, vec2 res, vec2 dir) { - vec4 color = vec4(0.0); - vec2 off1 = vec2(1.3333333333333333) * dir; - color += texture2D(tex, uv) * 0.29411764705882354; - color += texture2D(tex, uv + (off1 / res)) * 0.35294117647058826; - color += texture2D(tex, uv - (off1 / res)) * 0.35294117647058826; - return color; -} - -vec4 blur9(sampler2D tex, vec2 uv, vec2 res, vec2 dir) { - vec4 color = vec4(0.0); - vec2 off1 = vec2(1.3846153846) * dir; - vec2 off2 = vec2(3.2307692308) * dir; - color += texture2D(tex, uv) * 0.2270270270; - color += texture2D(tex, uv + (off1 / res)) * 0.3162162162; - color += texture2D(tex, uv - (off1 / res)) * 0.3162162162; - color += texture2D(tex, uv + (off2 / res)) * 0.0702702703; - color += texture2D(tex, uv - (off2 / res)) * 0.0702702703; - return color; -} - -vec4 blur13(sampler2D tex, vec2 uv, vec2 res, vec2 dir) { - vec4 color; - vec2 off1 = vec2(1.3846153846) * dir; - vec2 off2 = vec2(3.2307692308) * dir; - vec2 off3 = vec2(5.176470588235294) * dir; - color += texture2D(tex, uv) * 0.1964825501511404; - color += texture2D(tex, uv + (off1 / res)) * 0.2969069646728344; - color += texture2D(tex, uv - (off1 / res)) * 0.2969069646728344; - color += texture2D(tex, uv + (off2 / res)) * 0.09447039785044732; - color += texture2D(tex, uv - (off2 / res)) * 0.09447039785044732; - color += texture2D(tex, uv + (off3 / res)) * 0.010381362401148057; - color += texture2D(tex, uv - (off3 / res)) * 0.010381362401148057; - - return color; -} - -Fragment getFragment() { - Fragment frag; - frag.disableLDR2HDR = true; - if (kernelSize == 0) { - frag.color = texture(tex0, uv); - } - if (kernelSize == 5) { - frag.color = blur5(tex0, uv, resolution, direction); - } - if (kernelSize == 9) { - frag.color = blur9(tex0, uv, resolution, direction); - } - if (kernelSize == 13) { - frag.color = blur13(tex0, uv, resolution, direction); - } - return frag; -} diff --git a/modules/globebrowsing/shaders/planetarytrail_blur_vs.glsl b/modules/globebrowsing/shaders/planetarytrail_blur_vs.glsl deleted file mode 100644 index a00b584ed0..0000000000 --- a/modules/globebrowsing/shaders/planetarytrail_blur_vs.glsl +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2023 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#version __CONTEXT__ - -layout(location=0) in vec2 vertex_position; - -out vec2 uv; - -void main() -{ - uv = (vertex_position + 1) * 0.5; - gl_Position = vec4(vertex_position, 0.0, 1.0); -} diff --git a/modules/globebrowsing/shaders/planetarytrail_fs.glsl b/modules/globebrowsing/shaders/planetarytrail_fs.glsl deleted file mode 100644 index 9e5fc6bde8..0000000000 --- a/modules/globebrowsing/shaders/planetarytrail_fs.glsl +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2023 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include "fragment.glsl" - -uniform vec3 color; - -in VertexData { - float opacity; -} fs_in; - -Fragment getFragment() { - Fragment frag; - frag.color = vec4(color, fs_in.opacity); - frag.disableLDR2HDR = true; - return frag; -} diff --git a/modules/globebrowsing/shaders/planetarytrail_gs.glsl b/modules/globebrowsing/shaders/planetarytrail_gs.glsl deleted file mode 100644 index cf1f7011fa..0000000000 --- a/modules/globebrowsing/shaders/planetarytrail_gs.glsl +++ /dev/null @@ -1,132 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2023 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#version __CONTEXT__ - -layout (lines_adjacency) in; -layout (triangle_strip, max_vertices = 6) out; - -uniform vec2 viewport; -uniform float lineWidth; -uniform int nPoints; - -in VertexData { - float opacity; -} gs_in[]; - -out VertexData { - float opacity; -} gs_out; - -void main() -{ - vec4 p0 = gl_in[0].gl_Position; - p0.xyz /= p0.w; - - vec4 p1 = gl_in[1].gl_Position/gl_in[1].gl_Position.w; - p1.xyz /= p1.w; - - vec4 p2 = gl_in[2].gl_Position/gl_in[2].gl_Position.w; - p2.xyz /= p2.w; - - vec4 p3 = gl_in[3].gl_Position/gl_in[3].gl_Position.w; - p3.xyz /= p3.w; - - p0.xy = (p0.xy + 1) * 0.5 * viewport; - p1.xy = (p1.xy + 1) * 0.5 * viewport; - p2.xy = (p2.xy + 1) * 0.5 * viewport; - p3.xy = (p3.xy + 1) * 0.5 * viewport; - - vec2 p = normalize(p1.xy - p0.xy); - vec2 np = vec2(-p.y, p.x); - - vec2 l = normalize(p2.xy - p1.xy); - vec2 nl = vec2(-l.y, l.x); - - vec2 n = normalize(p3.xy - p2.xy); - vec2 nn = vec2(-n.y, n.x); - - vec2 m1 = normalize(nl + np); - vec2 m2 = normalize(nl + nn); - - vec4 pos; - - pos = p1; - pos.xy += np * lineWidth * 0.5; - pos.xy = 2 * pos.xy / viewport - 1; - pos.xyz *= pos.w; - - gs_out.opacity = gs_in[1].opacity; - gl_Position = pos; - EmitVertex(); - - pos = p1; - pos.xy += nl * lineWidth * 0.5; - pos.xy = 2 * pos.xy / viewport - 1; - pos.xyz *= pos.w; - - gs_out.opacity = gs_in[1].opacity; - gl_Position = pos; - EmitVertex(); - - pos = p1; - pos.xy -= nl * lineWidth * 0.5; - pos.xy = 2 * pos.xy / viewport - 1; - pos.xyz *= pos.w; - - gs_out.opacity = gs_in[1].opacity; - gl_Position = pos; - EmitVertex(); - - pos = p2; - pos.xy += nl * lineWidth * 0.5; - pos.xy = 2 * pos.xy / viewport - 1; - pos.xyz *= pos.w; - - gs_out.opacity = gs_in[2].opacity; - gl_Position = pos; - EmitVertex(); - - pos = p2; - pos.xy -= nl * lineWidth * 0.5; - pos.xy = 2 * pos.xy / viewport - 1; - pos.xyz *= pos.w; - - gs_out.opacity = gs_in[2].opacity; - gl_Position = pos; - EmitVertex(); - - if (gl_PrimitiveIDIn < nPoints - 3) { - pos = p2; - pos.xy -= nn * lineWidth * 0.5; - pos.xy = 2 * pos.xy / viewport - 1; - pos.xyz *= pos.w; - - gs_out.opacity = gs_in[2].opacity; - gl_Position = pos; - EmitVertex(); - } - - EndPrimitive(); -} diff --git a/modules/globebrowsing/shaders/planetarytrail_point_fs.glsl b/modules/globebrowsing/shaders/planetarytrail_point_fs.glsl deleted file mode 100644 index bef6f7e7c3..0000000000 --- a/modules/globebrowsing/shaders/planetarytrail_point_fs.glsl +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2023 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include "fragment.glsl" - -uniform vec3 color; - -in VertexData { - float opacity; -} fs_in; - -Fragment getFragment() { - float fact = 1.0 - smoothstep(0.0, 1.0, length(gl_PointCoord - 0.5)); - Fragment frag; - frag.color = vec4(color, fs_in.opacity * fact); - frag.disableLDR2HDR = true; - return frag; -} diff --git a/modules/globebrowsing/shaders/planetarytrail_vs.glsl b/modules/globebrowsing/shaders/planetarytrail_vs.glsl deleted file mode 100644 index 084ae6a025..0000000000 --- a/modules/globebrowsing/shaders/planetarytrail_vs.glsl +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2023 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#version __CONTEXT__ - -layout (location = 0) in vec3 in_position_opacity; - -uniform dmat4 projectionMatrix; - -out VertexData { - float opacity; -} vs_out; - -void main() { - vs_out.opacity = in_position_opacity.z; - vec4 pos = vec4(projectionMatrix * vec4(in_position_opacity.xy, 0, 1)); - gl_Position = pos; -} diff --git a/modules/globebrowsing/shaders/texturetilemapping.glsl b/modules/globebrowsing/shaders/texturetilemapping.glsl index 39e1a8bfce..1c714f112e 100644 --- a/modules/globebrowsing/shaders/texturetilemapping.glsl +++ b/modules/globebrowsing/shaders/texturetilemapping.glsl @@ -168,12 +168,6 @@ vec4 getSample#{layerGroup}#{i}(vec2 uv, vec3 levelWeights, c = getTexVal(#{layerGroup}[#{i}].pile, levelWeights, uv); #elif (#{#{layerGroup}#{i}LayerType} == 11) // VideoTileProvider c = getTexVal(#{layerGroup}[#{i}].pile, levelWeights, uv); -#elif (#{#{layerGroup}#{i}LayerType} == 12) // PlanetaryTrailTileProvider - c = getTexVal(#{layerGroup}[#{i}].pile, levelWeights, uv); -#elif (#{#{layerGroup}#{i}LayerType} == 13) // ForceHighResolutionTileProvider - // does nothing but uses variables to avoid compilation warnings.... - LayerSettings settings = #{layerGroup}[#{i}].settings; - c *= settings.gamma * settings.multiplier * min(settings.opacity, 0); #endif return c; diff --git a/modules/globebrowsing/src/geodeticpatch.cpp b/modules/globebrowsing/src/geodeticpatch.cpp index 6011a13474..61b1392b31 100644 --- a/modules/globebrowsing/src/geodeticpatch.cpp +++ b/modules/globebrowsing/src/geodeticpatch.cpp @@ -138,20 +138,6 @@ bool GeodeticPatch::contains(const Geodetic2& p) const { return std::abs(diff.lat) <= _halfSize.lat && std::abs(diff.lon) <= _halfSize.lon; } -bool GeodeticPatch::overlaps(const GeodeticPatch& p) const { - const auto lhsX1 = minLon(); - const auto lhsX2 = maxLon(); - const auto lhsY1 = minLat(); - const auto lhsY2 = maxLat(); - - const auto rhsX1 = p.minLon(); - const auto rhsX2 = p.maxLon(); - const auto rhsY1 = p.minLat(); - const auto rhsY2 = p.maxLat(); - - return (lhsX1 < rhsX2 && rhsX1 < lhsX2) && (lhsY1 < rhsY2 && rhsY1 < lhsY2); -} - double GeodeticPatch::edgeLatitudeNearestEquator() const { return _center.lat + _halfSize.lat * (isNorthern() ? -1.0 : 1.0); } diff --git a/modules/globebrowsing/src/geodeticpatch.h b/modules/globebrowsing/src/geodeticpatch.h index 6fabc1f4da..4cd75dcc92 100644 --- a/modules/globebrowsing/src/geodeticpatch.h +++ b/modules/globebrowsing/src/geodeticpatch.h @@ -68,12 +68,6 @@ public: */ bool contains(const Geodetic2& p) const; - /** - * Returns `true` if there is an overlap between this patch and specified patch - */ - bool overlaps(const GeodeticPatch& p) const; - - /** * Clamps a point to the patch region. */ diff --git a/modules/globebrowsing/src/gpulayergroup.cpp b/modules/globebrowsing/src/gpulayergroup.cpp index fc3d260928..6906dcf42d 100644 --- a/modules/globebrowsing/src/gpulayergroup.cpp +++ b/modules/globebrowsing/src/gpulayergroup.cpp @@ -76,7 +76,6 @@ void GPULayerGroup::setValue(ghoul::opengl::ProgramObject& program, case layers::Layer::ID::TileIndexTileProvider: case layers::Layer::ID::TileProviderByDate: case layers::Layer::ID::TileProviderByIndex: - case layers::Layer::ID::PlanetaryTrailTileProvider: case layers::Layer::ID::TileProviderByLevel: { const ChunkTilePile& ctp = al.chunkTilePile( tileIndex, @@ -150,7 +149,6 @@ void GPULayerGroup::bind(ghoul::opengl::ProgramObject& p, const LayerGroup& laye case layers::Layer::ID::TileIndexTileProvider: case layers::Layer::ID::TileProviderByDate: case layers::Layer::ID::TileProviderByIndex: - case layers::Layer::ID::PlanetaryTrailTileProvider: case layers::Layer::ID::TileProviderByLevel: { gal.gpuChunkTiles.resize(pileSize); for (size_t j = 0; j < gal.gpuChunkTiles.size(); j++) { diff --git a/modules/globebrowsing/src/layer.cpp b/modules/globebrowsing/src/layer.cpp index b8c39e53d8..301089affa 100644 --- a/modules/globebrowsing/src/layer.cpp +++ b/modules/globebrowsing/src/layer.cpp @@ -132,8 +132,7 @@ namespace { "SingleImageProvider", "ImageSequenceTileProvider", "SizeReferenceTileProvider", "TemporalTileProvider", "TileIndexTileProvider", "TileProviderByDate", "TileProviderByIndex", "TileProviderByLevel", - "SolidColor", "SpoutImageProvider", "VideoTileProvider", "PlanetaryTrailTileProvider", - "ForceHighResolutionTileProvider")]]; + "SolidColor", "SpoutImageProvider", "VideoTileProvider")]]; // Determine whether the layer is enabled or not. If this value is not specified, // the layer is disabled @@ -329,8 +328,6 @@ Layer::Layer(layers::Group::ID id, const ghoul::Dictionary& layerDict, LayerGrou case layers::Layer::ID::TileProviderByIndex: case layers::Layer::ID::TileProviderByLevel: case layers::Layer::ID::VideoTileProvider: - case layers::Layer::ID::PlanetaryTrailTileProvider: - case layers::Layer::ID::ForceHighResolutionTileProvider: if (_tileProvider) { removePropertySubOwner(*_tileProvider); } @@ -503,8 +500,6 @@ void Layer::initializeBasedOnType(layers::Layer::ID id, ghoul::Dictionary initDi case layers::Layer::ID::TileProviderByIndex: case layers::Layer::ID::TileProviderByLevel: case layers::Layer::ID::VideoTileProvider: - case layers::Layer::ID::PlanetaryTrailTileProvider: - case layers::Layer::ID::ForceHighResolutionTileProvider: // We add the id to the dictionary since it needs to be known by // the tile provider initDict.setValue( @@ -539,8 +534,6 @@ void Layer::addVisibleProperties() { case layers::Layer::ID::TileProviderByIndex: case layers::Layer::ID::TileProviderByLevel: case layers::Layer::ID::VideoTileProvider: - case layers::Layer::ID::PlanetaryTrailTileProvider: - case layers::Layer::ID::ForceHighResolutionTileProvider: if (_tileProvider) { addPropertySubOwner(*_tileProvider); } diff --git a/modules/globebrowsing/src/layergroupid.h b/modules/globebrowsing/src/layergroupid.h index edceb967eb..f71d214ece 100644 --- a/modules/globebrowsing/src/layergroupid.h +++ b/modules/globebrowsing/src/layergroupid.h @@ -90,8 +90,6 @@ struct Layer { SolidColor, SpoutImageProvider, VideoTileProvider, - PlanetaryTrailTileProvider, - ForceHighResolutionTileProvider, Unknown }; @@ -99,7 +97,7 @@ struct Layer { std::string_view identifier; }; -constexpr std::array Layers = { +constexpr std::array Layers = { Layer { .id = Layer::ID::DefaultTileProvider, .identifier = "DefaultTileProvider" @@ -147,14 +145,6 @@ constexpr std::array Layers = { Layer { .id = Layer::ID::VideoTileProvider, .identifier = "VideoTileProvider" - }, - Layer { - .id = Layer::ID::PlanetaryTrailTileProvider, - .identifier = "PlanetaryTrailTileProvider" - }, - Layer { - .id = Layer::ID::ForceHighResolutionTileProvider, - .identifier = "ForceHighResolutionTileProvider" } }; diff --git a/modules/globebrowsing/src/rawtiledatareader.cpp b/modules/globebrowsing/src/rawtiledatareader.cpp index 86afa349ff..fee3dfea1c 100644 --- a/modules/globebrowsing/src/rawtiledatareader.cpp +++ b/modules/globebrowsing/src/rawtiledatareader.cpp @@ -686,6 +686,10 @@ TileMetaData RawTileDataReader::tileMetaData(RawTile& rawTile, } } + if (allIsMissing) { + rawTile.error = RawTile::ReadError::Failure; + } + return ppData; } diff --git a/modules/globebrowsing/src/tileprovider/forcehighresolutiontileprovider.cpp b/modules/globebrowsing/src/tileprovider/forcehighresolutiontileprovider.cpp deleted file mode 100644 index f99a9cafb0..0000000000 --- a/modules/globebrowsing/src/tileprovider/forcehighresolutiontileprovider.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2023 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include - -namespace { -} - -namespace openspace::globebrowsing { - -ForceHighResolutionTileProvider::ForceHighResolutionTileProvider(const ghoul::Dictionary& dictionary) {} - -ForceHighResolutionTileProvider::~ForceHighResolutionTileProvider() {} - -Tile ForceHighResolutionTileProvider::tile(const globebrowsing::TileIndex& tileIndex) { - return Tile{ 0, std::nullopt, Tile::Status::OK }; -} - -Tile::Status ForceHighResolutionTileProvider::tileStatus(const globebrowsing::TileIndex& tileIndex) { - return globebrowsing::Tile::Status::OK; -} - -TileDepthTransform ForceHighResolutionTileProvider::depthTransform() { - return { 0.f, 1.f }; -} - -void ForceHighResolutionTileProvider::update() { - ZoneScoped; -} - -int ForceHighResolutionTileProvider::minLevel() { - return 1; -} - -int ForceHighResolutionTileProvider::maxLevel() { - return 1337; -} - -float ForceHighResolutionTileProvider::noDataValueAsFloat() { - return std::numeric_limits::min(); -} - -void ForceHighResolutionTileProvider::reset() { -} - -} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/src/tileprovider/forcehighresolutiontileprovider.h b/modules/globebrowsing/src/tileprovider/forcehighresolutiontileprovider.h deleted file mode 100644 index 4f4fcb77ec..0000000000 --- a/modules/globebrowsing/src/tileprovider/forcehighresolutiontileprovider.h +++ /dev/null @@ -1,49 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2025 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___TILEPROVIDER__FORCEHIGHRESOLUTIONTILEPROVIDER___H__ -#define __OPENSPACE_MODULE_GLOBEBROWSING___TILEPROVIDER__FORCEHIGHRESOLUTIONTILEPROVIDER___H__ - -#include - -namespace openspace::globebrowsing { - -class ForceHighResolutionTileProvider : public TileProvider { -public: - ForceHighResolutionTileProvider(const ghoul::Dictionary& dictionary); - ~ForceHighResolutionTileProvider() override; - - Tile tile(const TileIndex& tileIndex) override final; - Tile::Status tileStatus(const TileIndex& index) override final; - TileDepthTransform depthTransform() override final; - void update() override final; - int minLevel() override final; - int maxLevel() override final; - float noDataValueAsFloat() override final; - void reset() override; -}; - -} // namespace openspace::globebrowsing - -#endif // __OPENSPACE_MODULE_GLOBEBROWSING___TILEPROVIDER__FORCEHIGHRESOLUTIONTILEPROVIDER___H__ diff --git a/modules/globebrowsing/src/tileprovider/planetarytrailtileprovider.cpp b/modules/globebrowsing/src/tileprovider/planetarytrailtileprovider.cpp deleted file mode 100644 index 6a6c67a882..0000000000 --- a/modules/globebrowsing/src/tileprovider/planetarytrailtileprovider.cpp +++ /dev/null @@ -1,762 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2023 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace { - enum class KernelSize { - Disabled = 0, - Five = 5, - Nine = 9, - Thirteen = 13 - }; - - enum class RenderingMode { - Lines = 0, - Points, - LinesPoints - }; - - constexpr openspace::properties::Property::PropertyInfo JSONPathInfo = { - "JSON", - "JSON", - "The path of the JSON file to use with this tile provider", - openspace::properties::Property::Visibility::NoviceUser - }; - - constexpr openspace::properties::Property::PropertyInfo StartTimeInfo = { - "StartTime", - "Start Time", - "The start time for the range of this planetary trail. Its internal" - "start time will be adjusted with this value.", - openspace::properties::Property::Visibility::NoviceUser - }; - - constexpr openspace::properties::Property::PropertyInfo ResolutionInfo = { - "Resolution", - "Resolution", - "The resolution of the underlying rendertarget in the largest dimension", - openspace::properties::Property::Visibility::AdvancedUser - }; - - constexpr openspace::properties::Property::PropertyInfo LineColorInfo = { - "LineColor", - "Line Color", - "This value determines the RGB color of the lines composing the planetary trail", - openspace::properties::Property::Visibility::NoviceUser - }; - - constexpr openspace::properties::Property::PropertyInfo PointColorInfo = { - "PointColor", - "Point Color", - "This value determines the RGB color of the points composing the planetary trail", - openspace::properties::Property::Visibility::NoviceUser - }; - - constexpr openspace::properties::Property::PropertyInfo CutoffInfo = { - "CutOff", - "Cutoff", - "This value specifies the trail cutoff (in seconds). The higher the value the " - "longer the tail of the trail will be.", - openspace::properties::Property::Visibility::User - }; - - constexpr openspace::properties::Property::PropertyInfo CutaheadInfo = { - "CutAhead", - "CutAhead", - "This value specifies the trail cut ahead (in seconds). The higher the value the " - "longer from the head of the trail will be faded out.", - openspace::properties::Property::Visibility::User - }; - - constexpr openspace::properties::Property::PropertyInfo LineWidthInfo = { - "LineWidth", - "Line Width", - "This value specifies the line width of the planetary trail.", - openspace::properties::Property::Visibility::User - }; - - constexpr openspace::properties::Property::PropertyInfo PointSizeInfo = { - "PointSize", - "Point Size", - "This value specifies the point size of the planetary trail.", - openspace::properties::Property::Visibility::User - }; - - constexpr openspace::properties::Property::PropertyInfo KernelSizeInfo = { - "KernelSize", - "Kernel size", - "Specifies the kernel size of the gaussian blur filter used to smooth out" - "the edges of rendered path.", - openspace::properties::Property::Visibility::User - }; - - constexpr openspace::properties::Property::PropertyInfo RenderFullTrailInfo = { - "RenderFullTrail", - "Render Full Trail", - "If this value is set to 'true', the entire planetary trail will be rendered;" - "if it is 'false', only the portion of the trail up until the current time" - "in the application will be shown", - openspace::properties::Property::Visibility::NoviceUser - }; - - constexpr openspace::properties::Property::PropertyInfo RenderingModeInfo = { - "Rendering", - "Rendering Mode", - "Determines how the trail should be rendered to the screen. If 'Lines' is " - "selected, only the line part is visible, if 'Points' is selected, only the " - "corresponding points (and subpoints) are shown. 'Lines+Points' shows both parts", - openspace::properties::Property::Visibility::AdvancedUser - }; - - struct [[codegen::Dictionary(PlanetaryTrailTileProvider)]] Parameters { - // [[codegen::verbatim(JSONPathInfo.description)]] - std::string JSON; - - // [[codegen::verbatim(StartTimeInfo.description)]] - std::string startTime [[codegen::annotation("A valid date in ISO 8601 format")]]; - - // [[codegen::verbatim(ResolutionInfo.description)]] - std::optional resolution; - - // [[codegen::verbatim(LineWidthInfo.description)]] - std::optional lineWidth; - - // [[codegen::verbatim(PointSizeInfo.description)]] - std::optional pointSize; - - // [[codegen::verbatim(CutoffInfo.description)]] - std::optional cutoff; - - // [[codegen::verbatim(CutaheadInfo.description)]] - std::optional cutahead; - - // [[codegen::verbatim(LineColorInfo.description)]] - std::optional lineColor [[codegen::color()]]; - - // [[codegen::verbatim(PointColorInfo.description)]] - std::optional pointColor [[codegen::color()]]; - - // [[codegen::verbatim(RenderFullTrailInfo.description)]] - std::optional renderFullTrail; - - enum class [[codegen::map(KernelSize)]] KernelSize { - Disabled = 0, - Five = 5, - Nine = 9, - Thirteen = 13 - }; - // [[codegen::verbatim(KernelSizeInfo.description)]] - std::optional kernelSize; - - enum class [[codegen::map(RenderingMode)]] RenderingMode { - Lines, - Points, - LinesPoints [[codegen::key("Lines+Points")]] - }; - // [[codegen::verbatim(RenderingModeInfo.description)]] - std::optional renderingMode [[codegen::key("RenderingMode")]]; - }; - -#include "planetarytrailtileprovider_codegen.cpp" -} - -namespace openspace::globebrowsing { - -PlanetaryTrailTileProvider::PlanetaryTrailTileProvider(const ghoul::Dictionary& dictionary) : - _JSONPath(JSONPathInfo), - _startTime(StartTimeInfo), - _resolution(ResolutionInfo, 4096, 256, OpenGLCap.max2DTextureSize()), - _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(1.f), glm::vec3(1.f)), - _pointColor(PointColorInfo, glm::vec3(1.f), glm::vec3(1.f), glm::vec3(1.f)), - _lineWidth(LineWidthInfo, 10.f, 1.f, 1000.f), - _pointSize(PointSizeInfo, 10.f, 1.f, 1000.f), - _cutoff(CutoffInfo, 30.f, 0.f, 3600.f, 1.f), - _cutahead(CutaheadInfo, 10.f, 0.f, 60.f, 1.f), - _renderFullTrail(RenderFullTrailInfo, false), - _kernelSize(KernelSizeInfo), - _renderingMode(RenderingModeInfo), - _start(0.0), - _fbo(0), - _vao(0), - _vbo(0), - _bounds(-1.0, -1.0, -1.0, -1.0), - _rendertargetDimensions(-1, -1) -{ - ZoneScoped; - - addProperty(_JSONPath); - _JSONPath.setReadOnly(true); - - addProperty(_startTime); - _startTime.setReadOnly(true); - - addProperty(_resolution); - _resolution.setReadOnly(true); - - _lineColor.setViewOption(properties::Property::ViewOptions::Color); - addProperty(_lineColor); - - _pointColor.setViewOption(properties::Property::ViewOptions::Color); - addProperty(_pointColor); - - addProperty(_lineWidth); - - addProperty(_pointSize); - - addProperty(_cutoff); - - addProperty(_cutahead); - - addProperty(_renderFullTrail); - - _kernelSize.addOptions({ - { static_cast(KernelSize::Disabled), "Disabled" }, - { static_cast(KernelSize::Five), "5" }, - { static_cast(KernelSize::Nine), "9" }, - { static_cast(KernelSize::Thirteen), "13" }, - }); - addProperty(_kernelSize); - - _renderingMode.addOptions({ - { static_cast(RenderingMode::Lines), "Lines" }, - { static_cast(RenderingMode::Points), "Points" }, - { static_cast(RenderingMode::LinesPoints), "Lines+Points" } - }); - addProperty(_renderingMode); - - const Parameters p = codegen::bake(dictionary); - _JSONPath = p.JSON; - _startTime = p.startTime; - _resolution = p.resolution.value_or(_resolution); - _lineColor = p.lineColor.value_or(_lineColor); - _lineWidth = p.lineWidth.value_or(_lineWidth); - _pointColor = p.pointColor.value_or(_pointColor); - _pointSize = p.pointSize.value_or(_pointSize); - _cutoff = p.cutoff.value_or(_cutoff); - _cutahead = p.cutahead.value_or(_cutahead); - _renderFullTrail = p.renderFullTrail.value_or(_renderFullTrail); - if (p.kernelSize.has_value()) { - _kernelSize = static_cast(codegen::map(*p.kernelSize)); - } - - if (p.renderingMode.has_value()) { - _renderingMode = static_cast(codegen::map(*p.renderingMode)); - } -} - -PlanetaryTrailTileProvider::~PlanetaryTrailTileProvider() {} - -void PlanetaryTrailTileProvider::internalInitialize() { - ZoneScoped; - - const auto _loggerCat = "PlanetaryTrailTileProvider"; - std::ifstream file(absPath(_JSONPath)); - nlohmann::json content = nlohmann::json::parse(file); - double minLon = std::numeric_limits::max(); - double maxLon = -std::numeric_limits::max(); - double minLat = std::numeric_limits::max(); - double maxLat = -std::numeric_limits::max(); - for (const auto feature : content.at("features")) { - try { - const int time = feature.at("properties").at("surface_seconds").get(); - - const auto coords = feature.at("geometry").at("coordinates"); - const std::array lonlat = {coords[0].get(), coords[1].get()}; - const double lon = glm::radians(lonlat[0]); - const double lat = glm::radians(lonlat[1]); - - _features.push_back({ lon, lat, time }); - minLon = std::min(minLon, lon); - maxLon = std::max(maxLon, lon); - minLat = std::min(minLat, lat); - maxLat = std::max(maxLat, lat); - } catch (nlohmann::json::exception e) { - // ... Raise a warning here about missing required data - } - } - - // To avoid points/lines being clipped at the end of the region-of-interest - // we extend our region by 2.5% in all directions. (magic number) - constexpr double ext = 1.025; - const double halfSizeLon = std::abs(maxLon - minLon) / 2.0; - const double halfSizeLat = std::abs(maxLat - minLat) / 2.0; - _bounds = GeodeticPatch( - maxLat - halfSizeLat, - maxLon - halfSizeLon, - halfSizeLat * ext, - halfSizeLon * ext - ); - - // Convert the start and end time from string representations to J2000 seconds - _start = SpiceManager::ref().ephemerisTimeFromDate(_startTime); - - glGenFramebuffers(1, &_fbo); - glGenVertexArrays(1, &_vao); - glGenBuffers(1, &_vbo); - - glBindVertexArray(_vao); - glBindBuffer(GL_ARRAY_BUFFER, _vbo); - - glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 3, GL_DOUBLE, GL_FALSE, 3 * sizeof(double), nullptr); - - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindVertexArray(0); - - _lineProgram = global::renderEngine->buildRenderProgram( - "PlanetaryTrailLineProgram", - absPath("${MODULE_GLOBEBROWSING}/shaders/planetarytrail_vs.glsl"), - absPath("${MODULE_GLOBEBROWSING}/shaders/planetarytrail_fs.glsl"), - absPath("${MODULE_GLOBEBROWSING}/shaders/planetarytrail_gs.glsl") - ); - - _pointProgram = global::renderEngine->buildRenderProgram( - "PlanetaryTrailLineProgram", - absPath("${MODULE_GLOBEBROWSING}/shaders/planetarytrail_vs.glsl"), - absPath("${MODULE_GLOBEBROWSING}/shaders/planetarytrail_point_fs.glsl") - ); - - const double aspect = halfSizeLon / halfSizeLat; - _rendertargetDimensions = { - aspect > 1.0 ? _resolution : _resolution * aspect, - aspect > 1.0 ? _resolution / aspect : _resolution - }; - - _texture = std::make_unique( - glm::uvec3(_rendertargetDimensions.x, _rendertargetDimensions.y, 1), - GL_TEXTURE_2D - ); - glBindTexture(GL_TEXTURE_2D, *_texture); - glTexParameterfv( - GL_TEXTURE_2D, - GL_TEXTURE_BORDER_COLOR, - glm::value_ptr(glm::vec4(0.f, 0.f, 0.f, 0.f)) - ); - glTexParameteri( - GL_TEXTURE_2D, - GL_TEXTURE_WRAP_S, - GL_CLAMP_TO_BORDER - ); - glTexParameteri( - GL_TEXTURE_2D, - GL_TEXTURE_WRAP_T, - GL_CLAMP_TO_BORDER - ); - glTexParameteri( - GL_TEXTURE_2D, - GL_TEXTURE_MAG_FILTER, - GL_LINEAR - ); - glTexParameteri( - GL_TEXTURE_2D, - GL_TEXTURE_MIN_FILTER, - GL_LINEAR - ); - - glTexImage2D( - GL_TEXTURE_2D, - 0, - GL_RGBA, - static_cast(_rendertargetDimensions.x), - static_cast(_rendertargetDimensions.y), - 0, - GL_RGBA, - GL_UNSIGNED_BYTE, - nullptr - ); - glBindTexture(GL_TEXTURE_2D, 0); - - static constexpr GLfloat vertices[] = { - -1.f, -1.f, - 1.f, -1.f, - -1.f, 1.f, - -1.f, 1.f, - 1.f, -1.f, - 1.f, 1.f, - }; - - glGenVertexArrays(1, &_quadVao); - glBindVertexArray(_quadVao); - glGenBuffers(1, &_quadVbo); - glBindBuffer(GL_ARRAY_BUFFER, _quadVbo); - glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); - glEnableVertexAttribArray(0); - glVertexAttribPointer( - 0, - 2, - GL_FLOAT, - GL_FALSE, - 2 * sizeof(GL_FLOAT), - reinterpret_cast(0) - ); - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindVertexArray(0); - - _texture2 = std::make_unique( - glm::uvec3(_rendertargetDimensions.x, _rendertargetDimensions.y, 1), - GL_TEXTURE_2D - ); - - glBindTexture(GL_TEXTURE_2D, *_texture2); - glTexParameteri( - GL_TEXTURE_2D, - GL_TEXTURE_MAG_FILTER, - GL_LINEAR - ); - glTexParameteri( - GL_TEXTURE_2D, - GL_TEXTURE_MIN_FILTER, - GL_LINEAR - ); - - glTexImage2D( - GL_TEXTURE_2D, - 0, - GL_RGBA, - static_cast(_rendertargetDimensions.x), - static_cast(_rendertargetDimensions.y), - 0, - GL_RGBA, - GL_UNSIGNED_BYTE, - nullptr - ); - glBindTexture(GL_TEXTURE_2D, 0); - - glGenFramebuffers(1, &_fbo2); - - _program2 = global::renderEngine->buildRenderProgram( - "PlanetaryTrailBlurProgram", - absPath("${MODULE_GLOBEBROWSING}/shaders/planetarytrail_blur_vs.glsl"), - absPath("${MODULE_GLOBEBROWSING}/shaders/planetarytrail_blur_fs.glsl") - ); - - update(); -} - -void PlanetaryTrailTileProvider::internalDeinitialize() { - glDeleteFramebuffers(1, &_fbo); - glDeleteBuffers(1, &_vbo); - glDeleteVertexArrays(1, &_vao); - _texture.reset(); -} - -Tile PlanetaryTrailTileProvider::tile(const globebrowsing::TileIndex& tileIndex) { - return Tile{ _texture.get(), std::nullopt, Tile::Status::OK }; -} - -Tile::Status PlanetaryTrailTileProvider::tileStatus(const globebrowsing::TileIndex& tileIndex) { - GeodeticPatch patch(tileIndex); - if (_bounds.overlaps(patch)) { - return Tile::Status::OK; - } - return globebrowsing::Tile::Status::OutOfRange; -} - -TileDepthTransform PlanetaryTrailTileProvider::depthTransform() { - return { 0.f, 1.f }; -} - -globebrowsing::ChunkTile PlanetaryTrailTileProvider::chunkTile( - globebrowsing::TileIndex tileIndex, - int parents, - int maxParents) -{ - using namespace globebrowsing; - std::function ascendToParent = - [](TileIndex& ti, TileUvTransform&) { - ti.x /= 2; - ti.y /= 2; - ti.level--; - }; - - const GeodeticPatch patch(tileIndex); - const double u0 - = (patch.minLon() - _bounds.minLon()) / (_bounds.maxLon() - _bounds.minLon()); - const double u1 - = (patch.maxLon() - _bounds.minLon()) / (_bounds.maxLon() - _bounds.minLon()); - const double v0 - = (patch.minLat() - _bounds.minLat()) / (_bounds.maxLat() - _bounds.minLat()); - const double v1 - = (patch.maxLat() - _bounds.minLat()) / (_bounds.maxLat() - _bounds.minLat()); - - TileUvTransform uvTransform = { - .uvOffset = glm::vec2(u0, v0), - .uvScale = glm::vec2(u1 - u0, v1 - v0) - }; - - return traverseTree(tileIndex, parents, maxParents, ascendToParent, uvTransform); -} - -void PlanetaryTrailTileProvider::update() { - ZoneScoped; - - // Necessary since update is called before internalInitialize - // @TODO(jockekilby): remove when https://github.com/OpenSpace/OpenSpace/issues/2679 is fixed - if (!_texture) { - return; - } - - std::vector> points; - // add two for adjacency information in rendering - points.reserve(_features.size() + 2); - - if (_renderFullTrail) { - std::transform( - _features.begin(), - _features.end(), - std::back_inserter(points), - [](const Feature& feature) { - return std::array{ feature._lat, feature._lon, 1.0 }; - }); - } - else { - const double t = openspace::global::timeManager->time().j2000Seconds(); - if (_start <= t) { - const double now = t - _start; - for (const Feature& feature : _features) { - if (feature._time > now) { - break; - } - - double opacity = 1.; - if (_cutoff > 0.f) { - opacity = std::min( - opacity, - glm::smoothstep( - now - _cutoff, - now, - static_cast(feature._time)) - ); - } - - if (_cutahead > 0.) { - opacity = std::min( - opacity, - 1.0 - glm::smoothstep( - now - _cutahead, - now, - static_cast(feature._time)) - ); - } - - points.push_back({ feature._lat, feature._lon, opacity }); - } - - const size_t num_points = points.size(); - if (num_points < _features.size()) { - const Feature& prev = _features[num_points - 1]; - const Feature& next = _features[num_points]; - const double fact = (now - prev._time) / (next._time - prev._time); - - points.push_back({ - prev._lat + fact * (next._lat - prev._lat), - prev._lon + fact * (next._lon - prev._lon), - _cutahead > 0. ? 1.0 - glm::smoothstep( - now - _cutahead, - now, - prev._time + fact * (next._time - prev._time) - ) : 1.0 - }); - } - } - } - - if(points.size() > 0) { - // duplicate first & last points so we don't loose them - // to adjacency information during rendering - points.insert(points.begin(), points.front()); - points.push_back(points.back()); - } - - const glm::dmat4 projection = glm::ortho( - _bounds.minLon(), - _bounds.maxLon(), - _bounds.minLat(), - _bounds.maxLat() - ); - - GLint prevProgram, prevFBO; - glGetIntegerv(GL_CURRENT_PROGRAM, &prevProgram); - glGetIntegerv(GL_FRAMEBUFFER_BINDING, &prevFBO); - - glBindFramebuffer(GL_FRAMEBUFFER, _fbo); - glFramebufferTexture2D( - GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, - *_texture.get(), - 0 - ); - - glViewport( - 0, - 0, - static_cast(_rendertargetDimensions.x), - static_cast(_rendertargetDimensions.y) - ); - - glClearColor(.0f, .0f, .0f, 0.f); - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - glBindVertexArray(_vao); - - glBindBuffer(GL_ARRAY_BUFFER, _vbo); - glBufferData( - GL_ARRAY_BUFFER, - points.size() * sizeof(std::array), - points.data(), - GL_DYNAMIC_DRAW - ); - - if (_renderingMode == static_cast(RenderingMode::Lines) || - _renderingMode == static_cast(RenderingMode::LinesPoints)) { - _lineProgram->activate(); - _lineProgram->setUniform("viewport", - glm::vec2(_rendertargetDimensions.x, _rendertargetDimensions.y)); - _lineProgram->setUniform("lineWidth", _lineWidth); - _lineProgram->setUniform("nPoints", static_cast(points.size() - 1)); - _lineProgram->setUniform("color", _lineColor); - _lineProgram->setUniform("projectionMatrix", projection); - glDrawArrays(GL_LINE_STRIP_ADJACENCY, 0, points.size()); - } - - if (_renderingMode == static_cast(RenderingMode::Points) || - _renderingMode == static_cast(RenderingMode::LinesPoints) - ) { - _pointProgram->activate(); - _pointProgram->setUniform("color", _pointColor); - _pointProgram->setUniform("projectionMatrix", projection); - - glPointSize(static_cast(_pointSize)); - // -1 to leave out the duplicated point necessary for line-rendering - glDrawArrays(GL_POINTS, 0, points.size() - 1); - } - - if (_kernelSize.value() != static_cast(KernelSize::Disabled)) { - // Two-pass blur - - // First pass - horizontally - glBindFramebuffer(GL_FRAMEBUFFER, _fbo2); - glFramebufferTexture2D( - GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, - *_texture2.get(), - 0 - ); - - glViewport( - 0, - 0, - static_cast(_rendertargetDimensions.x), - static_cast(_rendertargetDimensions.y) - ); - glClear(GL_COLOR_BUFFER_BIT); - - _program2->activate(); - _program2->setUniform("resolution", - glm::vec2(_rendertargetDimensions.x, _rendertargetDimensions.y)); - _program2->setUniform("direction", glm::vec2(1, 0)); - _program2->setUniform("kernelSize", _kernelSize.value()); - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, *_texture.get()); - glBindVertexArray(_quadVao); - glDrawArrays(GL_TRIANGLES, 0, 6); - - // First pass - vertically - glBindFramebuffer(GL_FRAMEBUFFER, _fbo); - glFramebufferTexture2D( - GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, - *_texture.get(), - 0 - ); - - glViewport( - 0, - 0, - static_cast(_rendertargetDimensions.x), - static_cast(_rendertargetDimensions.y) - ); - glClear(GL_COLOR_BUFFER_BIT); - - _program2->activate(); - _program2->setUniform("resolution", - glm::vec2(_rendertargetDimensions.x, _rendertargetDimensions.y)); - _program2->setUniform("direction", glm::vec2(0, 1)); - _program2->setUniform("kernelSize", _kernelSize.value()); - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, *_texture2.get()); - glBindVertexArray(_quadVao); - glDrawArrays(GL_TRIANGLES, 0, 6); - } - - // Reset FBO, shader program and viewport - glUseProgram(prevProgram); - glBindFramebuffer(GL_FRAMEBUFFER, prevFBO); - global::renderEngine->openglStateCache().resetViewportState(); -} - -void PlanetaryTrailTileProvider::reset() { -} - -int PlanetaryTrailTileProvider::minLevel() { - return 1; -} - -int PlanetaryTrailTileProvider::maxLevel() { - return 1337; -} - -float PlanetaryTrailTileProvider::noDataValueAsFloat() { - return std::numeric_limits::min(); -} - -} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/src/tileprovider/planetarytrailtileprovider.h b/modules/globebrowsing/src/tileprovider/planetarytrailtileprovider.h deleted file mode 100644 index 81789bfc82..0000000000 --- a/modules/globebrowsing/src/tileprovider/planetarytrailtileprovider.h +++ /dev/null @@ -1,95 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2023 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___TILEPROVIDER__PLANETARYTRAILTILEPROVIDER___H__ -#define __OPENSPACE_MODULE_GLOBEBROWSING___TILEPROVIDER__PLANETARYTRAILTILEPROVIDER___H__ - -#include -#include -#include -#include -#include -#include -#include - -namespace openspace::globebrowsing { - -class PlanetaryTrailTileProvider : public TileProvider { -public: - PlanetaryTrailTileProvider(const ghoul::Dictionary& dictionary); - ~PlanetaryTrailTileProvider() override; - - void update() override final; - void reset() override final; - int minLevel() override final; - int maxLevel() override final; - float noDataValueAsFloat() override final; - globebrowsing::Tile tile(const globebrowsing::TileIndex& tileIndex) override final; - globebrowsing::Tile::Status tileStatus( - const globebrowsing::TileIndex& tileIndex) override final; - globebrowsing::TileDepthTransform depthTransform() override final; - globebrowsing::ChunkTile chunkTile(globebrowsing::TileIndex tileIndex, int parents, - int maxParents = 1337) override; -private: - void internalInitialize() override final; - void internalDeinitialize() override final; - - properties::StringProperty _JSONPath; - properties::StringProperty _startTime; - properties::IntProperty _resolution; - properties::Vec3Property _lineColor; - properties::Vec3Property _pointColor; - properties::FloatProperty _lineWidth; - properties::FloatProperty _pointSize; - properties::FloatProperty _cutoff; - properties::FloatProperty _cutahead; - properties::BoolProperty _renderFullTrail; - properties::OptionProperty _kernelSize; - properties::OptionProperty _renderingMode; - - struct Feature { - double _lat, _lon; - int _time; - }; - - double _start = 0.0; - GLuint _fbo = 0; - GLuint _fbo2 = 0; - GLuint _vao = 0; - GLuint _vbo = 0; - GLuint _quadVao = 0; - GLuint _quadVbo = 0; - GeodeticPatch _bounds; - glm::ivec2 _rendertargetDimensions; - std::unique_ptr _lineProgram; - std::unique_ptr _pointProgram; - std::unique_ptr _program2; - std::unique_ptr _texture; - std::unique_ptr _texture2; - std::vector _features; -}; - -} // namespace openspace::globebrowsing - -#endif // __OPENSPACE_MODULE_GLOBEBROWSING___TILEPROVIDER__PLANETARYTRAILTILEPROVIDER___H__ diff --git a/modules/video/include/videoplayer.h b/modules/video/include/videoplayer.h index 1d70b75b3e..b53ef97dd4 100644 --- a/modules/video/include/videoplayer.h +++ b/modules/video/include/videoplayer.h @@ -158,14 +158,6 @@ private: bool _isSeeking = false; // Prevent seeking while already seeking bool _isDestroying = false; double _seekThreshold = 1.0; // Threshold to ensure we seek to a different time - - // There is currently an issue that we are calling the `update` methods of all objects - // in the scene multiple times per frame. Once in the preSync and once in the - // postSync. This throws libMPV off, so we need to make sure we only actually do the - // work once per frame. - // This semaphore-ish construct will be reset to `true` at the end of the frame and - // ensure that only the first `update` will get to do some work - bool _preventMultipleUpdatesSemaphore = true; }; } // namespace video::globebrowsing diff --git a/shaders/framebuffer/renderframebuffer.frag b/shaders/framebuffer/renderframebuffer.frag index 92bde195e1..6ec63d773d 100644 --- a/shaders/framebuffer/renderframebuffer.frag +++ b/shaders/framebuffer/renderframebuffer.frag @@ -54,7 +54,8 @@ void main() { if (f.disableDepthNormalization) { gl_FragDepth = f.depth; - } else { + } + else { gl_FragDepth = normalizeFloat(f.depth); } } diff --git a/src/navigation/keyframenavigator.cpp b/src/navigation/keyframenavigator.cpp index 209ea4d446..cff0f416ca 100644 --- a/src/navigation/keyframenavigator.cpp +++ b/src/navigation/keyframenavigator.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/src/navigation/navigationhandler.cpp b/src/navigation/navigationhandler.cpp index 2218f550b4..29fb6e96e3 100644 --- a/src/navigation/navigationhandler.cpp +++ b/src/navigation/navigationhandler.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/src/navigation/orbitalnavigator.cpp b/src/navigation/orbitalnavigator.cpp index 7313c73ac4..185508aed9 100644 --- a/src/navigation/orbitalnavigator.cpp +++ b/src/navigation/orbitalnavigator.cpp @@ -510,7 +510,7 @@ OrbitalNavigator::OrbitalNavigator() , _retargetAnchor(RetargetAnchorInfo) , _retargetAim(RetargetAimInfo) , _followAnchorNodeRotation(FollowAnchorNodeInfo, true) - , _followAnchorNodeRotationDistance(FollowAnchorNodeDistanceInfo, 5.f, 0.f, 20000.f) + , _followAnchorNodeRotationDistance(FollowAnchorNodeDistanceInfo, 5.f, 0.f, 20.f) , _disableZoom(DisableZoomInfo, false) , _disableRoll(DisableRollInfo, false) , _mouseSensitivity(MouseSensitivityInfo, 15.f, 1.f, 50.f) diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index 83443d6c5d..614fe5747a 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -228,16 +228,6 @@ namespace { openspace::properties::Property::Visibility::AdvancedUser }; - constexpr openspace::properties::Property::PropertyInfo FollowRotationDistanceInfo = - { - "FollowRotationDistance", - "Follow Rotation Distance", - "Distance within which the orbital navigator will follow along this nodes" - "rotation. A value less than zero means that the navigator will never follow" - "along with the nodes rotation.", - openspace::properties::Property::Visibility::AdvancedUser - }; - struct [[codegen::Dictionary(SceneGraphNode)]] Parameters { // The identifier of this scene graph node. This name must be unique among all // scene graph nodes that are loaded in a specific scene. If a duplicate is @@ -267,9 +257,6 @@ namespace { // [[codegen::verbatim(SupportsDirectInteractionInfo.description)]] std::optional supportsDirectInteraction; - // [[codegen::verbatim(FollowRotationDistanceInfo.description)]] - std::optional followRotationDistance; - struct Transform { // This node describes a translation that is applied to the scene graph node // and all its children. Depending on the 'Type' of the translation, this can @@ -431,8 +418,6 @@ ghoul::mm_unique_ptr SceneGraphNode::createFromDictionary( result->_approachFactor = p.approachFactor.value_or(result->_approachFactor); result->_reachFactor = p.reachFactor.value_or(result->_reachFactor); - result->_followRotationDistance = p.followRotationDistance.value_or(result->_followRotationDistance); - if (p.transform.has_value()) { ZoneScopedN("Transform"); @@ -586,7 +571,6 @@ SceneGraphNode::SceneGraphNode() , _visibilityDistance(VisibilityDistanceInfo, 6e10f) , _supportsDirectInteraction(SupportsDirectInteractionInfo, false) , _showDebugSphere(ShowDebugSphereInfo, false) - , _followRotationDistance(FollowRotationDistanceInfo, -1.0, -1.0) { { ghoul::Dictionary translation; @@ -1375,11 +1359,6 @@ double SceneGraphNode::approachFactor() const { return _approachFactor; } -double SceneGraphNode::followRotationDistance() const -{ - return _followRotationDistance; -} - bool SceneGraphNode::supportsDirectInteraction() const { return _supportsDirectInteraction; }