[Bf-blender-cvs] [e30d5d183cc] compositor-full-frame: Compositor: Full frame Map Value node
Manuel Castilla
noreply at git.blender.org
Mon Aug 16 19:43:43 CEST 2021
Commit: e30d5d183cc7afcdf95d65a42393adb1bdc7faf6
Author: Manuel Castilla
Date: Mon Aug 16 11:37:13 2021 +0200
Branches: compositor-full-frame
https://developer.blender.org/rBe30d5d183cc7afcdf95d65a42393adb1bdc7faf6
Compositor: Full frame Map Value node
===================================================================
M source/blender/compositor/operations/COM_MapValueOperation.cc
M source/blender/compositor/operations/COM_MapValueOperation.h
===================================================================
diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cc b/source/blender/compositor/operations/COM_MapValueOperation.cc
index 03fa80d220d..73e812c9a65 100644
--- a/source/blender/compositor/operations/COM_MapValueOperation.cc
+++ b/source/blender/compositor/operations/COM_MapValueOperation.cc
@@ -60,4 +60,27 @@ void MapValueOperation::deinitExecution()
this->m_inputOperation = nullptr;
}
+void MapValueOperation::update_memory_buffer_partial(MemoryBuffer *output,
+ const rcti &area,
+ Span<MemoryBuffer *> inputs)
+{
+ for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
+ const float input = *it.in(0);
+ TexMapping *texmap = this->m_settings;
+ float value = (input + texmap->loc[0]) * texmap->size[0];
+ if (texmap->flag & TEXMAP_CLIP_MIN) {
+ if (value < texmap->min[0]) {
+ value = texmap->min[0];
+ }
+ }
+ if (texmap->flag & TEXMAP_CLIP_MAX) {
+ if (value > texmap->max[0]) {
+ value = texmap->max[0];
+ }
+ }
+
+ it.out[0] = value;
+ }
+}
+
} // namespace blender::compositor
diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h
index eb7714714e9..a595eac3155 100644
--- a/source/blender/compositor/operations/COM_MapValueOperation.h
+++ b/source/blender/compositor/operations/COM_MapValueOperation.h
@@ -18,7 +18,7 @@
#pragma once
-#include "COM_NodeOperation.h"
+#include "COM_MultiThreadedOperation.h"
#include "DNA_texture_types.h"
namespace blender::compositor {
@@ -27,7 +27,7 @@ namespace blender::compositor {
* this program converts an input color to an output value.
* it assumes we are in sRGB color space.
*/
-class MapValueOperation : public NodeOperation {
+class MapValueOperation : public MultiThreadedOperation {
private:
/**
* Cached reference to the inputProgram
@@ -63,6 +63,10 @@ class MapValueOperation : public NodeOperation {
{
this->m_settings = settings;
}
+
+ void update_memory_buffer_partial(MemoryBuffer *output,
+ const rcti &area,
+ Span<MemoryBuffer *> inputs) override;
};
} // namespace blender::compositor
More information about the Bf-blender-cvs
mailing list