Fading of propertyowners through GUI, and more owners with fade property (#2557)

* Add property in OpenSpaceEngine for fading duration when enabling / disabling

* Add interface for fadeable components and apply to renderable

* Make layers a fadeable component

* Make globelabels a fadeable component

* Make labelscomponent a fadeable, and give it an enabled property

* Make screenspace renderables fadeable components

* Introduce concept of parent fadeables, to fade out subowners with parent

* Make rings fadeable as well

---------

Co-authored-by: Alexander Bock <alexander.bock@liu.se>
This commit is contained in:
Emma Broman
2023-04-06 12:49:49 +02:00
committed by GitHub
parent 439e4b8f93
commit 554373eb3e
45 changed files with 302 additions and 243 deletions
+4 -7
View File
@@ -26,6 +26,7 @@
#define __OPENSPACE_CORE___RENDERABLE___H__
#include <openspace/properties/propertyowner.h>
#include <openspace/rendering/fadeable.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/doubleproperty.h>
@@ -52,7 +53,7 @@ namespace documentation { struct Documentation; }
class Camera;
class Renderable : public properties::PropertyOwner {
class Renderable : public properties::PropertyOwner, public Fadeable {
public:
enum class RenderBin : int {
Background = 1,
@@ -102,9 +103,7 @@ public:
bool matchesSecondaryRenderBin(int binMask) const noexcept;
void setFade(float fade);
bool isVisible() const;
bool isVisible() const override;
void onEnabledChange(std::function<void(bool)> callback);
@@ -112,8 +111,6 @@ public:
protected:
properties::BoolProperty _enabled;
properties::FloatProperty _opacity;
properties::FloatProperty _fade;
properties::StringProperty _renderableType;
properties::BoolProperty _dimInAtmosphere;
@@ -124,7 +121,7 @@ protected:
void registerUpdateRenderBinFromOpacity();
/// Returns the full opacity constructed from the _opacity and _fade property values
float opacity() const;
float opacity() const override;
double _boundingSphere = 0.0;
double _interactionSphere = 0.0;