@@ -79,6 +79,7 @@ _ReSharper.* | |||||
# Our binaries | # Our binaries | ||||
demos/lol.js/lol.js | demos/lol.js/lol.js | ||||
doc/samples/benchsuite | doc/samples/benchsuite | ||||
doc/samples/bluenoise | |||||
doc/samples/btphystest | doc/samples/btphystest | ||||
doc/samples/meshviewer/meshviewer | doc/samples/meshviewer/meshviewer | ||||
doc/samples/nacl_phystest | doc/samples/nacl_phystest | ||||
@@ -7,9 +7,13 @@ bench: benchsuite$(EXEEXT) | |||||
./benchsuite$(EXEEXT) | ./benchsuite$(EXEEXT) | ||||
if BUILD_SAMPLES | if BUILD_SAMPLES | ||||
noinst_PROGRAMS = benchsuite btphystest nacl_phystest simplex | noinst_PROGRAMS = bluenoise benchsuite btphystest nacl_phystest simplex | ||||
endif | endif | ||||
bluenoise_SOURCES = bluenoise.cpp | |||||
bluenoise_CPPFLAGS = $(AM_CPPFLAGS) | |||||
bluenoise_DEPENDENCIES = @LOL_DEPS@ | |||||
benchsuite_SOURCES = benchsuite.cpp \ | benchsuite_SOURCES = benchsuite.cpp \ | ||||
benchmark/vector.cpp benchmark/half.cpp benchmark/trig.cpp \ | benchmark/vector.cpp benchmark/half.cpp benchmark/trig.cpp \ | ||||
benchmark/real.cpp | benchmark/real.cpp | ||||
@@ -0,0 +1,39 @@ | |||||
// | |||||
// bluenoise — create a N×N blue noise kernel | |||||
// | |||||
// Copyright © 2016—2017 Sam Hocevar <sam@hocevar.net> | |||||
// | |||||
// This program is free software. It comes without any warranty, to | |||||
// the extent permitted by applicable law. You can redistribute it | |||||
// and/or modify it under the terms of the Do What the Fuck You Want | |||||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||||
// See http://www.wtfpl.net/ for more details. | |||||
// | |||||
#if HAVE_CONFIG_H | |||||
# include "config.h" | |||||
#endif | |||||
#include <lol/engine.h> | |||||
using namespace lol; | |||||
int main(int argc, char **argv) | |||||
{ | |||||
UNUSED(argc, argv); | |||||
ivec2 const size(64); | |||||
auto const &kernel = image::BlueNoiseKernel(size, ivec2(8)); | |||||
image im(size.xy); | |||||
array2d<vec4> &data = im.Lock2D<PixelFormat::RGBA_F32>(); | |||||
for (int j = 0; j < size.y; ++j) | |||||
for (int i = 0; i < size.x; ++i) | |||||
data[i][j] = vec4(vec3(kernel[i][j]), 1.0f); | |||||
im.Unlock2D(data); | |||||
im.Save("bluenoise.png"); | |||||
return 0; | |||||
} | |||||