Add vecr::blur
This commit is contained in:
parent
4ce09fc6b0
commit
02ecca5ebc
1 changed files with 31 additions and 0 deletions
31
libs/vecr/include/psemek/vecr/blur.hpp
Normal file
31
libs/vecr/include/psemek/vecr/blur.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/vecr/sdf.hpp>
|
||||
#include <psemek/geom/point.hpp>
|
||||
#include <psemek/geom/box.hpp>
|
||||
|
||||
namespace psemek::vecr
|
||||
{
|
||||
|
||||
template <typename Shape>
|
||||
struct blur
|
||||
{
|
||||
Shape shape;
|
||||
float factor;
|
||||
};
|
||||
|
||||
template <typename Shape>
|
||||
sdf_sample sdf(blur<Shape> const & s, geom::point<float, 2> const & p)
|
||||
{
|
||||
auto result = sdf(s.shape, p);
|
||||
result.value /= s.factor;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Shape>
|
||||
geom::box<float, 2> bbox(blur<Shape> const & s)
|
||||
{
|
||||
return bbox(s.shape);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue