Double renderbins for renderables (#2520)

This commit is contained in:
Emma Broman
2023-03-08 10:59:32 +01:00
committed by GitHub
parent 5e7b67e077
commit 4a50c4cbc0
5 changed files with 58 additions and 19 deletions

View File

@@ -82,8 +82,9 @@ public:
std::string_view typeAsString() const;
virtual void render(const RenderData& data, RendererTasks& rendererTask);
virtual void update(const UpdateData& data);
virtual void render(const RenderData& data, RendererTasks& rendererTask);
virtual void renderSecondary(const RenderData& data, RendererTasks& rendererTask);
// The 'surface' in this case is the interaction sphere of this renderable. In some
// cases (i.e., planets) this corresponds directly to the physical surface, but in
@@ -97,7 +98,9 @@ public:
RenderBin renderBin() const;
void setRenderBin(RenderBin bin);
bool matchesRenderBinMask(int binMask);
bool matchesRenderBinMask(int binMask) const noexcept;
bool matchesSecondaryRenderBin(int binMask) const noexcept;
void setFade(float fade);
@@ -129,6 +132,10 @@ protected:
bool _shouldUpdateIfDisabled = false;
RenderBin _renderBin = RenderBin::Opaque;
// An optional renderbin that renderables can use for certain components, in cases
// where all parts of the renderable should not be rendered in the same bin
std::optional<RenderBin> _secondaryRenderBin;
private:
// 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