diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index abc6d5805e..31d3d13d51 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -1,26 +1,26 @@ -########################################################################################## -# # +# ######################################################################################### +# # # 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(${PROJECT_SOURCE_DIR}/support/cmake/module_definition.cmake) @@ -60,7 +60,6 @@ set(HEADER_FILES src/tiletextureinitdata.h src/timequantizer.h src/tileprovider/defaulttileprovider.h - src/tileprovider/videotileprovider.h src/tileprovider/imagesequencetileprovider.h src/tileprovider/singleimagetileprovider.h src/tileprovider/sizereferencetileprovider.h @@ -102,7 +101,6 @@ set(SOURCE_FILES src/tiletextureinitdata.cpp src/timequantizer.cpp src/tileprovider/defaulttileprovider.cpp - src/tileprovider/videotileprovider.cpp src/tileprovider/imagesequencetileprovider.cpp src/tileprovider/singleimagetileprovider.cpp src/tileprovider/sizereferencetileprovider.cpp @@ -148,43 +146,19 @@ target_precompile_headers(${globebrowsing_module} PRIVATE ) -# Libmpv -if(WIN32) - add_library(libmpv SHARED IMPORTED) - target_include_directories(libmpv SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/include) - set_target_properties(libmpv PROPERTIES - IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/bin/mpv-2.dll" - IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/lib/mpv.lib" - ) - - add_library(libopenh264 SHARED IMPORTED) - set_target_properties(libopenh264 PROPERTIES - IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/bin/libopenh264.dll" - IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/lib/mpv.lib" - ) - - target_link_libraries(openspace-module-globebrowsing PUBLIC libmpv libopenh264) -else(WIN32) - find_package(LIBMPV REQUIRED) - - target_include_directories(openspace-module-globebrowsing SYSTEM PRIVATE ${LIBMPV_INCLUDE_DIR}) - target_link_libraries(openspace-module-globebrowsing PRIVATE ${LIBMPV_LIBRARY}) - mark_as_advanced(LIBMPV_CONFIG LIBMPV_INCLUDE_DIR LIBMPV_LIBRARY) -endif() # WIN32 - # Gdal install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gdal_data DESTINATION modules/globebrowsing) -if (WIN32) +if(WIN32) add_library(gdal SHARED IMPORTED) target_include_directories(gdal SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/include) set_target_properties(gdal PROPERTIES IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal_i.lib) set_target_properties(gdal PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal241.dll) target_link_libraries(openspace-module-globebrowsing PRIVATE gdal) -else (WIN32) +else(WIN32) find_package(GDAL REQUIRED) target_include_directories(openspace-module-globebrowsing SYSTEM PRIVATE ${GDAL_INCLUDE_DIR}) target_link_libraries(openspace-module-globebrowsing PRIVATE ${GDAL_LIBRARY}) mark_as_advanced(GDAL_CONFIG GDAL_INCLUDE_DIR GDAL_LIBRARY) -endif () # WIN32 +endif() # WIN32 diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index dc7b7f9c21..97e7f28a4b 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -316,7 +315,6 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { fTileProvider->registerClass("SizeReferenceTileLayer"); fTileProvider->registerClass("ByLevelTileLayer"); fTileProvider->registerClass("ByIndexTileLayer"); - fTileProvider->registerClass("VideoTileLayer"); ghoul::TemplateFactory* fDashboard = FactoryManager::ref().factory(); @@ -344,7 +342,6 @@ std::vector GlobeBrowsingModule::documentations() globebrowsing::TemporalTileProvider::Documentation(), globebrowsing::TileProviderByIndex::Documentation(), globebrowsing::TileProviderByLevel::Documentation(), - globebrowsing::VideoTileProvider::Documentation(), GlobeLabelsComponent::Documentation(), RingsComponent::Documentation(), ShadowComponent::Documentation() diff --git a/modules/video/CMakeLists.txt b/modules/video/CMakeLists.txt index e3b94c576e..09fd12adff 100644 --- a/modules/video/CMakeLists.txt +++ b/modules/video/CMakeLists.txt @@ -26,15 +26,41 @@ include(${PROJECT_SOURCE_DIR}/support/cmake/module_definition.cmake) set(HEADER_FILES videomodule.h + include/videotileprovider.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES videomodule.cpp videomodule_lua.inl + src/videotileprovider.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) +# Libmpv +if(WIN32) + add_library(libmpv SHARED IMPORTED) + target_include_directories(libmpv SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/include) + set_target_properties(libmpv PROPERTIES + IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/bin/mpv-2.dll" + IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/lib/mpv.lib" + ) + + add_library(libopenh264 SHARED IMPORTED) + set_target_properties(libopenh264 PROPERTIES + IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/bin/libopenh264.dll" + IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/lib/mpv.lib" + ) + + target_link_libraries(openspace-module-globebrowsing PUBLIC libmpv libopenh264) +else(WIN32) + find_package(LIBMPV REQUIRED) + + target_include_directories(openspace-module-globebrowsing SYSTEM PRIVATE ${LIBMPV_INCLUDE_DIR}) + target_link_libraries(openspace-module-globebrowsing PRIVATE ${LIBMPV_LIBRARY}) + mark_as_advanced(LIBMPV_CONFIG LIBMPV_INCLUDE_DIR LIBMPV_LIBRARY) +endif() # WIN32 + create_new_module( "Video" video_module diff --git a/modules/globebrowsing/src/tileprovider/videotileprovider.h b/modules/video/include/videotileprovider.h similarity index 98% rename from modules/globebrowsing/src/tileprovider/videotileprovider.h rename to modules/video/include/videotileprovider.h index 08f7789676..335da6fc3a 100644 --- a/modules/globebrowsing/src/tileprovider/videotileprovider.h +++ b/modules/video/include/videotileprovider.h @@ -38,7 +38,8 @@ namespace openspace { struct Documentation; } -namespace openspace::globebrowsing { +namespace openspace { +using namespace globebrowsing; class VideoTileProvider : public TileProvider { public: @@ -146,6 +147,6 @@ private: bool _tileIsReady = false; }; -} // namespace openspace::globebrowsing +} // namespace video::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___TILEPROVIDER__VIDEOTILEPROVIDER___H__ diff --git a/modules/globebrowsing/src/tileprovider/videotileprovider.cpp b/modules/video/src/videotileprovider.cpp similarity index 99% rename from modules/globebrowsing/src/tileprovider/videotileprovider.cpp rename to modules/video/src/videotileprovider.cpp index 9ab60e242a..eb9e04acb4 100644 --- a/modules/globebrowsing/src/tileprovider/videotileprovider.cpp +++ b/modules/video/src/videotileprovider.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include #include @@ -107,7 +107,7 @@ namespace { #include "videotileprovider_codegen.cpp" } // namespace -namespace openspace::globebrowsing { +namespace openspace { bool checkMpvError(int status) { if (status < 0) { @@ -175,7 +175,7 @@ void VideoTileProvider::commandAsyncMpv(const char* cmd[], LibmpvPropertyKey key } documentation::Documentation VideoTileProvider::Documentation() { - return codegen::doc("globebrowsing_videotileprovider"); + return codegen::doc("video_videotileprovider"); } VideoTileProvider::VideoTileProvider(const ghoul::Dictionary& dictionary) @@ -982,4 +982,4 @@ void VideoTileProvider::internalDeinitialize() { cleanUpMpv(); } -} // namespace openspace::globebrowsing +} // namespace openspace::video diff --git a/modules/globebrowsing/video.asset b/modules/video/video.asset similarity index 100% rename from modules/globebrowsing/video.asset rename to modules/video/video.asset diff --git a/modules/globebrowsing/video_loop.asset b/modules/video/video_loop.asset similarity index 100% rename from modules/globebrowsing/video_loop.asset rename to modules/video/video_loop.asset diff --git a/modules/globebrowsing/video_loop_sos.asset b/modules/video/video_loop_sos.asset similarity index 85% rename from modules/globebrowsing/video_loop_sos.asset rename to modules/video/video_loop_sos.asset index f45ede276f..b1eb3a73b6 100644 --- a/modules/globebrowsing/video_loop_sos.asset +++ b/modules/video/video_loop_sos.asset @@ -1,6 +1,6 @@ local layer = { - Identifier = "SosLoop", - File = "C:/Users/ylvaselling/Documents/Work/Testmovies/4096-4.mp4", + Identifier = "SosLoopTest", + File = "C:/Users/ylvaselling/Documents/Work/Testmovies/chlorophyll_model_2048.mp4", Name = "Science On A Sphere Loop Video", Enabled = asset.enabled, Type = "VideoTileLayer", diff --git a/modules/video/video_loop_sos_airtraffic.asset b/modules/video/video_loop_sos_airtraffic.asset new file mode 100644 index 0000000000..180e095312 --- /dev/null +++ b/modules/video/video_loop_sos_airtraffic.asset @@ -0,0 +1,27 @@ +local layer = { + Identifier = "SosLoop3", + File = "C:/Users/ylvaselling/Documents/Work/Testmovies/air_traffic_2048.mp4", + Name = "Science On A Sphere Loop Video", + Enabled = asset.enabled, + Type = "VideoTileLayer", + Description = [[Testing video]] +} + +asset.onInitialize(function() + openspace.globebrowsing.addLayer("Earth", "ColorLayers", layer) +end) + +asset.onDeinitialize(function() + openspace.globebrowsing.deleteLayer("Earth", "ColorLayers", layer) +end) + +asset.export("layer", layer) + +asset.meta = { + Name = "Aqua Modis (Temporal)", + Version = "1.1", + Description = "GIBS hosted layer", + Author = "NASA EOSDIS Global Imagery Browse Services", + URL = "https://earthdata.nasa.gov/eosdis/science-system-description/eosdis-components/gibs", + License = "NASA" +} diff --git a/modules/video/video_loop_sos_carbon.asset b/modules/video/video_loop_sos_carbon.asset new file mode 100644 index 0000000000..1b7cf0c494 --- /dev/null +++ b/modules/video/video_loop_sos_carbon.asset @@ -0,0 +1,27 @@ +local layer = { + Identifier = "SosLoop2", + File = "C:/Users/ylvaselling/Documents/Work/Testmovies/2048_jpg-2048x1024.mp4", + Name = "Science On A Sphere Loop Video", + Enabled = asset.enabled, + Type = "VideoTileLayer", + Description = [[Testing video]] +} + +asset.onInitialize(function() + openspace.globebrowsing.addLayer("Earth", "ColorLayers", layer) +end) + +asset.onDeinitialize(function() + openspace.globebrowsing.deleteLayer("Earth", "ColorLayers", layer) +end) + +asset.export("layer", layer) + +asset.meta = { + Name = "Aqua Modis (Temporal)", + Version = "1.1", + Description = "GIBS hosted layer", + Author = "NASA EOSDIS Global Imagery Browse Services", + URL = "https://earthdata.nasa.gov/eosdis/science-system-description/eosdis-components/gibs", + License = "NASA" +} diff --git a/modules/globebrowsing/video_sos.asset b/modules/video/video_sos.asset similarity index 100% rename from modules/globebrowsing/video_sos.asset rename to modules/video/video_sos.asset diff --git a/modules/video/video_sos_capitals.asset b/modules/video/video_sos_capitals.asset new file mode 100644 index 0000000000..cf8f2ad7b8 --- /dev/null +++ b/modules/video/video_sos_capitals.asset @@ -0,0 +1,26 @@ +local layer = { + Identifier = "Capitals", + FilePath = "C:/Users/ylvaselling/Documents/Work/Testmovies/capitals/4096.png", + Name = "Capitals", + Enabled = asset.enabled, + Description = [[Testing video]] +} + +asset.onInitialize(function() + openspace.globebrowsing.addLayer("Earth", "ColorLayers", layer) +end) + +asset.onDeinitialize(function() + openspace.globebrowsing.deleteLayer("Earth", "ColorLayers", layer) +end) + +asset.export("layer", layer) + +asset.meta = { + Name = "Aqua Modis (Temporal)", + Version = "1.1", + Description = "GIBS hosted layer", + Author = "NASA EOSDIS Global Imagery Browse Services", + URL = "https://earthdata.nasa.gov/eosdis/science-system-description/eosdis-components/gibs", + License = "NASA" +} diff --git a/modules/video/videomodule.cpp b/modules/video/videomodule.cpp index ed789a528f..e18a06e52d 100644 --- a/modules/video/videomodule.cpp +++ b/modules/video/videomodule.cpp @@ -23,6 +23,8 @@ ****************************************************************************************/ #include +#include +#include #include #include #include @@ -55,30 +57,21 @@ VideoModule::VideoModule() void VideoModule::internalInitialize(const ghoul::Dictionary& dict) { const Parameters p = codegen::bake(dict); + using namespace globebrowsing; _enabled = p.enabled.value_or(_enabled); - /* - ghoul::TemplateFactory* fScreenSpaceRenderable = - FactoryManager::ref().factory(); - ghoul_assert(fScreenSpaceRenderable, "ScreenSpaceRenderable factory was not created"); - // Register ScreenSpaceSkyBrowser - fScreenSpaceRenderable->registerClass("ScreenSpaceSkyBrowser"); + ghoul::TemplateFactory* fTileProvider = + FactoryManager::ref().factory(); + ghoul_assert(fTileProvider, "TileProvider factory was not created"); + fTileProvider->registerClass("VideoTileLayer"); - ghoul::TemplateFactory* fRenderable = - FactoryManager::ref().factory(); - ghoul_assert(fRenderable, "Renderable factory was not created"); - - // Register ScreenSpaceSkyTarget - fRenderable->registerClass("RenderableSkyTarget"); - */ } std::vector VideoModule::documentations() const { - /* return { - RenderableSkyTarget::Documentation(), - ScreenSpaceSkyBrowser::Documentation() - };*/ + return { + VideoTileProvider::Documentation(), + }; return std::vector(); }