OutputNode.hpp
1 #pragma once
2 #include <Gfx/Graph/Node.hpp>
3 #include <Gfx/Graph/NodeRenderer.hpp>
4 #include <Gfx/Graph/RenderState.hpp>
5 #include <Gfx/Graph/Uniforms.hpp>
6 
7 #include <score_plugin_gfx_export.h>
8 namespace score::gfx
9 {
10 class SCORE_PLUGIN_GFX_EXPORT OutputNodeRenderer : public score::gfx::NodeRenderer
11 {
12 public:
13  virtual ~OutputNodeRenderer();
14  virtual void
15  finishFrame(RenderList&, QRhiCommandBuffer& commands, QRhiResourceUpdateBatch*& res);
16 };
17 
18 class Window;
22 class SCORE_PLUGIN_GFX_EXPORT OutputNode : public score::gfx::Node
23 {
24 public:
25  virtual ~OutputNode();
26 
27  virtual void setRenderer(std::shared_ptr<RenderList>) = 0;
28  virtual RenderList* renderer() const = 0;
29 
30  OutputNodeRenderer* createRenderer(RenderList& r) const noexcept override = 0;
31 
32  virtual void startRendering() = 0;
33  virtual void render() = 0;
34  virtual void stopRendering() = 0;
35  virtual bool canRender() const = 0;
36  virtual void onRendererChange() = 0;
37 
38  virtual void createOutput(
39  GraphicsApi graphicsApi, std::function<void()> onReady,
40  std::function<void()> onUpdate, std::function<void()> onResize)
41  = 0;
42 
43  virtual void updateGraphicsAPI(GraphicsApi);
44  virtual void destroyOutput() = 0;
45  virtual std::shared_ptr<RenderState> renderState() const = 0;
46 
48  {
49  // If set, the host is responsible for calling render() at this
50  // rate (given in milliseconds)
51  std::optional<double> manualRenderingRate;
52  bool outputNeedsRenderPass{};
53  };
54 
55  virtual Configuration configuration() const noexcept = 0;
56 
57 protected:
58  explicit OutputNode();
59 };
60 }
Root data model for visual nodes.
Definition: score-plugin-gfx/Gfx/Graph/Node.hpp:60
Renderer for a given node.
Definition: NodeRenderer.hpp:11
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Definition: OutputNode.hpp:23
OutputNodeRenderer * createRenderer(RenderList &r) const noexcept override=0
Create a renderer in a given context for this node.
Definition: OutputNode.hpp:11
List of nodes to be rendered to an output.
Definition: RenderList.hpp:19
A platform window in which the content is going to be rendered.
Definition: plugins/score-plugin-gfx/Gfx/Graph/Window.hpp:19
Graphics rendering pipeline for ossia score.
Definition: PreviewWidget.hpp:12
GraphicsApi
Available graphics APIs to use.
Definition: RenderState.hpp:17
Definition: OutputNode.hpp:48