mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-21 20:39:08 -06:00
Adding static Settings to Renderable (#2578)
* Add settings to Renderable to control whether the renderbin is updated based on Opacity * Remove duplicate RenderBin specification for RenderableSphere * Remove unnecessary RenderBin specifications of Lagrange points * Don't automatically update the renderbin for RenderableLabel and RenderablePlane * Remove extra `setRenderBinFromOpacity` from RenderableSpheres * Move information about whether a renderable should be updated when disabled * Some cleanup of Renderable class * Don't update the renderbin automatically if the user specified the renderbin manually
This commit is contained in:
@@ -48,7 +48,7 @@ public:
|
||||
virtual bool isVisible() const;
|
||||
|
||||
/// Returns the full opacity constructed from the _opacity and _fade property values
|
||||
virtual float opacity() const;
|
||||
virtual float opacity() const noexcept;
|
||||
|
||||
protected:
|
||||
properties::FloatProperty _opacity;
|
||||
|
||||
@@ -55,6 +55,11 @@ class Camera;
|
||||
|
||||
class Renderable : public properties::PropertyOwner, public Fadeable {
|
||||
public:
|
||||
struct Settings {
|
||||
bool automaticallyUpdateRenderBin = true;
|
||||
bool shouldUpdateIfDisabled = false;
|
||||
};
|
||||
|
||||
enum class RenderBin : int {
|
||||
Background = 1,
|
||||
Opaque = 2,
|
||||
@@ -66,7 +71,7 @@ public:
|
||||
static ghoul::mm_unique_ptr<Renderable> createFromDictionary(
|
||||
ghoul::Dictionary dictionary);
|
||||
|
||||
Renderable(const ghoul::Dictionary& dictionary);
|
||||
Renderable(const ghoul::Dictionary& dictionary, Settings settings = Settings());
|
||||
virtual ~Renderable() override = default;
|
||||
|
||||
virtual void initialize();
|
||||
@@ -76,12 +81,12 @@ public:
|
||||
|
||||
virtual bool isReady() const = 0;
|
||||
bool isEnabled() const;
|
||||
bool shouldUpdateIfDisabled() const;
|
||||
bool shouldUpdateIfDisabled() const noexcept;
|
||||
|
||||
double boundingSphere() const;
|
||||
double interactionSphere() const;
|
||||
double boundingSphere() const noexcept;
|
||||
double interactionSphere() const noexcept;
|
||||
|
||||
std::string_view typeAsString() const;
|
||||
std::string_view typeAsString() const noexcept;
|
||||
|
||||
virtual void update(const UpdateData& data);
|
||||
virtual void render(const RenderData& data, RendererTasks& rendererTask);
|
||||
@@ -118,15 +123,14 @@ protected:
|
||||
void setInteractionSphere(double interactionSphere);
|
||||
|
||||
void setRenderBinFromOpacity();
|
||||
void registerUpdateRenderBinFromOpacity();
|
||||
|
||||
/// Returns the full opacity constructed from the _opacity and _fade property values
|
||||
float opacity() const override;
|
||||
float opacity() const noexcept override;
|
||||
|
||||
SceneGraphNode* parent() const noexcept;
|
||||
|
||||
bool automaticallyUpdatesRenderBin() const noexcept;
|
||||
|
||||
double _boundingSphere = 0.0;
|
||||
double _interactionSphere = 0.0;
|
||||
SceneGraphNode* _parent = nullptr;
|
||||
bool _shouldUpdateIfDisabled = false;
|
||||
RenderBin _renderBin = RenderBin::Opaque;
|
||||
|
||||
// An optional renderbin that renderables can use for certain components, in cases
|
||||
@@ -134,6 +138,14 @@ protected:
|
||||
std::optional<RenderBin> _secondaryRenderBin;
|
||||
|
||||
private:
|
||||
void registerUpdateRenderBinFromOpacity();
|
||||
|
||||
double _boundingSphere = 0.0;
|
||||
double _interactionSphere = 0.0;
|
||||
SceneGraphNode* _parent = nullptr;
|
||||
const bool _shouldUpdateIfDisabled = false;
|
||||
bool _automaticallyUpdateRenderBin = true;
|
||||
|
||||
// We only want the SceneGraphNode to be able manipulate the parent, so we don't want
|
||||
// to provide a set method for this. Otherwise, anyone might mess around with our
|
||||
// parentage and that's no bueno
|
||||
|
||||
Reference in New Issue
Block a user