nodevalue: begin abstracting qvariant
This commit is contained in:
@@ -35,12 +35,12 @@ public:
|
||||
|
||||
SampleJob(const NodeValue& value)
|
||||
{
|
||||
samples_ = value.data().value<SampleBufferPtr>();
|
||||
samples_ = value.toSamples();
|
||||
}
|
||||
|
||||
SampleJob(const QString& from, const NodeValueRow& row)
|
||||
{
|
||||
samples_ = row[from].data().value<SampleBufferPtr>();
|
||||
samples_ = row[from].toSamples();
|
||||
}
|
||||
|
||||
SampleBufferPtr samples() const
|
||||
|
||||
@@ -449,48 +449,48 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
|
||||
case NodeValue::kInt:
|
||||
// kInt technically specifies a LongLong, but OpenGL doesn't support those. This may lead to
|
||||
// over/underflows if the number is large enough, but the likelihood of that is quite low.
|
||||
functions_->glUniform1i(variable_location, value.data().toInt());
|
||||
functions_->glUniform1i(variable_location, value.toInt());
|
||||
break;
|
||||
case NodeValue::kFloat:
|
||||
// kFloat technically specifies a double but as above, OpenGL doesn't support those.
|
||||
functions_->glUniform1f(variable_location, value.data().toFloat());
|
||||
functions_->glUniform1f(variable_location, value.toDouble());
|
||||
break;
|
||||
case NodeValue::kVec2:
|
||||
{
|
||||
QVector2D v = value.data().value<QVector2D>();
|
||||
QVector2D v = value.toVec2();
|
||||
functions_->glUniform2fv(variable_location, 1, reinterpret_cast<const GLfloat*>(&v));
|
||||
break;
|
||||
}
|
||||
case NodeValue::kVec3:
|
||||
{
|
||||
QVector3D v = value.data().value<QVector3D>();
|
||||
QVector3D v = value.toVec3();
|
||||
functions_->glUniform3fv(variable_location, 1, reinterpret_cast<const GLfloat*>(&v));
|
||||
break;
|
||||
}
|
||||
case NodeValue::kVec4:
|
||||
{
|
||||
QVector4D v = value.data().value<QVector4D>();
|
||||
QVector4D v = value.toVec4();
|
||||
functions_->glUniform4fv(variable_location, 1, reinterpret_cast<const GLfloat*>(&v));
|
||||
break;
|
||||
}
|
||||
case NodeValue::kMatrix:
|
||||
functions_->glUniformMatrix4fv(variable_location, 1, false, value.data().value<QMatrix4x4>().constData());
|
||||
functions_->glUniformMatrix4fv(variable_location, 1, false, value.toMatrix().constData());
|
||||
break;
|
||||
case NodeValue::kCombo:
|
||||
functions_->glUniform1i(variable_location, value.data().value<int>());
|
||||
functions_->glUniform1i(variable_location, value.toInt());
|
||||
break;
|
||||
case NodeValue::kColor:
|
||||
{
|
||||
Color color = value.data().value<Color>();
|
||||
Color color = value.toColor();
|
||||
functions_->glUniform4f(variable_location, color.red(), color.green(), color.blue(), color.alpha());
|
||||
break;
|
||||
}
|
||||
case NodeValue::kBoolean:
|
||||
functions_->glUniform1i(variable_location, value.data().toBool());
|
||||
functions_->glUniform1i(variable_location, value.toBool());
|
||||
break;
|
||||
case NodeValue::kTexture:
|
||||
{
|
||||
TexturePtr texture = value.data().value<TexturePtr>();
|
||||
TexturePtr texture = value.toTexture();
|
||||
|
||||
// Set value to bound texture
|
||||
functions_->glUniform1i(variable_location, textures_to_bind.size());
|
||||
@@ -552,7 +552,7 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
|
||||
// Ensure matrix is set, at least to identity
|
||||
GLint mvpmat_location = functions_->glGetUniformLocation(shader, "ove_mvpmat");
|
||||
if (mvpmat_location > -1) {
|
||||
functions_->glUniformMatrix4fv(mvpmat_location, 1, false, job.GetValue(QStringLiteral("ove_mvpmat")).data().value<QMatrix4x4>().constData());
|
||||
functions_->glUniformMatrix4fv(mvpmat_location, 1, false, job.GetValue(QStringLiteral("ove_mvpmat")).toMatrix().constData());
|
||||
}
|
||||
|
||||
// Set the viewport to the "physical" resolution of the destination
|
||||
|
||||
@@ -55,11 +55,11 @@ TexturePtr RenderProcessor::GenerateTexture(const rational &time, const rational
|
||||
table = GenerateTable(texture_output, viewer->GetValueHintForInput(ViewerOutput::kTextureInput), range);
|
||||
}
|
||||
|
||||
NodeValue tex_val = table.GetWithMeta(NodeValue::kTexture);
|
||||
NodeValue tex_val = table.Get(NodeValue::kTexture);
|
||||
|
||||
ResolveJobs(tex_val, range);
|
||||
|
||||
return tex_val.data().value<TexturePtr>();
|
||||
return tex_val.toTexture();
|
||||
}
|
||||
|
||||
FramePtr RenderProcessor::GenerateFrame(TexturePtr texture, const rational& time)
|
||||
@@ -196,12 +196,11 @@ void RenderProcessor::Run()
|
||||
table = GenerateTable(texture_output, viewer->GetValueHintForInput(ViewerOutput::kSamplesInput),time);
|
||||
}
|
||||
|
||||
NodeValue sample_val = table.GetWithMeta(NodeValue::kSamples);
|
||||
NodeValue sample_val = table.Get(NodeValue::kSamples);
|
||||
|
||||
ResolveJobs(sample_val, time);
|
||||
|
||||
QVariant sample_variant = sample_val.data();
|
||||
SampleBufferPtr samples = sample_variant.value<SampleBufferPtr>();
|
||||
SampleBufferPtr samples = sample_val.toSamples();
|
||||
if (samples && ticket_->property("enablewaveforms").toBool()) {
|
||||
AudioVisualWaveform vis;
|
||||
vis.set_channel_count(samples->audio_params().channel_count());
|
||||
@@ -212,7 +211,7 @@ void RenderProcessor::Run()
|
||||
if (ticket_->IsCancelled()) {
|
||||
ticket_->Finish();
|
||||
} else {
|
||||
ticket_->Finish(sample_variant);
|
||||
ticket_->Finish(QVariant::fromValue(samples));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -293,7 +292,7 @@ NodeValueTable RenderProcessor::GenerateBlockTable(const Track *track, const Tim
|
||||
|
||||
// Destination buffer
|
||||
NodeValueTable table = GenerateTable(b, track->GetValueHintForInput(Track::kBlockInput, track->GetArrayIndexFromBlock(b)),Track::TransformRangeForBlock(b, range_for_block));
|
||||
SampleBufferPtr samples_from_this_block = table.Take(NodeValue::kSamples).value<SampleBufferPtr>();
|
||||
SampleBufferPtr samples_from_this_block = table.Take(NodeValue::kSamples).toSamples();
|
||||
ClipBlock *clip_cast = dynamic_cast<ClipBlock*>(b);
|
||||
|
||||
if (samples_from_this_block) {
|
||||
|
||||
Reference in New Issue
Block a user