Loading...
Searching...
No Matches
SinkNode.hpp
1#pragma once
2#include <Gfx/Graph/OutputNode.hpp>
3#include <Gfx/Graph/RenderList.hpp>
4#include <Gfx/Graph/Utils.hpp>
5
6#include <chrono>
7#include <memory>
8
9namespace score::gfx
10{
23class SCORE_PLUGIN_GFX_EXPORT SinkNode final : public OutputNode
24{
25public:
26 explicit SinkNode(double rate);
27 ~SinkNode() override;
28
29 void setRate(double fps) noexcept;
30 double rate() const noexcept { return m_rate; }
31
32 void process(Message&& msg) override;
33
34 void startRendering() override;
35 void render() override;
36 bool canRender() const override;
37 void onRendererChange() override;
38 void stopRendering() override;
39
40 void setRenderer(std::shared_ptr<RenderList> r) override;
41 RenderList* renderer() const override;
42
43 void createOutput(OutputConfiguration conf) override;
44 void destroyOutput() override;
45 void updateGraphicsAPI(GraphicsApi api) override;
46
47 std::shared_ptr<RenderState> renderState() const override;
48 TextureRenderTarget currentRenderTarget() const noexcept override;
49 OutputNodeRenderer* createRenderer(RenderList& r) const noexcept override;
50 Configuration configuration() const noexcept override;
51
52 // Frames rendered so far, for tests.
53 int64_t frames() const noexcept { return m_frames; }
54
55private:
56 std::weak_ptr<RenderList> m_renderer;
57 std::shared_ptr<RenderState> m_renderState;
58 QRhiTexture* m_texture{};
59 QRhiTextureRenderTarget* m_renderTarget{};
60
61 double m_rate{30.};
62 // The rate of the clock that drives render(), as of the last configuration()
63 // the host built that clock from.
64 mutable double m_clockRate{60.};
65 std::chrono::steady_clock::time_point m_last{};
66 int64_t m_frames{};
67};
68}
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Definition OutputNode.hpp:55
Definition OutputNode.hpp:37
List of nodes to be rendered to an output.
Definition RenderList.hpp:33
An output that draws nowhere.
Definition SinkNode.hpp:24
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
GraphicsApi
Available graphics APIs to use.
Definition RenderState.hpp:22
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:51
Definition OutputNode.hpp:16
Definition OutputNode.hpp:85
Useful abstraction for storing all the data related to a render target.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:279