noise: add image noise test tool
This commit is contained in:
parent
c0859e3160
commit
5295f1a205
@ -248,10 +248,11 @@ AM_DEFAULT_SOURCE_EXT = .cpp
|
||||
AM_LDFLAGS = $(BOOST_LDFLAGS)
|
||||
|
||||
bin_PROGRAMS = \
|
||||
tools/hash \
|
||||
tools/json-clean \
|
||||
tools/json-validate \
|
||||
tools/json-schema
|
||||
tools/json-schema \
|
||||
tools/hash \
|
||||
tools/noise
|
||||
|
||||
LDADD = $(top_builddir)/libutil.a $(BOOST_FILESYSTEM_LIB) $(BOOST_SYSTEM_LIB) $(ZLIB_LIBS)
|
||||
|
||||
|
@ -419,5 +419,8 @@ util::ppm::write (const uint8_t *restrict pixels,
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template struct util::image::buffer<uint8_t>;
|
||||
template struct util::image::buffer<float>;
|
||||
|
||||
template util::image::buffer<uint8_t> util::image::buffer<uint8_t>::alloc (void) const;
|
||||
template util::image::buffer<uint8_t> util::image::buffer<uint8_t>::clone (void) const;
|
||||
template util::image::buffer<uint8_t> util::image::buffer<float>::clone (void) const;
|
||||
|
20
tools/noise.cpp
Normal file
20
tools/noise.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "image.hpp"
|
||||
#include "noise.hpp"
|
||||
#include "lerp.hpp"
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
util::image::buffer<float> img (1920, 1080);
|
||||
|
||||
//static constexpr auto lerp_t = lerp::cubic;
|
||||
//using basis_t = util::noise::gradient<lerp_t>;
|
||||
//using noise_t = util::noise::fbm<basis_t>;
|
||||
|
||||
using noise_t = util::noise::fbm<util::noise::gradient<lerp::quintic>>;
|
||||
|
||||
util::noise::fill (img, noise_t {});
|
||||
|
||||
auto grey = img.clone<uint8_t> ();
|
||||
util::pgm::write (grey, "noise.ppm");
|
||||
}
|
Loading…
Reference in New Issue
Block a user