Loading...
Searching...
No Matches
score-plugin-gfx/Gfx/Graph/Graph.hpp
1#pragma once
2#include <Gfx/Graph/Node.hpp>
3#include <Gfx/Graph/RenderList.hpp>
4
5#include <ossia/detail/algorithms.hpp>
6
7#include <score_plugin_gfx_export.h>
8namespace score::gfx
9{
10class OutputNode;
11class Window;
15struct SCORE_PLUGIN_GFX_EXPORT Graph
16{
20 explicit Graph();
21
22 ~Graph();
23
27 void addNode(score::gfx::Node* n);
28
32 void removeNode(score::gfx::Node* n);
33
37 void addEdge(Port* source, Port* sink);
38
42 void removeEdge(Port* source, Port* sink);
43
47 void addAndLinkEdge(Port* source, Port* sink);
48
52 void unlinkAndRemoveEdge(Port* source, Port* sink);
53
57 void clearEdges();
58
62 void createAllRenderLists(GraphicsApi graphicsApi);
63
67 void createSingleRenderList(score::gfx::OutputNode& node, GraphicsApi graphicsApi);
68
72 void destroyOutputRenderList(score::gfx::OutputNode& node);
73
77 void relinkGraph();
78
85 void setVSyncCallback(std::function<void()>);
86
90 bool canDoVSync() const noexcept;
91
92 const std::vector<std::shared_ptr<RenderList>>& renderLists() const noexcept
93 {
94 return m_renderers;
95 }
96
97private:
98 void initializeOutput(OutputNode* output, GraphicsApi graphicsApi);
99 void createOutputRenderList(OutputNode& output);
100 void recreateOutputRenderList(OutputNode& output);
101 std::shared_ptr<RenderList>
102 createRenderList(OutputNode*, std::shared_ptr<RenderState> state);
103
104 std::vector<std::shared_ptr<RenderList>> m_renderers;
105 std::vector<std::shared_ptr<Window>> m_unused_windows;
106 std::function<void()> m_vsync_callback;
107
108 std::vector<score::gfx::Node*> m_nodes;
109 std::vector<Edge*> m_edges;
110
111 std::vector<OutputNode*> m_outputs;
112};
113}
Root data model for visual nodes.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:60
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Definition OutputNode.hpp:23
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:12
GraphicsApi
Available graphics APIs to use.
Definition RenderState.hpp:17
Represents a graph of renderers.
Definition score-plugin-gfx/Gfx/Graph/Graph.hpp:16
Port of a score::gfx::Node.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:48