diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-09-04 16:23:47 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-09-04 18:06:01 +0300 |
commit | d84c79a218e63d0d752d918e2c1cbcc2f90fd35e (patch) | |
tree | 13d078db89900ffa8401bc0b8a9d075ad8e5dab3 /source/blender/compositor/operations/COM_MapValueOperation.cc | |
parent | 9d7cb5c4a1158266d2f8caa1fc19be2a00fdf101 (diff) |
Compositor: Full frame vector nodes
Adds full frame implementation to Map Range, Map Value, Normal and
Normalize nodes. The other nodes in "Vector" sub-menu are submitted
separately.
Part of T88150.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D12233
Diffstat (limited to 'source/blender/compositor/operations/COM_MapValueOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_MapValueOperation.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cc b/source/blender/compositor/operations/COM_MapValueOperation.cc index 03fa80d220d..94fecc3f49e 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cc +++ b/source/blender/compositor/operations/COM_MapValueOperation.cc @@ -25,6 +25,7 @@ MapValueOperation::MapValueOperation() this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); this->m_inputOperation = nullptr; + flags.can_be_constant = true; } void MapValueOperation::initExecution() @@ -60,4 +61,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 |