Retain image when zooming in

I have a small generator, that generates terrain using perlin noise. Now id like to zoom in to a area to see it closer, so i need to calculate it with even more detail. But when i zoom in the image changes. How can i raise the zoom factor whit out changing the image itself.

Here is the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
double* MapGenerator::generate(){
	PerlinNoise gen(100);
	PerlinNoise mgen(500);
	int factor = 1;
	int octaves = 8;
	double p = 0.5;
	double zoom = 75*factor;
	double moctaves = 6;
	double mp = 0.50;
	double mzoom = 100*factor;
	double emax = 0;
	double emin = 10;
	double mmax = 0;
	double mmin = 10;
	for (int y = 0; y < size; y++)
	{
		for (int x = 0; x < size; x++)
		{
			double enoise = 0;
			double mnoise = 0;
			for (int a = 0; a < octaves - 1; a++)
			{
				double frequency = pow(2.0, a);
				double amplitude = pow(p, a);
				double mamplitude = pow(p, a);
				enoise +=  gen.noise(((double)x)*frequency / zoom, ((double)y) / zoom*frequency)*amplitude;
				if (a < moctaves){
					mnoise += mgen.noise(((double)x)*frequency / mzoom, ((double)y) / mzoom*frequency)*mamplitude;
					if (mnoise > mmax) mmax = mnoise;
					if (mnoise < mmin) mmin = mnoise;
				}
				if (enoise > emax) emax = enoise;
				if (enoise < emin) emin = enoise;
			}
			map[x + y*size] = enoise;
			moisture[x + y*size] = mnoise;
		}
	}
	double dif = emax - emin;
	double mdif = mmax - mmin;
	for (int i = 0; i < size*size; i++){
		map[i] = pow((map[i] - emin) / dif, 3.2);
		moisture[i] = pow((moisture[i] - mmin) / dif,1.9);
	}
	return map;
}
Last edited on
Topic archived. No new replies allowed.