finished prototype of nodes providing a texture to a viewer

This commit is contained in:
itsmattkc
2019-07-13 03:13:59 -04:00
parent d76691a9ef
commit f2d11662c9
23 changed files with 383 additions and 68 deletions
+32 -1
View File
@@ -1,14 +1,45 @@
#include "solid.h"
SolidGenerator::SolidGenerator(QObject *parent) :
Node(parent)
Node(parent),
texture_(nullptr)
{
texture_output_ = new NodeOutput(this);
texture_output_->set_data_type(NodeOutput::kTexture);
}
QString SolidGenerator::Name()
{
return tr("Solid");
}
QString SolidGenerator::Category()
{
return tr("Generator");
}
QString SolidGenerator::Description()
{
return tr("Generate a solid color.");
}
NodeOutput *SolidGenerator::texture_output()
{
return texture_output_;
}
void SolidGenerator::Process(const rational &time)
{
Q_UNUSED(time)
// FIXME: Test code
if (texture_ == nullptr) {
QImage img(1920, 1080, QImage::Format_RGBA8888_Premultiplied);
img.fill(Qt::red);
texture_ = new QOpenGLTexture(img);
}
texture_output_->set_value(texture_->textureId());
// End test code
}
+12
View File
@@ -1,17 +1,29 @@
#ifndef SOLIDGENERATOR_H
#define SOLIDGENERATOR_H
#include <QOpenGLTexture>
#include "node/node.h"
class SolidGenerator : public Node
{
Q_OBJECT
public:
SolidGenerator(QObject* parent = nullptr);
virtual QString Name() override;
virtual QString Category() override;
virtual QString Description() override;
NodeOutput* texture_output();
public slots:
virtual void Process(const rational &time) override;
private:
NodeOutput* texture_output_;
QOpenGLTexture* texture_;
};
#endif // SOLIDGENERATOR_H