region: add uniform sampler

This commit is contained in:
Danny Robson 2018-05-30 14:35:03 +10:00
parent 78dd62283b
commit 16fc2effb2

View File

@ -209,6 +209,14 @@ namespace util {
} }
template <size_t S, typename T, typename GeneratorT>
util::point<S,T>
sample (region<S,T> shape, GeneratorT &&gen)
{
return shape.p + sample (shape.e, std::forward<GeneratorT> (gen)).template as<util::vector> ();
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template <typename T> using region2 = region<2,T>; template <typename T> using region2 = region<2,T>;
template <typename T> using region3 = region<3,T>; template <typename T> using region3 = region<3,T>;