#include "cloudnoise.h" #include "worleynoise.h" #include "perlinnoise.h" CloudNoise::CloudNoise(int size) : Noise(size) { int minSize = std::min(32, size); // Some worley noises WorleyNoise worleyNoise1(minSize, 3); WorleyNoise worleyNoise3(size, 15); // Some perlin noises PerlinNoise perlinNoise1(minSize, 3); PerlinNoise perlinNoise2(size, 15); // Generate the noise for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { for (int z = 0; z < size; z++) { float sx = x / (float) size; float sy = y / (float) size; float sz = z / (float) size; float worley1 = worleyNoise1.getNoise(sx, sy, sz); float worley3 = worleyNoise3.getNoise(sx, sy, sz); float perlin1 = perlinNoise1.getNoise(sx, sy, sz); float perlin2 = perlinNoise2.getNoise(sx, sy, sz); float noise = worley1 * 0.4f + worley3 * 0.12f + perlin1 * 0.36f + perlin2 * 0.12; setNoise(x, y, z, noise); } } } }