Support using a lambda in vecr colorizer
This commit is contained in:
parent
472d095e2d
commit
5fcd2a171f
1 changed files with 10 additions and 3 deletions
|
|
@ -49,10 +49,17 @@ namespace psemek::vecr
|
|||
|
||||
template <typename Colorizer>
|
||||
any_colorizer & operator = (Colorizer && colorizer)
|
||||
{
|
||||
if constexpr (std::is_invocable_v<Colorizer, math::point<float, 2> const &, sdf_sample const &>)
|
||||
{
|
||||
colorizer_ = std::move(colorizer);
|
||||
}
|
||||
else
|
||||
{
|
||||
colorizer_ = [colorizer = std::forward<Colorizer>(colorizer)](math::point<float, 2> const & p, sdf_sample const & sample){
|
||||
return colorize(colorizer, p, sample);
|
||||
};
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue