Noise Modeler Library  0.1
Library for procedurally generating noise-based terrains and other content
 All Classes Files Functions Variables Enumerations Enumerator Groups Pages
glslsourcefbm.hpp
1 #ifndef GLSLSOURCEFBM_HPP
2 #define GLSLSOURCEFBM_HPP
3 
4 constexpr const char * source_fbm2d = R"lobotomized(
5 
6 //depends on snoise
7 float fbm2d(vec2 pos, float octaves, float lacunarity, float gain, float seed) {
8  float sum = 0;
9  float amplitude = 1;
10  float frequency = 1;
11  for(int i=0; i<octaves; ++i){ //TODO compare int performance vs float
12  sum += snoise(pos*frequency, seed)*amplitude;
13  amplitude *= gain;
14  frequency *= lacunarity;
15  }
16  return sum;
17 }
18 
19 )lobotomized";
20 
21 #endif // GLSLSOURCEFBM_HPP