mathnode: implemented add/subtract/multiply/divide/power functions

Includes implementing combobox UI for the NodeParamViewWidgetBridge.
This commit is contained in:
itsmattkc
2020-04-15 01:52:24 +10:00
parent fd1ecfae6f
commit a0a7d106dc
15 changed files with 451 additions and 88 deletions
+4 -1
View File
@@ -67,7 +67,7 @@ bool OpenGLProxy::Init()
return true;
}
void OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const TimeRange &range, NodeValueTable* table)
void OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, NodeValueTable* table)
{
// Ensure stream is video or image type
if (stream->type() != Stream::kVideo && stream->type() != Stream::kImage) {
@@ -289,6 +289,9 @@ void OpenGLProxy::RunNodeAccelerated(const Node *node, const TimeRange &range, c
case NodeInput::kMatrix:
shader->setUniformValue(variable_location, value.value<QMatrix4x4>());
break;
case NodeInput::kCombo:
shader->setUniformValue(variable_location, value.value<int>());
break;
case NodeInput::kColor:
{
Color color = value.value<Color>();
+1 -1
View File
@@ -63,7 +63,7 @@ public:
void Close();
void FrameToValue(FramePtr frame, StreamPtr stream, const TimeRange &range, NodeValueTable* table);
void FrameToValue(FramePtr frame, StreamPtr stream, NodeValueTable* table);
void RunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase &input_params, NodeValueTable* output_params);
+1 -1
View File
@@ -41,7 +41,7 @@ void OpenGLWorker::FrameToValue(DecoderPtr decoder, StreamPtr stream, const Time
FramePtr frame = decoder->RetrieveVideo(range.in(), video_params().divider());
if (frame) {
emit RequestFrameToValue(frame, stream, range, table);
emit RequestFrameToValue(frame, stream, table);
}
}
+1 -1
View File
@@ -38,7 +38,7 @@ public:
QObject* parent = nullptr);
signals:
void RequestFrameToValue(FramePtr frame, StreamPtr stream, const TimeRange &range, NodeValueTable* table);
void RequestFrameToValue(FramePtr frame, StreamPtr stream, NodeValueTable* table);
void RequestRunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase &input_params, NodeValueTable* output_params);
+64
View File
@@ -204,6 +204,70 @@ QColor Color::toQColor() const
return c;
}
const Color &Color::operator+=(const Color &rhs)
{
for (int i=0;i<kRGBAChannels;i++) {
data_[i] += rhs.data_[i];
}
return *this;
}
const Color &Color::operator-=(const Color &rhs)
{
for (int i=0;i<kRGBAChannels;i++) {
data_[i] -= rhs.data_[i];
}
return *this;
}
const Color &Color::operator*=(const float &rhs)
{
for (int i=0;i<kRGBAChannels;i++) {
data_[i] *= rhs;
}
return *this;
}
const Color &Color::operator/=(const float &rhs)
{
for (int i=0;i<kRGBAChannels;i++) {
data_[i] /= rhs;
}
return *this;
}
Color Color::operator+(const Color &rhs) const
{
Color c(*this);
c += rhs;
return c;
}
Color Color::operator-(const Color &rhs) const
{
Color c(*this);
c -= rhs;
return c;
}
Color Color::operator*(const float &rhs) const
{
Color c(*this);
c *= rhs;
return c;
}
Color Color::operator/(const float &rhs) const
{
Color c(*this);
c /= rhs;
return c;
}
OLIVE_NAMESPACE_EXIT
QDebug operator<<(QDebug debug, const OLIVE_NAMESPACE::Color &r)
+12
View File
@@ -86,6 +86,18 @@ public:
QColor toQColor() const;
// Assignment math operators
const Color& operator+=(const Color& rhs);
const Color& operator-=(const Color& rhs);
const Color& operator*=(const float& rhs);
const Color& operator/=(const float& rhs);
// Binary math operators
Color operator+(const Color& rhs) const;
Color operator-(const Color& rhs) const;
Color operator*(const float& rhs) const;
Color operator/(const float& rhs) const;
private:
float data_[kRGBAChannels];