ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/noise.h
(Generate patch)

Comparing deliantra/server/include/noise.h (file contents):
Revision 1.20 by root, Wed Nov 16 23:42:00 2016 UTC vs.
Revision 1.22 by root, Sat Nov 17 23:40:01 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * 6 *
6 * Deliantra is free software: you can redistribute it and/or modify it under 7 * Deliantra is free software: you can redistribute it and/or modify it under
7 * the terms of the Affero GNU General Public License as published by the 8 * the terms of the Affero GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your 9 * Free Software Foundation, either version 3 of the License, or (at your
173{ 174{
174 T pmap[N]; 175 T pmap[N];
175 176
176 void seed (seedable_rand_gen &rng); 177 void seed (seedable_rand_gen &rng);
177 178
178 T operator ()(T v) func_pure 179 ecb_pure T operator ()(T v)
179 { 180 {
180 return pmap[v & T(N - 1)]; 181 return pmap[v & T(N - 1)];
181 } 182 }
182}; 183};
183 184
191 typedef typename vec_t::T_numtype value_t; 192 typedef typename vec_t::T_numtype value_t;
192 193
193 void seed (seedable_rand_gen &rng); 194 void seed (seedable_rand_gen &rng);
194 void seed (seed_t seed); 195 void seed (seed_t seed);
195 196
196 value_t operator ()(vec_t P, uint32_t seed = 0) func_pure; 197 ecb_pure value_t operator ()(vec_t P, uint32_t seed = 0);
197}; 198};
198 199
199template<class vec_t> 200template<class vec_t>
200struct noise_gen; 201struct noise_gen;
201 202
214 static vec3d::T_numtype abs_avg() { return 0.415; } // avg(abs(noise)) 215 static vec3d::T_numtype abs_avg() { return 0.415; } // avg(abs(noise))
215 216
216 using noise_gen_base<vec3d>::operator (); 217 using noise_gen_base<vec3d>::operator ();
217 218
218 // noise projected on a surface with normal n 219 // noise projected on a surface with normal n
219 vec2d::T_numtype operator() (vec3d P, vec3d N, uint32_t seed = 0) func_pure; 220 ecb_pure vec2d::T_numtype operator() (vec3d P, vec3d N, uint32_t seed = 0);
220}; 221};
221 222
222typedef noise_gen<vec2d> noise2d; 223typedef noise_gen<vec2d> noise2d;
223typedef noise_gen<vec3d> noise3d; 224typedef noise_gen<vec3d> noise3d;
224 225
237 value_t fbm_mul[MAX_OCTAVES]; 238 value_t fbm_mul[MAX_OCTAVES];
238 rotate_xy<vec_t> rot[MAX_OCTAVES]; 239 rotate_xy<vec_t> rot[MAX_OCTAVES];
239 240
240 frac_gen (int octaves = 3, value_t lacunarity = 2, value_t hurst_expo = .5, uint32_t seed = 0); 241 frac_gen (int octaves = 3, value_t lacunarity = 2, value_t hurst_expo = .5, uint32_t seed = 0);
241 242
242 value_t noise (vec_t P, uint32_t seed = 0) func_pure 243 ecb_pure value_t noise (vec_t P, uint32_t seed = 0)
243 { 244 {
244 return this->operator() (P, seed); 245 return this->operator() (P, seed);
245 } 246 }
246 247
247 value_t fBm (vec_t P) func_pure; 248 ecb_pure value_t fBm (vec_t P);
248 value_t turbulence (vec_t P) func_pure; 249 ecb_pure value_t turbulence (vec_t P);
249 value_t multifractal (vec_t P, value_t offset = 1) func_pure; 250 ecb_pure value_t multifractal (vec_t P, value_t offset = 1);
250 value_t heterofractal (vec_t P, value_t offset = 1) func_pure; 251 ecb_pure value_t heterofractal (vec_t P, value_t offset = 1);
251 value_t hybridfractal (vec_t P, value_t offset = 1, value_t gain = 1) func_pure; 252 ecb_pure value_t hybridfractal (vec_t P, value_t offset = 1, value_t gain = 1);
252 value_t ridgedmultifractal (vec_t P, value_t offset = 1, value_t gain = 8) func_pure; 253 ecb_pure value_t ridgedmultifractal (vec_t P, value_t offset = 1, value_t gain = 8);
253 value_t billowfractal (vec_t P, value_t offset = 1, value_t gain = 2) func_pure; 254 ecb_pure value_t billowfractal (vec_t P, value_t offset = 1, value_t gain = 2);
254 value_t terrain (vec_t P) func_pure; 255 ecb_pure value_t terrain (vec_t P);
255 value_t terrain2 (vec_t P) func_pure; 256 ecb_pure value_t terrain2 (vec_t P);
256}; 257};
257 258
258typedef frac_gen<vec2d> frac2d; 259typedef frac_gen<vec2d> frac2d;
259typedef frac_gen<vec3d> frac3d; 260typedef frac_gen<vec3d> frac3d;
260 261

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines