mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 11:39:49 -06:00
Remove a bunch of compiler warnings
* Remove compile warnings * Coding style fix
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOPLANE___H__
|
||||
#define __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOPLANE___H__
|
||||
#ifndef __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOPLANE___H__
|
||||
#define __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOPLANE___H__
|
||||
|
||||
#include <modules/base/rendering/renderableplane.h>
|
||||
|
||||
@@ -55,4 +55,4 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOPLANE___H__
|
||||
#endif // __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOPLANE___H__
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOSPHERE___H__
|
||||
#define __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOSPHERE___H__
|
||||
#ifndef __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOSPHERE___H__
|
||||
#define __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOSPHERE___H__
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
@@ -91,4 +91,4 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOSPHERE___H__
|
||||
#endif // __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOSPHERE___H__
|
||||
|
||||
@@ -52,7 +52,7 @@ BooleanType(PauseAfterSeek);
|
||||
|
||||
public:
|
||||
VideoPlayer(const ghoul::Dictionary& dictionary);
|
||||
~VideoPlayer();
|
||||
~VideoPlayer() override;
|
||||
|
||||
void initialize();
|
||||
|
||||
@@ -141,12 +141,10 @@ private:
|
||||
|
||||
// Syncing with multiple nodes
|
||||
double _correctPlaybackTime = 0.0;
|
||||
double _deltaTime = 0.0;
|
||||
|
||||
// Video stretching: map to simulation time animation mode
|
||||
double _startJ200Time = 0.0;
|
||||
double _endJ200Time = 0.0;
|
||||
double _timeAtLastRender = 0.0;
|
||||
double _frameDuration = 0.0;
|
||||
|
||||
// Libmpv
|
||||
|
||||
@@ -39,24 +39,22 @@
|
||||
|
||||
namespace openspace { struct Documentation; }
|
||||
|
||||
namespace openspace {
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
class VideoTileProvider : public globebrowsing::TileProvider {
|
||||
class VideoTileProvider : public TileProvider {
|
||||
public:
|
||||
VideoTileProvider(const ghoul::Dictionary& dictionary);
|
||||
~VideoTileProvider();
|
||||
~VideoTileProvider() override;
|
||||
|
||||
void update() override final;
|
||||
void reset() override final;
|
||||
int minLevel() override final;
|
||||
int maxLevel() override final;
|
||||
float noDataValueAsFloat() override final;
|
||||
globebrowsing::ChunkTile chunkTile(globebrowsing::TileIndex tileIndex, int parents,
|
||||
int maxParents = 1337) override;
|
||||
globebrowsing::Tile tile(const globebrowsing::TileIndex& tileIndex) override final;
|
||||
globebrowsing::Tile::Status tileStatus(
|
||||
const globebrowsing::TileIndex& tileIndex) override final;
|
||||
globebrowsing::TileDepthTransform depthTransform() override final;
|
||||
ChunkTile chunkTile(TileIndex tileIndex, int parents, int maxParents = 1337) override;
|
||||
Tile tile(const TileIndex& tileIndex) override final;
|
||||
Tile::Status tileStatus(const TileIndex& tileIndex) override final;
|
||||
TileDepthTransform depthTransform() override final;
|
||||
|
||||
private:
|
||||
void internalInitialize() override final;
|
||||
@@ -64,12 +62,12 @@ private:
|
||||
|
||||
// Tile handling
|
||||
// Cache for rendering 1 frame
|
||||
std::map<globebrowsing::TileIndex::TileHashKey, globebrowsing::Tile> _tileCache;
|
||||
std::map<TileIndex::TileHashKey, Tile> _tileCache;
|
||||
bool _tileIsReady = false;
|
||||
|
||||
VideoPlayer _videoPlayer;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace::globebrowsing
|
||||
|
||||
#endif // __OPENSPACE_MODULE_VIDEO___VIDEOTILEPROVIDER___H__
|
||||
|
||||
@@ -89,13 +89,6 @@ namespace {
|
||||
"'YYYY MM DD hh:mm:ss'."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo PlaybackModeInfo = {
|
||||
"PlaybackMode",
|
||||
"Playback Mode",
|
||||
"Determines the way the video should be played. The start and end time of the "
|
||||
"video can be set, or the video can be played as a loop in real time."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo LoopVideoInfo = {
|
||||
"LoopVideo",
|
||||
"Loop Video",
|
||||
@@ -269,7 +262,7 @@ VideoPlayer::VideoPlayer(const ghoul::Dictionary& dictionary)
|
||||
|
||||
_reset.onChange([this]() { reset(); });
|
||||
addProperty(_reset);
|
||||
|
||||
|
||||
if (p.playbackMode.has_value()) {
|
||||
switch (*p.playbackMode) {
|
||||
case Parameters::PlaybackMode::RealTimeLoop:
|
||||
@@ -292,7 +285,7 @@ VideoPlayer::VideoPlayer(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_pause);
|
||||
_goToStart.onChange([this]() { goToStart(); });
|
||||
addProperty(_goToStart);
|
||||
_loopVideo.onChange([this]() {
|
||||
_loopVideo.onChange([this]() {
|
||||
std::string newValue = _loopVideo ? "inf" : "no";
|
||||
setPropertyAsyncMpv(newValue.c_str(), MpvKey::Loop);
|
||||
});
|
||||
@@ -387,7 +380,7 @@ void VideoPlayer::initializeMpv() {
|
||||
// https://mpv.io/manual/master/#options-gpu-api
|
||||
setPropertyStringMpv("gpu-api", "opengl");
|
||||
|
||||
// Keep open the file. Even when we reach EOF we want to keep the video player
|
||||
// Keep open the file. Even when we reach EOF we want to keep the video player
|
||||
// running, in case the user starts the video from the beginning again
|
||||
// https://mpv.io/manual/stable/#options-keep-open
|
||||
setPropertyStringMpv("keep-open", "yes");
|
||||
@@ -484,7 +477,7 @@ void VideoPlayer::initializeMpv() {
|
||||
}
|
||||
|
||||
void VideoPlayer::seekToTime(double time, PauseAfterSeek pauseAfter) {
|
||||
if (_isSeeking || abs(_currentVideoTime - time) < glm::epsilon<double>()) {
|
||||
if (_isSeeking || std::abs(_currentVideoTime - time) < glm::epsilon<double>()) {
|
||||
return;
|
||||
}
|
||||
pause();
|
||||
@@ -623,7 +616,7 @@ void VideoPlayer::handleMpvProperties(mpv_event* event) {
|
||||
}
|
||||
// Cast event to node or property depending on its format
|
||||
mpv_event_property* prop = nullptr;
|
||||
mpv_node node;
|
||||
mpv_node node = {};
|
||||
if (formats[key] == MPV_FORMAT_NODE) {
|
||||
int result = mpv_event_to_node(&node, event);
|
||||
if (!checkMpvError(result)) {
|
||||
|
||||
@@ -39,14 +39,7 @@ namespace {
|
||||
constexpr std::string_view _loggerCat = "VideoTileProvider";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace {
|
||||
|
||||
bool isDifferent(double first, double second) {
|
||||
return abs(first - second) > glm::epsilon<double>();
|
||||
}
|
||||
}
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
VideoTileProvider::VideoTileProvider(const ghoul::Dictionary& dictionary)
|
||||
: _videoPlayer(dictionary)
|
||||
@@ -61,7 +54,7 @@ globebrowsing::Tile VideoTileProvider::tile(const globebrowsing::TileIndex& tile
|
||||
ZoneScoped;
|
||||
|
||||
if (!_videoPlayer.isInitialized()) {
|
||||
return globebrowsing::Tile();
|
||||
return Tile();
|
||||
}
|
||||
|
||||
// Always check that our framebuffer is ok
|
||||
@@ -76,28 +69,28 @@ globebrowsing::Tile VideoTileProvider::tile(const globebrowsing::TileIndex& tile
|
||||
foundTile->second.texture != _videoPlayer.frameTexture().get();
|
||||
|
||||
if (foundTile == _tileCache.end() || textureChanged) {
|
||||
_tileCache[hash] = globebrowsing::Tile{
|
||||
_tileCache[hash] = Tile {
|
||||
_videoPlayer.frameTexture().get(),
|
||||
std::nullopt,
|
||||
globebrowsing::Tile::Status::OK
|
||||
Tile::Status::OK
|
||||
};
|
||||
}
|
||||
return _tileCache[hash];
|
||||
}
|
||||
|
||||
globebrowsing::Tile::Status VideoTileProvider::tileStatus(const globebrowsing::TileIndex& tileIndex) {
|
||||
Tile::Status VideoTileProvider::tileStatus(const TileIndex& tileIndex) {
|
||||
if (tileIndex.level > maxLevel()) {
|
||||
return globebrowsing::Tile::Status::OutOfRange;
|
||||
return Tile::Status::OutOfRange;
|
||||
}
|
||||
else if (_tileIsReady) {
|
||||
return globebrowsing::Tile::Status::OK;
|
||||
return Tile::Status::OK;
|
||||
}
|
||||
else {
|
||||
return globebrowsing::Tile::Status::Unavailable;
|
||||
return Tile::Status::Unavailable;
|
||||
}
|
||||
}
|
||||
|
||||
globebrowsing::TileDepthTransform VideoTileProvider::depthTransform() {
|
||||
TileDepthTransform VideoTileProvider::depthTransform() {
|
||||
return { 0.f, 1.f };
|
||||
}
|
||||
|
||||
@@ -109,17 +102,15 @@ void VideoTileProvider::reset() {
|
||||
_videoPlayer.reset();
|
||||
}
|
||||
|
||||
globebrowsing::ChunkTile VideoTileProvider::chunkTile(globebrowsing::TileIndex tileIndex,
|
||||
int parents, int maxParents) {
|
||||
using namespace globebrowsing;
|
||||
ChunkTile VideoTileProvider::chunkTile(TileIndex tileIndex, int parents, int maxParents) {
|
||||
std::function<void(TileIndex&, TileUvTransform&)> ascendToParent =
|
||||
[](TileIndex& ti, TileUvTransform&) {
|
||||
ti.level--;
|
||||
};
|
||||
|
||||
glm::vec2 noOfTiles = {
|
||||
std::pow(2, tileIndex.level),
|
||||
std::pow(2, tileIndex.level - 1)
|
||||
glm::vec2 noOfTiles = {
|
||||
std::pow(2, tileIndex.level),
|
||||
std::pow(2, tileIndex.level - 1)
|
||||
};
|
||||
glm::vec2 ratios = { 1.f / noOfTiles.x, 1.f / noOfTiles.y };
|
||||
float offsetX = ratios.x * static_cast<float>(tileIndex.x);
|
||||
@@ -153,4 +144,4 @@ void VideoTileProvider::internalDeinitialize() {
|
||||
_videoPlayer.destroy();
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace::globebrowsing
|
||||
|
||||
@@ -65,7 +65,7 @@ void VideoModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
ghoul::TemplateFactory<globebrowsing::TileProvider>* fTileProvider =
|
||||
FactoryManager::ref().factory<globebrowsing::TileProvider>();
|
||||
ghoul_assert(fTileProvider, "TileProvider factory was not created");
|
||||
fTileProvider->registerClass<VideoTileProvider>("VideoTileLayer");
|
||||
fTileProvider->registerClass<globebrowsing::VideoTileProvider>("VideoTileLayer");
|
||||
|
||||
ghoul::TemplateFactory<ScreenSpaceRenderable>* fSsRenderable =
|
||||
FactoryManager::ref().factory<ScreenSpaceRenderable>();
|
||||
|
||||
Reference in New Issue
Block a user