Original Post
Hey guys, I'm working on a map generator using libnoise. The generator works for maps that are 2000x2000 or smaller in pixels, but it won't go higher. I need my maps to be around 100000x100000, and it simply will throw the error "out of memory" after about 20 seconds of generating.
Here is my generator class:
[source lang="cpp"]class Generator
{
private:
void generateNoiseImg();
int mapH;
int mapW;
public:
Generator();
void Generate();
};[/source]
[source lang="cpp"]Generator::Generator()
{
// Tested at 2000x2000
mapH = 500;
mapW = 500;
}
void Generator::Generate()
{
generateNoiseImg();
}
void Generator::generateNoiseImg()
{
module::Perlin noise;
noise.SetFrequency(1.0);
noise.SetPersistence(.4);
noise.SetOctaveCount(2);
srand(time(NULL));
int seed = rand();
noise.SetSeed(seed);
utils::NoiseMap heightMap;
utils::NoiseMapBuilderPlane heightMapBuilder;
heightMapBuilder.SetSourceModule (noise);
heightMapBuilder.SetDestNoiseMap (heightMap);
heightMapBuilder.SetDestSize (mapW, mapH); // Must be divisible by 25
heightMapBuilder.SetBounds (6.0, 10.0, 1.0, 5.0);
heightMapBuilder.Build ();
utils::RendererImage renderer;
utils::Image image;
renderer.SetSourceNoiseMap (heightMap);
renderer.SetDestImage (image);
renderer.Render ();
utils::WriterBMP writer;
writer.SetSourceImage (image);
writer.SetDestFilename ("rsc/noise.bmp");
writer.WriteDestFile ();
}[/source]
Is 2000x2000 a limitation of libnoise's .SetDestSize(w, h)? How have you guys overcome this for huge maps? It looks like the example planetary map in the libnoise tutorial makes a map that's gigantic (5000?) and way over 2000.
Here is my generator class:
[source lang="cpp"]class Generator
{
private:
void generateNoiseImg();
int mapH;
int mapW;
public:
Generator();
void Generate();
};[/source]
[source lang="cpp"]Generator::Generator()
{
// Tested at 2000x2000
mapH = 500;
mapW = 500;
}
void Generator::Generate()
{
generateNoiseImg();
}
void Generator::generateNoiseImg()
{
module::Perlin noise;
noise.SetFrequency(1.0);
noise.SetPersistence(.4);
noise.SetOctaveCount(2);
srand(time(NULL));
int seed = rand();
noise.SetSeed(seed);
utils::NoiseMap heightMap;
utils::NoiseMapBuilderPlane heightMapBuilder;
heightMapBuilder.SetSourceModule (noise);
heightMapBuilder.SetDestNoiseMap (heightMap);
heightMapBuilder.SetDestSize (mapW, mapH); // Must be divisible by 25
heightMapBuilder.SetBounds (6.0, 10.0, 1.0, 5.0);
heightMapBuilder.Build ();
utils::RendererImage renderer;
utils::Image image;
renderer.SetSourceNoiseMap (heightMap);
renderer.SetDestImage (image);
renderer.Render ();
utils::WriterBMP writer;
writer.SetSourceImage (image);
writer.SetDestFilename ("rsc/noise.bmp");
writer.WriteDestFile ();
}[/source]
Is 2000x2000 a limitation of libnoise's .SetDestSize(w, h)? How have you guys overcome this for huge maps? It looks like the example planetary map in the libnoise tutorial makes a map that's gigantic (5000?) and way over 2000.