sandwich renderer between track and viewer

This commit is contained in:
itsmattkc
2019-08-22 16:52:04 +10:00
parent 6b24ac69d6
commit 44dfacfa7a
3 changed files with 62 additions and 3 deletions
+11 -1
View File
@@ -221,6 +221,7 @@ void Core::CreateNewFolder()
#include "node/output/timeline/timeline.h"
#include "node/output/track/track.h"
#include "node/output/viewer/viewer.h"
#include "node/processor/renderer/renderer.h"
#include "panel/panelmanager.h"
#include "panel/node/node.h"
#include "panel/viewer/viewer.h"
@@ -271,13 +272,22 @@ void Core::CreateNewSequence()
TimelineOutput* tb = new TimelineOutput();
new_sequence->AddNode(tb);
RendererProcessor* rp = new RendererProcessor();
new_sequence->AddNode(rp);
ViewerOutput* vo = new ViewerOutput();
new_sequence->AddNode(vo);
TrackOutput* to = new TrackOutput();
new_sequence->AddNode(to);
NodeParam::ConnectEdge(to->texture_output(), vo->texture_input());
// Connect track to renderer
NodeParam::ConnectEdge(to->texture_output(), rp->texture_input());
// Connect renderer to viewer
NodeParam::ConnectEdge(rp->texture_output(), vo->texture_input());
// Connect track to timeline
NodeParam::ConnectEdge(to->track_output(), tb->track_input());
vo->AttachViewer(olive::panel_focus_manager->MostRecentlyFocused<ViewerPanel>());
+37
View File
@@ -25,6 +25,13 @@
RendererProcessor::RendererProcessor() :
started_(false)
{
texture_input_ = new NodeInput("tex_in");
texture_input_->add_data_input(NodeInput::kTexture);
AddParameter(texture_input_);
texture_output_ = new NodeOutput("tex_out");
texture_output_->set_data_type(NodeInput::kTexture);
AddParameter(texture_output_);
}
QString RendererProcessor::Name()
@@ -42,9 +49,23 @@ QString RendererProcessor::Description()
return tr("A multi-threaded OpenGL hardware-accelerated node compositor.");
}
QString RendererProcessor::id()
{
return "org.olivevideoeditor.Olive.renderervenus";
}
void RendererProcessor::Process(const rational &time)
{
Q_UNUSED(time)
// FIXME: Test code only
GLuint tex = texture_input_->get_value(time).value<GLuint>();
//glReadPixels()
texture_output_->set_value(tex);
// End test code
/*
// Ensure we have started
Start();
@@ -62,6 +83,12 @@ void RendererProcessor::Release()
Stop();
}
void RendererProcessor::InvalidateCache(const rational &start_range, const rational &end_range)
{
Q_UNUSED(start_range)
Q_UNUSED(end_range)
}
void RendererProcessor::Start()
{
if (started_) {
@@ -97,3 +124,13 @@ RendererThread* RendererProcessor::CurrentThread()
{
return dynamic_cast<RendererThread*>(QThread::currentThread());
}
NodeInput *RendererProcessor::texture_input()
{
return texture_input_;
}
NodeOutput *RendererProcessor::texture_output()
{
return texture_output_;
}
+14 -2
View File
@@ -42,11 +42,12 @@ public:
virtual QString Name() override;
virtual QString Category() override;
virtual QString Description() override;
virtual void Process(const rational &time) override;
virtual QString id() override;
virtual void Release() override;
virtual void InvalidateCache(const rational &start_range, const rational &end_range) override;
/**
* @brief Set parameters of the Renderer
*
@@ -75,6 +76,13 @@ public:
*/
static RendererThread *CurrentThread();
NodeInput* texture_input();
NodeOutput* texture_output();
public slots:
virtual void Process(const rational &time) override;
private:
/**
* @brief Allocate and start the multithreaded backend
@@ -89,6 +97,10 @@ private:
QVector<RendererThreadPtr> threads_;
bool started_;
NodeInput* texture_input_;
NodeOutput* texture_output_;
};
#endif // RENDERER_H