I’ve gotten a good chunk of the Libnoise wrapper working. And despite several
sessions of head-against-wall bugs, my SIP and disutils
setup seems to be
working nicely. Some of the C++ code in noiseutils.h
(which comes with the
Libnoise examples) is quite outdated, so I wrote several of my own output
functions in pure C++. This also gave me the opportunity to write exporters to
OpenGL textures, which seem to work seamlessly with
Pyglet. I should have a whole directory of examples
up and running shortly, drawing from the standard Libnoise examples and as well
as demonstrations of OpenGL textures.
At the moment, the code to produce the image in this post looks like this:
import noisypy.modules as nmods
import noisypy.util as nutil
p = nmods.Perlin()
p.seed = 113
s = nmods.ScaleBias()
s.SetSourceModule(0, p)
s.scale = 0.5
s.bias = 0.5
c = nmods.Clamp()
c.bounds = 0, 1.0
c.SetSourceModule(0, s)
nutil.noisemap_image(512, 512, c, filename='lolnoise.pgm')
which produces identical results to analagous code written in C++. This is an
illustration of the wonderful interface that libnoise provides, and of how I
think it has translated nicely to Python. I’ve decided to call the library
noisypy
, and it should appear on GitHub in the near future.