nodes: allow two texture inputs in opacity
This commit is contained in:
@@ -39,15 +39,22 @@ void OpacityEffect::Retranslate()
|
||||
|
||||
ShaderCode OpacityEffect::GetShaderCode(const ShaderRequest &request) const
|
||||
{
|
||||
Q_UNUSED(request)
|
||||
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/opacity.frag"));
|
||||
if (request.id == QStringLiteral("rgbmult")) {
|
||||
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/opacity_rgb.frag"));
|
||||
} else {
|
||||
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/opacity.frag"));
|
||||
}
|
||||
}
|
||||
|
||||
void OpacityEffect::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
{
|
||||
// If there's no texture, no need to run an operation
|
||||
if (TexturePtr tex = value[kTextureInput].toTexture()) {
|
||||
if (!qFuzzyCompare(value[kValueInput].toDouble(), 1.0)) {
|
||||
if (TexturePtr opacity_tex = value[kValueInput].toTexture()) {
|
||||
ShaderJob job(value);
|
||||
job.SetShaderID(QStringLiteral("rgbmult"));
|
||||
table->Push(NodeValue::kTexture, tex->toJob(job), this);
|
||||
} else if (!qFuzzyCompare(value[kValueInput].toDouble(), 1.0)) {
|
||||
table->Push(NodeValue::kTexture, tex->toJob(ShaderJob(value)), this);
|
||||
} else {
|
||||
// 1.0 float is a no-op, so just push the texture
|
||||
|
||||
Reference in New Issue
Block a user