Loading...
Searching...
No Matches
PreviewHubNode.hpp
1#pragma once
2#include <Gfx/Graph/OutputNode.hpp>
3#include <Gfx/Graph/RenderList.hpp>
4
5#include <score_plugin_gfx_export.h>
6
7#include <functional>
8#include <memory>
9#include <vector>
10
11namespace score::gfx
12{
23struct SCORE_PLUGIN_GFX_EXPORT PreviewHubNode final : OutputNode
24{
25 static constexpr int max_inputs = 32;
26
28 ~PreviewHubNode() override;
29
31 int acquireInput();
32 void releaseInput(int k);
33 bool anyInputUsed() const noexcept;
35 void setInputSize(int k, QSize size);
36 QSize inputSize(int k) const noexcept;
37
38 void startRendering() override { }
39 void render() override;
40 void onRendererChange() override { }
41 bool canRender() const override { return true; }
42 void stopRendering() override { }
43
44 void setRenderer(std::shared_ptr<RenderList> r) override { m_renderer = r; }
45 RenderList* renderer() const override { return m_renderer.lock().get(); }
46
47 void createOutput(OutputConfiguration conf) override;
48 void destroyOutput() override;
49 void updateGraphicsAPI(GraphicsApi api) override;
50 std::shared_ptr<RenderState> renderState() const override { return m_renderState; }
51 TextureRenderTarget currentRenderTarget() const noexcept override;
52
53 OutputNodeRenderer* createRenderer(RenderList& r) const noexcept override;
54 Configuration configuration() const noexcept override { return m_conf; }
55
56private:
59 QSize renderSize() const noexcept;
62 void inputsChanged();
63 void createTarget();
64 void releaseTarget();
65
66 Configuration m_conf;
67 std::weak_ptr<RenderList> m_renderer;
68 std::shared_ptr<RenderState> m_renderState;
69 std::function<void()> m_onResize;
70 std::vector<QSize> m_sizes;
71 // The list's own target, which nothing draws into: it gives the render
72 // state the descriptor the passes of the list are compatible with
73 QRhiTexture* m_texture{};
74 QRhiTextureRenderTarget* m_renderTarget{};
75};
76}
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Definition OutputNode.hpp:56
Definition OutputNode.hpp:38
List of nodes to be rendered to an output.
Definition RenderList.hpp:36
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
GraphicsApi
Available graphics APIs to use.
Definition RenderState.hpp:25
Definition OutputNode.hpp:17
Definition OutputNode.hpp:94
The output that renders, for the editor's previews, the nodes no output of the patch renders.
Definition PreviewHubNode.hpp:24
Useful abstraction for storing all the data related to a render target.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:307