Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Castilla <manzanillawork@gmail.com>2021-08-12 23:00:09 +0300
committerManuel Castilla <manzanillawork@gmail.com>2021-08-12 23:00:09 +0300
commitbf725bbb92df7be5729c1ece92a2ca2c8415a9bb (patch)
tree4c1bee0953382eadc1fa1396a472fa8ed4243ae5 /source/blender/compositor/operations/COM_GlareThresholdOperation.cc
parentae8e9c6f485666b47fcbf63f5b5eade38d0da7d0 (diff)
Compositor: Full frame Glare node
Due to current limitation of scaling up causing cropping, quality is always "High" independently of the selected one. This will be fixed once scaling is implemented with canvas adjustment.
Diffstat (limited to 'source/blender/compositor/operations/COM_GlareThresholdOperation.cc')
-rw-r--r--source/blender/compositor/operations/COM_GlareThresholdOperation.cc34
1 files changed, 32 insertions, 2 deletions
diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.cc b/source/blender/compositor/operations/COM_GlareThresholdOperation.cc
index 1d3402f5b7b..becf6c586ac 100644
--- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cc
+++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cc
@@ -34,8 +34,18 @@ void GlareThresholdOperation::determineResolution(unsigned int resolution[2],
unsigned int preferredResolution[2])
{
NodeOperation::determineResolution(resolution, preferredResolution);
- resolution[0] = resolution[0] / (1 << this->m_settings->quality);
- resolution[1] = resolution[1] / (1 << this->m_settings->quality);
+ switch (execution_model_) {
+ case eExecutionModel::Tiled:
+ resolution[0] = resolution[0] / (1 << this->m_settings->quality);
+ resolution[1] = resolution[1] / (1 << this->m_settings->quality);
+ break;
+ case eExecutionModel::FullFrame:
+ /* TODO(manzanilla): Currently scaling up always crop so it's not possible to use a lower
+ * resolution for lower quality to later scale up. Once scaling supports adapting canvas, use
+ * same implementation as #eExecutionModel::Tiled. This makes glare node to be always high
+ * quality. */
+ break;
+ }
}
void GlareThresholdOperation::initExecution()
@@ -70,4 +80,24 @@ void GlareThresholdOperation::deinitExecution()
this->m_inputProgram = nullptr;
}
+void GlareThresholdOperation::update_memory_buffer_partial(MemoryBuffer *output,
+ const rcti &area,
+ Span<MemoryBuffer *> inputs)
+{
+ const float threshold = this->m_settings->threshold;
+ for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
+ const float *color = it.in(0);
+ if (IMB_colormanagement_get_luminance(color) >= threshold) {
+ it.out[0] = color[0] - threshold;
+ it.out[1] = color[1] - threshold;
+ it.out[2] = color[2] - threshold;
+
+ CLAMP3_MIN(it.out, 0.0f);
+ }
+ else {
+ zero_v3(it.out);
+ }
+ }
+}
+
} // namespace blender::compositor