Loading [MathJax]/extensions/TeX/AMSmath.js
Radium Engine  1.5.28
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RenderingGraph.hpp
1#pragma once
2#include <Dataflow/RaDataflow.hpp>
3
4#include <Dataflow/Core/DataflowGraph.hpp>
5
6#include <Dataflow/Rendering/Nodes/RenderingNode.hpp>
7
8#if 0
9# include <RadiumRenderNodes/Nodes/Scene/SceneNode.hpp>
10# include <RadiumRenderNodes/Nodes/Sinks/DisplaySinkNode.hpp>
11#endif
12
13namespace Ra {
14namespace Dataflow {
15namespace Rendering {
16namespace Renderer {
17using namespace Ra::Dataflow::Rendering::Nodes;
18using namespace Ra::Dataflow::Core;
19
20class RA_DATAFLOW_API RenderingGraph : public DataflowGraph
21{
22 public:
23 explicit RenderingGraph( const std::string& name );
24 ~RenderingGraph() override = default;
25
26 void init() override;
27 bool add_node( Node* newNode ) override;
28 bool remove_node( Node* node ) override;
29 void clear_nodes() override;
30
32 void setShaderProgramManager( Ra::Engine::Data::ShaderProgramManager* shaderMngr ) {
33 m_shaderMngr = shaderMngr;
34 }
35
37 void resize( uint32_t width, uint32_t height );
38
40 void setDataSources( std::vector<RenderObjectType>* ros, std::vector<LightType>* lights );
42 void setCameras( std::vector<CameraType>* cameras );
43
45 const std::vector<TextureType*>& getImagesOutput() const;
46
48 void buildRenderTechnique( Ra::Engine::Rendering::RenderObject* ro ) const;
50 static const std::string& node_typename();
51
52 protected:
53 void fromJsonInternal( const nlohmann::json& ) override;
54 void toJsonInternal( nlohmann::json& ) const override;
55
56 private:
58 Ra::Engine::Data::ShaderProgramManager* m_shaderMngr { nullptr };
60 std::vector<RenderingNode*> m_renderingNodes; // to resize
61 std::vector<RenderingNode*> m_rtIndexedNodes; // associate an index and buildRenderTechnique
62#if 0
64 std::vector<SceneNode*> m_dataProviders;
65
66 // DisplaySink observerMethod : right now, observe only displaySink node
67 void observeSinks( const std::vector<TextureType*>& graphOutput );
69 DisplaySinkNode* m_displaySinkNode { nullptr };
70#endif
72 int m_displayObserverId { -1 };
73 std::vector<TextureType*> m_outputTextures;
74};
75
76inline RenderingGraph::RenderingGraph( const std::string& name ) :
77 DataflowGraph( name, node_typename() ) {}
78
79inline const std::string& RenderingGraph::node_typename() {
80 static std::string demangledTypeName { "Rendering Graph" };
81 return demangledTypeName;
82}
83
84inline void RenderingGraph::resize( uint32_t width, uint32_t height ) {
85 for ( auto rn : m_renderingNodes ) {
86 rn->resize( width, height );
87 }
88}
89
90inline void RenderingGraph::setDataSources( std::vector<RenderObjectType>* ros,
91 std::vector<LightType>* lights ) {
92#if 0
93 for(auto sn : m_dataProviders) {
94 sn->setScene(ros, lights);
95 }
96#endif
97}
98
99inline void RenderingGraph::setCameras( std::vector<CameraType>* cameras ) {
100#if 0
101 for(auto sn : m_dataProviders) {
102 sn->setCameras(cameras);
103 }
104#endif
105}
106
107inline void RenderingGraph::fromJsonInternal( const nlohmann::json& ) {}
108inline void RenderingGraph::toJsonInternal( nlohmann::json& ) const {}
109
110} // namespace Renderer
111} // namespace Rendering
112} // namespace Dataflow
113} // namespace Ra
Represent a set of connected nodes that define a Direct Acyclic Computational Graph Ownership of node...
Base abstract class for all the nodes added and used by the node system.
Definition Node.hpp:40
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:4