Loading...
Searching...
No Matches
score-plugin-gfx/Gfx/Graph/Graph.hpp
1#pragma once
2#include <Process/Dataflow/CableData.hpp>
3
4#include <Gfx/Graph/Node.hpp>
5#include <Gfx/Graph/RenderList.hpp>
6
7#include <ossia/detail/algorithms.hpp>
8
9#include <score_plugin_gfx_export.h>
10namespace score::gfx
11{
12class OutputNode;
13class Window;
17struct SCORE_PLUGIN_GFX_EXPORT Graph
18{
22 explicit Graph();
23
24 ~Graph();
25
29 void addNode(score::gfx::Node* n);
30
34 void removeNode(score::gfx::Node* n);
35
39 void addEdge(Port* source, Port* sink, Process::CableType t);
40
44 void removeEdge(Port* source, Port* sink);
45
49 void addAndLinkEdge(Port* source, Port* sink, Process::CableType t);
50
54 void unlinkAndRemoveEdge(Port* source, Port* sink);
55
59 void clearEdges();
60
64 void createAllRenderLists(GraphicsApi graphicsApi);
65
69 void createSingleRenderList(score::gfx::OutputNode& node, GraphicsApi graphicsApi);
70
74 void destroyOutputRenderList(score::gfx::OutputNode& node);
75
79 void relinkGraph();
80
84 bool canDoVSync() const noexcept;
85
86 const std::vector<std::shared_ptr<RenderList>>& renderLists() const noexcept
87 {
88 return m_renderers;
89 }
90
91 std::span<OutputNode* const> outputs() const noexcept
92 {
93 return m_outputs;
94 }
95
96private:
97 void initializeOutput(OutputNode* output, GraphicsApi graphicsApi);
98 void createOutputRenderList(OutputNode& output);
99 void recreateOutputRenderList(OutputNode& output);
100 std::shared_ptr<RenderList>
101 createRenderList(OutputNode*, std::shared_ptr<RenderState> state);
102
103 std::vector<std::shared_ptr<RenderList>> m_renderers;
104 std::vector<std::shared_ptr<Window>> m_unused_windows;
105
106 std::vector<score::gfx::Node*> m_nodes;
107 std::vector<Edge*> m_edges;
108
109 std::vector<OutputNode*> m_outputs;
110};
111}
Root data model for visual nodes.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:74
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Definition OutputNode.hpp:31
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:12
GraphicsApi
Available graphics APIs to use.
Definition RenderState.hpp:22
Represents a graph of renderers.
Definition score-plugin-gfx/Gfx/Graph/Graph.hpp:18
Port of a score::gfx::Node.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:54