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
|
|
@ -50,9 +50,16 @@ namespace psemek::vecr
|
||||||
template <typename Colorizer>
|
template <typename Colorizer>
|
||||||
any_colorizer & operator = (Colorizer && colorizer)
|
any_colorizer & operator = (Colorizer && colorizer)
|
||||||
{
|
{
|
||||||
colorizer_ = [colorizer = std::forward<Colorizer>(colorizer)](math::point<float, 2> const & p, sdf_sample const & sample){
|
if constexpr (std::is_invocable_v<Colorizer, math::point<float, 2> const &, sdf_sample const &>)
|
||||||
return colorize(colorizer, p, sample);
|
{
|
||||||
};
|
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;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue