mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-09 05:00:42 -06:00
Move video properties to video player out of renderables
This commit is contained in:
@@ -48,11 +48,6 @@ protected:
|
||||
void bindTexture() override;
|
||||
|
||||
private:
|
||||
properties::TriggerProperty _play;
|
||||
properties::TriggerProperty _pause;
|
||||
properties::TriggerProperty _goToStart;
|
||||
properties::TriggerProperty _reset;
|
||||
|
||||
VideoPlayer _videoPlayer;
|
||||
};
|
||||
|
||||
|
||||
@@ -61,10 +61,6 @@ public:
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
properties::TriggerProperty _play;
|
||||
properties::TriggerProperty _pause;
|
||||
properties::TriggerProperty _goToStart;
|
||||
|
||||
enum class PlaybackMode {
|
||||
MapToSimulationTime = 0,
|
||||
RealTimeLoop
|
||||
@@ -79,7 +75,6 @@ private:
|
||||
void internalDeinitialize() override final;
|
||||
|
||||
PlaybackMode _playbackMode = PlaybackMode::RealTimeLoop; // Default is to loop
|
||||
std::filesystem::path _videoFile;
|
||||
|
||||
// Video stretching: map to simulation time animation mode
|
||||
double _startJ200Time = 0.0;
|
||||
|
||||
@@ -42,29 +42,6 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo PlayInfo = {
|
||||
"Play",
|
||||
"Play",
|
||||
"Play video"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo PauseInfo = {
|
||||
"Pause",
|
||||
"Pause",
|
||||
"Pause video"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo GoToStartInfo = {
|
||||
"GoToStart",
|
||||
"Go To Start",
|
||||
"Go to start in video"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo ResetInfo = {
|
||||
"Reset",
|
||||
"Reset",
|
||||
"Reset video"
|
||||
};
|
||||
|
||||
struct [[codegen::Dictionary(RenderableVideoSphere)]] Parameters {
|
||||
|
||||
@@ -75,25 +52,18 @@ struct [[codegen::Dictionary(RenderableVideoSphere)]] Parameters {
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation RenderableVideoSphere::Documentation() {
|
||||
return codegen::doc<Parameters>("base_renderable_sphere");
|
||||
return codegen::doc<Parameters>("renderable_video_sphere");
|
||||
}
|
||||
|
||||
RenderableVideoSphere::RenderableVideoSphere(const ghoul::Dictionary& dictionary)
|
||||
: RenderableSphere(dictionary)
|
||||
, _videoPlayer(dictionary)
|
||||
, _play(PlayInfo)
|
||||
, _pause(PauseInfo)
|
||||
, _goToStart(GoToStartInfo)
|
||||
, _reset(ResetInfo)
|
||||
{
|
||||
_play.onChange([this]() { _videoPlayer.play(); });
|
||||
addProperty(_play);
|
||||
_pause.onChange([this]() { _videoPlayer.pause(); });
|
||||
addProperty(_pause);
|
||||
_goToStart.onChange([this]() { _videoPlayer.goToStart(); });
|
||||
addProperty(_goToStart);
|
||||
_reset.onChange([this]() { _videoPlayer.reset(); });
|
||||
addProperty(_reset);
|
||||
addProperty(_videoPlayer._play);
|
||||
addProperty(_videoPlayer._pause);
|
||||
addProperty(_videoPlayer._goToStart);
|
||||
addProperty(_videoPlayer._reset);
|
||||
addProperty(_videoPlayer._playAudio);
|
||||
}
|
||||
|
||||
void RenderableVideoSphere::bindTexture() {
|
||||
|
||||
@@ -38,13 +38,6 @@
|
||||
namespace {
|
||||
constexpr std::string_view _loggerCat = "VideoTileProvider";
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo FileInfo = {
|
||||
"File",
|
||||
"File",
|
||||
"The file path that is used for this video provider. The file must point to a "
|
||||
"video that is then loaded and used for all tiles"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo StartTimeInfo = {
|
||||
"StartTime",
|
||||
"Start Time",
|
||||
@@ -66,28 +59,7 @@ namespace {
|
||||
"video can be set, or the video can be played as a loop in real time."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo PlayInfo = {
|
||||
"Play",
|
||||
"Play",
|
||||
"Play video"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo PauseInfo = {
|
||||
"Pause",
|
||||
"Pause",
|
||||
"Pause video"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo GoToStartInfo = {
|
||||
"GoToStart",
|
||||
"Go To Start",
|
||||
"Go to start in video"
|
||||
};
|
||||
|
||||
struct [[codegen::Dictionary(VideoTileProvider)]] Parameters {
|
||||
// [[codegen::verbatim(FileInfo.description)]]
|
||||
std::filesystem::path file;
|
||||
|
||||
// [[codegen::verbatim(StartTimeInfo.description)]]
|
||||
std::optional<std::string> startTime [[codegen::datetime()]];
|
||||
|
||||
@@ -119,15 +91,13 @@ bool isDifferent(double first, double second) {
|
||||
|
||||
VideoTileProvider::VideoTileProvider(const ghoul::Dictionary& dictionary)
|
||||
: _videoPlayer(dictionary)
|
||||
, _play(PlayInfo)
|
||||
, _pause(PauseInfo)
|
||||
, _goToStart(GoToStartInfo)
|
||||
{
|
||||
ZoneScoped
|
||||
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
|
||||
_videoFile = p.file;
|
||||
addProperty(_videoPlayer._reset);
|
||||
addProperty(_videoPlayer._playAudio);
|
||||
|
||||
if (p.playbackMode.has_value()) {
|
||||
switch (*p.playbackMode) {
|
||||
@@ -142,14 +112,12 @@ VideoTileProvider::VideoTileProvider(const ghoul::Dictionary& dictionary)
|
||||
throw ghoul::MissingCaseException();
|
||||
}
|
||||
}
|
||||
|
||||
if (_playbackMode == PlaybackMode::RealTimeLoop) {
|
||||
// Video interaction. Only valid for real time looping
|
||||
_play.onChange([this]() { _videoPlayer.play(); });
|
||||
addProperty(_play);
|
||||
_pause.onChange([this]() { _videoPlayer.pause(); });
|
||||
addProperty(_pause);
|
||||
_goToStart.onChange([this]() { _videoPlayer.goToStart(); });
|
||||
addProperty(_goToStart);
|
||||
addProperty(_videoPlayer._play);
|
||||
addProperty(_videoPlayer._pause);
|
||||
addProperty(_videoPlayer._goToStart);
|
||||
}
|
||||
else if (_playbackMode == PlaybackMode::MapToSimulationTime) {
|
||||
if (!p.startTime.has_value() || !p.endTime.has_value()) {
|
||||
|
||||
Reference in New Issue
Block a user