33 lines
818 B
C++
33 lines
818 B
C++
|
#include "cloudnoise.h"
|
||
|
#include "worleynoise.h"
|
||
|
#include "perlinnoise.h"
|
||
|
|
||
|
cloudnoise::cloudnoise(int size) : Noise(size)
|
||
|
{
|
||
|
// Some worley noises
|
||
|
WorleyNoise worleyNoise1(size, 3);
|
||
|
WorleyNoise worleyNoise3(size, 12);
|
||
|
|
||
|
// Some perlin noises
|
||
|
PerlinNoise perlinNoise1(size, 10);
|
||
|
|
||
|
// 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 worley1 = worleyNoise1.getNoise(x, y, z);
|
||
|
float worley3 = worleyNoise3.getNoise(x, y, z);
|
||
|
|
||
|
float perlin1 = perlinNoise1.getNoise(x, y, z);
|
||
|
|
||
|
float noise = worley1 * 0.6f + worley3 * 0.2f + perlin1 * 0.2;
|
||
|
|
||
|
setNoise(x, y, z, noise);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|