Adventures in libnoise!

PhycoFalcon

29-05-2008 06:05:02

I'm experimenting with ogre.addons.noise, and libnoise makes an image object that PIL cannot read.

So, I figured out that I can write an image to the disk by using the following:
writer = noise.WriterBMP ()
writer.SetSourceImage (image)
writer.SetDestFilename ("blaat.bmp")
writer.WriteDestFile ()

However, that writes it to the disk, which isn't cool, because it should stay in memory, like any proper object.

I noticed that Demo_Noise_01.py (available from SVN) uses this icky for loop that copies the image buffer to a texture. I'm not going to sample a million points on a 1024x1024px texture using Python!!!

I tried using pickle to dump it into something that PIL's fromstring function could read, but that didn't work.

So, then I tried to use mmap, which didn't work, because mmap.mmap does not match the C++ signature for SetDestFileName.

I'm thinking that the only way to really do this is to re-write the libnoise wrapper, but I'm not sure how that can be done... Any thoughts?

PS-- I also noticed this in the readme:
- Replace NoiseUtils Image class, etc with Ogre::Image
That might do. I'll have to look into how this could be done.