mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-03 09:20:26 -05:00
Add property to make it possible to set if the browser display copies… (#2774)
* Add property to make it possible to set if the browser display copies should animate while the target is moving * Update modules/skybrowser/src/targetbrowserpair.cpp Co-authored-by: Alexander Bock <alexander.bock@liu.se> --------- Co-authored-by: Alexander Bock <alexander.bock@liu.se>
This commit is contained in:
@@ -50,6 +50,7 @@ public:
|
||||
glm::dvec2 fineTuneVector(const glm::dvec2& drag);
|
||||
bool isInitialized() const;
|
||||
bool isPointingSpacecraft() const;
|
||||
bool shouldUpdateWhileTargetAnimates() const;
|
||||
|
||||
double setVerticalFovWithScroll(float scroll);
|
||||
void setIdInBrowser() const;
|
||||
@@ -71,6 +72,7 @@ private:
|
||||
properties::FloatProperty _textureQuality;
|
||||
properties::BoolProperty _isHidden;
|
||||
properties::BoolProperty _isPointingSpacecraft;
|
||||
properties::BoolProperty _updateDuringTargetAnimation;
|
||||
std::vector<std::unique_ptr<properties::Vec3Property>> _displayCopies;
|
||||
std::vector<std::unique_ptr<properties::BoolProperty>> _showDisplayCopies;
|
||||
|
||||
|
||||
@@ -82,6 +82,14 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo UpdateDuringAnimationInfo = {
|
||||
"UpdateDuringTargetAnimation",
|
||||
"Update During Target Animation",
|
||||
"If checked, the sky browser display copy will update its coordinates while "
|
||||
"the target is animating.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
struct [[codegen::Dictionary(ScreenSpaceSkyBrowser)]] Parameters {
|
||||
// [[codegen::verbatim(TextureQualityInfo.description)]]
|
||||
std::optional<float> textureQuality;
|
||||
@@ -91,6 +99,9 @@ namespace {
|
||||
|
||||
// [[codegen::verbatim(PointSpacecraftInfo.description)]]
|
||||
std::optional<bool> pointSpacecraft;
|
||||
|
||||
// [[codegen::verbatim(UpdateDuringAnimationInfo.description)]]
|
||||
std::optional<bool> updateDuringTargetAnimation;
|
||||
};
|
||||
|
||||
#include "screenspaceskybrowser_codegen.cpp"
|
||||
@@ -123,6 +134,7 @@ ScreenSpaceSkyBrowser::ScreenSpaceSkyBrowser(const ghoul::Dictionary& dictionary
|
||||
, _textureQuality(TextureQualityInfo, 1.f, 0.25f, 1.f)
|
||||
, _isHidden(IsHiddenInfo, true)
|
||||
, _isPointingSpacecraft(PointSpacecraftInfo, false)
|
||||
, _updateDuringTargetAnimation(UpdateDuringAnimationInfo, false)
|
||||
{
|
||||
_identifier = makeUniqueIdentifier(_identifier);
|
||||
|
||||
@@ -131,6 +143,9 @@ ScreenSpaceSkyBrowser::ScreenSpaceSkyBrowser(const ghoul::Dictionary& dictionary
|
||||
_textureQuality = p.textureQuality.value_or(_textureQuality);
|
||||
_isHidden = p.isHidden.value_or(_isHidden);
|
||||
_isPointingSpacecraft = p.pointSpacecraft.value_or(_isPointingSpacecraft);
|
||||
_updateDuringTargetAnimation = p.updateDuringTargetAnimation.value_or(
|
||||
_updateDuringTargetAnimation
|
||||
);
|
||||
|
||||
addProperty(_isHidden);
|
||||
addProperty(_url);
|
||||
@@ -139,6 +154,7 @@ ScreenSpaceSkyBrowser::ScreenSpaceSkyBrowser(const ghoul::Dictionary& dictionary
|
||||
addProperty(_textureQuality);
|
||||
addProperty(_verticalFov);
|
||||
addProperty(_isPointingSpacecraft);
|
||||
addProperty(_updateDuringTargetAnimation);
|
||||
|
||||
_textureQuality.onChange([this]() { _isDimensionsDirty = true; });
|
||||
|
||||
@@ -199,6 +215,10 @@ bool ScreenSpaceSkyBrowser::isPointingSpacecraft() const {
|
||||
return _isPointingSpacecraft;
|
||||
}
|
||||
|
||||
bool ScreenSpaceSkyBrowser::shouldUpdateWhileTargetAnimates() const {
|
||||
return _updateDuringTargetAnimation;
|
||||
}
|
||||
|
||||
void ScreenSpaceSkyBrowser::setIdInBrowser() const {
|
||||
int currentNode = global::windowDelegate->currentNode();
|
||||
WwtCommunicator::setIdInBrowser(fmt::format("{}_{}", identifier(), currentNode));
|
||||
|
||||
@@ -91,7 +91,10 @@ void TargetBrowserPair::fineTuneTarget(const glm::vec2& translation) {
|
||||
}
|
||||
|
||||
void TargetBrowserPair::synchronizeAim() {
|
||||
if (!_targetAnimation.isAnimating() && _browser->isInitialized()) {
|
||||
bool shouldUpdate =
|
||||
_browser->shouldUpdateWhileTargetAnimates() ||
|
||||
!_targetAnimation.isAnimating();
|
||||
if (shouldUpdate && _browser->isInitialized()) {
|
||||
_browser->setEquatorialAim(targetDirectionEquatorial());
|
||||
_browser->setTargetRoll(targetRoll());
|
||||
_targetRenderable->setVerticalFov(_browser->verticalFov());
|
||||
|
||||
Reference in New Issue
Block a user