accleratedjob: simplified function calls
This commit is contained in:
@@ -70,9 +70,9 @@ void CornerPinDistortNode::Retranslate()
|
||||
void CornerPinDistortNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
{
|
||||
ShaderJob job;
|
||||
job.InsertValue(value);
|
||||
job.Insert(value);
|
||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
||||
job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
||||
|
||||
// Convert slider values to their pixel values and then convert to clip space (-1.0 ... 1.0) for overriding the
|
||||
// vertex coordinates.
|
||||
@@ -94,16 +94,16 @@ void CornerPinDistortNode::Value(const NodeValueRow &value, const NodeGlobals &g
|
||||
job.SetVertexCoordinates(adjusted_vertices);
|
||||
|
||||
// If no texture do nothing
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
if (job.Get(kTextureInput).toTexture()) {
|
||||
// In the special case that all sliders are in their default position just
|
||||
// push the texture.
|
||||
if (!(job.GetValue(kTopLeftInput).toVec2().isNull()
|
||||
&& job.GetValue(kTopRightInput).toVec2().isNull() &&
|
||||
job.GetValue(kBottomRightInput).toVec2().isNull() &&
|
||||
job.GetValue(kBottomLeftInput).toVec2().isNull())) {
|
||||
if (!(job.Get(kTopLeftInput).toVec2().isNull()
|
||||
&& job.Get(kTopRightInput).toVec2().isNull() &&
|
||||
job.Get(kBottomRightInput).toVec2().isNull() &&
|
||||
job.Get(kBottomLeftInput).toVec2().isNull())) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
} else {
|
||||
table->Push(job.GetValue(kTextureInput));
|
||||
table->Push(job.Get(kTextureInput));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,18 +78,18 @@ void CropDistortNode::Retranslate()
|
||||
void CropDistortNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
{
|
||||
ShaderJob job;
|
||||
job.InsertValue(value);
|
||||
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
||||
job.Insert(value);
|
||||
job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
if (!qIsNull(job.GetValue(kLeftInput).toDouble())
|
||||
|| !qIsNull(job.GetValue(kRightInput).toDouble())
|
||||
|| !qIsNull(job.GetValue(kTopInput).toDouble())
|
||||
|| !qIsNull(job.GetValue(kBottomInput).toDouble())) {
|
||||
if (job.Get(kTextureInput).toTexture()) {
|
||||
if (!qIsNull(job.Get(kLeftInput).toDouble())
|
||||
|| !qIsNull(job.Get(kRightInput).toDouble())
|
||||
|| !qIsNull(job.Get(kTopInput).toDouble())
|
||||
|| !qIsNull(job.Get(kBottomInput).toDouble())) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
} else {
|
||||
table->Push(job.GetValue(kTextureInput));
|
||||
table->Push(job.Get(kTextureInput));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,16 +79,16 @@ void FlipDistortNode::Value(const NodeValueRow &value, const NodeGlobals &global
|
||||
{
|
||||
ShaderJob job;
|
||||
|
||||
job.InsertValue(value);
|
||||
job.Insert(value);
|
||||
|
||||
// If there's no texture, no need to run an operation
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
if (job.Get(kTextureInput).toTexture()) {
|
||||
// Only run shader if at least one of flip or flop are selected
|
||||
if (job.GetValue(kHorizontalInput).toBool() || job.GetValue(kVerticalInput).toBool()) {
|
||||
if (job.Get(kHorizontalInput).toBool() || job.Get(kVerticalInput).toBool()) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
} else {
|
||||
// If we're not flipping or flopping just push the texture
|
||||
table->Push(job.GetValue(kTextureInput));
|
||||
table->Push(job.Get(kTextureInput));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,26 +65,26 @@ void MaskDistortNode::Value(const NodeValueRow &value, const NodeGlobals &global
|
||||
ShaderJob merge;
|
||||
|
||||
merge.SetShaderID(QStringLiteral("mrg"));
|
||||
merge.InsertValue(QStringLiteral("tex_a"), value[kBaseInput]);
|
||||
merge.Insert(QStringLiteral("tex_a"), value[kBaseInput]);
|
||||
|
||||
if (value[kFeatherInput].toDouble() > 0.0) {
|
||||
// Nest a blur shader in there too
|
||||
ShaderJob feather;
|
||||
|
||||
feather.SetShaderID(QStringLiteral("feather"));
|
||||
feather.InsertValue(BlurFilterNode::kTextureInput, NodeValue(NodeValue::kTexture, job, this));
|
||||
feather.InsertValue(BlurFilterNode::kMethodInput, NodeValue(NodeValue::kInt, int(BlurFilterNode::kGaussian), this));
|
||||
feather.InsertValue(BlurFilterNode::kHorizInput, NodeValue(NodeValue::kBoolean, true, this));
|
||||
feather.InsertValue(BlurFilterNode::kVertInput, NodeValue(NodeValue::kBoolean, true, this));
|
||||
feather.InsertValue(BlurFilterNode::kRepeatEdgePixelsInput, NodeValue(NodeValue::kBoolean, true, this));
|
||||
feather.InsertValue(BlurFilterNode::kRadiusInput, NodeValue(NodeValue::kFloat, value[kFeatherInput].toDouble(), this));
|
||||
feather.Insert(BlurFilterNode::kTextureInput, NodeValue(NodeValue::kTexture, job, this));
|
||||
feather.Insert(BlurFilterNode::kMethodInput, NodeValue(NodeValue::kInt, int(BlurFilterNode::kGaussian), this));
|
||||
feather.Insert(BlurFilterNode::kHorizInput, NodeValue(NodeValue::kBoolean, true, this));
|
||||
feather.Insert(BlurFilterNode::kVertInput, NodeValue(NodeValue::kBoolean, true, this));
|
||||
feather.Insert(BlurFilterNode::kRepeatEdgePixelsInput, NodeValue(NodeValue::kBoolean, true, this));
|
||||
feather.Insert(BlurFilterNode::kRadiusInput, NodeValue(NodeValue::kFloat, value[kFeatherInput].toDouble(), this));
|
||||
feather.SetIterations(2, BlurFilterNode::kTextureInput);
|
||||
feather.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
||||
feather.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
||||
feather.SetAlphaChannelRequired(ShaderJob::kAlphaForceOn);
|
||||
|
||||
merge.InsertValue(QStringLiteral("tex_b"), NodeValue(NodeValue::kTexture, feather, this));
|
||||
merge.Insert(QStringLiteral("tex_b"), NodeValue(NodeValue::kTexture, feather, this));
|
||||
} else {
|
||||
merge.InsertValue(QStringLiteral("tex_b"), NodeValue(NodeValue::kTexture, job, this));
|
||||
merge.Insert(QStringLiteral("tex_b"), NodeValue(NodeValue::kTexture, job, this));
|
||||
}
|
||||
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(merge), this);
|
||||
|
||||
@@ -99,8 +99,8 @@ void TransformDistortNode::Value(const NodeValueRow &value, const NodeGlobals &g
|
||||
if (!real_matrix.isIdentity()) {
|
||||
// The matrix will transform things
|
||||
ShaderJob job;
|
||||
job.InsertValue(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture), this));
|
||||
job.InsertValue(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, real_matrix, this));
|
||||
job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture), this));
|
||||
job.Insert(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, real_matrix, this));
|
||||
job.SetInterpolation(QStringLiteral("ove_maintex"), static_cast<Texture::Interpolation>(value[kInterpolationInput].toInt()));
|
||||
|
||||
// FIXME: This should be optimized, we can use matrix math to determine if this operation will
|
||||
|
||||
Reference in New Issue
Block a user