noise: add image noise test tool

This commit is contained in:
Danny Robson 2015-05-18 14:11:08 +10:00
parent c0859e3160
commit 5295f1a205
3 changed files with 26 additions and 2 deletions

View File

@ -248,10 +248,11 @@ AM_DEFAULT_SOURCE_EXT = .cpp
AM_LDFLAGS = $(BOOST_LDFLAGS) AM_LDFLAGS = $(BOOST_LDFLAGS)
bin_PROGRAMS = \ bin_PROGRAMS = \
tools/hash \
tools/json-clean \ tools/json-clean \
tools/json-validate \ 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) LDADD = $(top_builddir)/libutil.a $(BOOST_FILESYSTEM_LIB) $(BOOST_SYSTEM_LIB) $(ZLIB_LIBS)

View File

@ -419,5 +419,8 @@ util::ppm::write (const uint8_t *restrict pixels,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template struct util::image::buffer<uint8_t>; 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>::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<uint8_t>::clone (void) const;
template util::image::buffer<uint8_t> util::image::buffer<float>::clone (void) const;

20
tools/noise.cpp Normal file
View 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");
}