mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-08 04:31:08 -06:00
Move videotileprovider to video module
This commit is contained in:
@@ -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
|
||||
<map>
|
||||
)
|
||||
|
||||
# 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
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <modules/globebrowsing/src/memoryawaretilecache.h>
|
||||
#include <modules/globebrowsing/src/renderableglobe.h>
|
||||
#include <modules/globebrowsing/src/tileprovider/defaulttileprovider.h>
|
||||
#include <modules/globebrowsing/src/tileprovider/videotileprovider.h>
|
||||
#include <modules/globebrowsing/src/tileprovider/imagesequencetileprovider.h>
|
||||
#include <modules/globebrowsing/src/tileprovider/singleimagetileprovider.h>
|
||||
#include <modules/globebrowsing/src/tileprovider/sizereferencetileprovider.h>
|
||||
@@ -316,7 +315,6 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
fTileProvider->registerClass<SizeReferenceTileProvider>("SizeReferenceTileLayer");
|
||||
fTileProvider->registerClass<TileProviderByLevel>("ByLevelTileLayer");
|
||||
fTileProvider->registerClass<TileProviderByIndex>("ByIndexTileLayer");
|
||||
fTileProvider->registerClass<VideoTileProvider>("VideoTileLayer");
|
||||
|
||||
ghoul::TemplateFactory<DashboardItem>* fDashboard =
|
||||
FactoryManager::ref().factory<DashboardItem>();
|
||||
@@ -344,7 +342,6 @@ std::vector<documentation::Documentation> GlobeBrowsingModule::documentations()
|
||||
globebrowsing::TemporalTileProvider::Documentation(),
|
||||
globebrowsing::TileProviderByIndex::Documentation(),
|
||||
globebrowsing::TileProviderByLevel::Documentation(),
|
||||
globebrowsing::VideoTileProvider::Documentation(),
|
||||
GlobeLabelsComponent::Documentation(),
|
||||
RingsComponent::Documentation(),
|
||||
ShadowComponent::Documentation()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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__
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/src/tileprovider/videotileprovider.h>
|
||||
#include <modules/video/include/videotileprovider.h>
|
||||
|
||||
#include <modules/globebrowsing/globebrowsingmodule.h>
|
||||
#include <modules/globebrowsing/src/memoryawaretilecache.h>
|
||||
@@ -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<Parameters>("globebrowsing_videotileprovider");
|
||||
return codegen::doc<Parameters>("video_videotileprovider");
|
||||
}
|
||||
|
||||
VideoTileProvider::VideoTileProvider(const ghoul::Dictionary& dictionary)
|
||||
@@ -982,4 +982,4 @@ void VideoTileProvider::internalDeinitialize() {
|
||||
cleanUpMpv();
|
||||
}
|
||||
|
||||
} // namespace openspace::globebrowsing
|
||||
} // namespace openspace::video
|
||||
@@ -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",
|
||||
27
modules/video/video_loop_sos_airtraffic.asset
Normal file
27
modules/video/video_loop_sos_airtraffic.asset
Normal file
@@ -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"
|
||||
}
|
||||
27
modules/video/video_loop_sos_carbon.asset
Normal file
27
modules/video/video_loop_sos_carbon.asset
Normal file
@@ -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"
|
||||
}
|
||||
26
modules/video/video_sos_capitals.asset
Normal file
26
modules/video/video_sos_capitals.asset
Normal file
@@ -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"
|
||||
}
|
||||
@@ -23,6 +23,8 @@
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/video/videomodule.h>
|
||||
#include <modules/video/include/videotileprovider.h>
|
||||
#include <modules/globebrowsing/src/tileprovider/tileprovider.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/scripting/lualibrary.h>
|
||||
@@ -55,30 +57,21 @@ VideoModule::VideoModule()
|
||||
|
||||
void VideoModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
const Parameters p = codegen::bake<Parameters>(dict);
|
||||
using namespace globebrowsing;
|
||||
|
||||
_enabled = p.enabled.value_or(_enabled);
|
||||
/*
|
||||
ghoul::TemplateFactory<ScreenSpaceRenderable>* fScreenSpaceRenderable =
|
||||
FactoryManager::ref().factory<ScreenSpaceRenderable>();
|
||||
ghoul_assert(fScreenSpaceRenderable, "ScreenSpaceRenderable factory was not created");
|
||||
|
||||
// Register ScreenSpaceSkyBrowser
|
||||
fScreenSpaceRenderable->registerClass<ScreenSpaceSkyBrowser>("ScreenSpaceSkyBrowser");
|
||||
ghoul::TemplateFactory<TileProvider>* fTileProvider =
|
||||
FactoryManager::ref().factory<TileProvider>();
|
||||
ghoul_assert(fTileProvider, "TileProvider factory was not created");
|
||||
fTileProvider->registerClass<VideoTileProvider>("VideoTileLayer");
|
||||
|
||||
ghoul::TemplateFactory<Renderable>* fRenderable =
|
||||
FactoryManager::ref().factory<Renderable>();
|
||||
ghoul_assert(fRenderable, "Renderable factory was not created");
|
||||
|
||||
// Register ScreenSpaceSkyTarget
|
||||
fRenderable->registerClass<RenderableSkyTarget>("RenderableSkyTarget");
|
||||
*/
|
||||
}
|
||||
|
||||
std::vector<documentation::Documentation> VideoModule::documentations() const {
|
||||
/* return {
|
||||
RenderableSkyTarget::Documentation(),
|
||||
ScreenSpaceSkyBrowser::Documentation()
|
||||
};*/
|
||||
return {
|
||||
VideoTileProvider::Documentation(),
|
||||
};
|
||||
return std::vector<documentation::Documentation>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user