… | |
… | |
21 | */ |
21 | */ |
22 | |
22 | |
23 | #ifndef NOISE_H_ |
23 | #ifndef NOISE_H_ |
24 | #define NOISE_H_ |
24 | #define NOISE_H_ |
25 | |
25 | |
|
|
26 | #if 0 // blitz++0.09 |
26 | #include <string.h> // possible workaround for tinyvec using memcpy without including string.h |
27 | #include <string.h> // workaround for tinyvec using memcpy without including string.h |
|
|
28 | #include <cstdlib> // workaround for tinyvec using labs without including cstdlib |
27 | #include <blitz/tinyvec.h> |
29 | #include <blitz/tinyvec.h> |
28 | #include <blitz/tinyvec-et.h> |
30 | #include <blitz/tinyvec-et.h> |
29 | |
|
|
30 | #include "global.h" |
|
|
31 | |
|
|
32 | typedef blitz::TinyVector<float,2> vec2d; |
31 | typedef blitz::TinyVector<float,2> vec2d; |
33 | typedef blitz::TinyVector<float,3> vec3d; |
32 | typedef blitz::TinyVector<float,3> vec3d; |
|
|
33 | #else |
|
|
34 | |
|
|
35 | // blitz++ 0.10 - not working |
|
|
36 | #include <blitz/array.h> |
|
|
37 | #include <blitz/tinyvec2.h> |
|
|
38 | #include <blitz/tinyvec2.cc> |
|
|
39 | |
|
|
40 | template<typename T, int length> |
|
|
41 | struct vecnd |
|
|
42 | : blitz::TinyVector<T, length> |
|
|
43 | { |
|
|
44 | static const int numElements = length; |
|
|
45 | using blitz::TinyVector<T, length>::TinyVector; |
|
|
46 | }; |
|
|
47 | |
|
|
48 | typedef vecnd<float,2> vec2d; |
|
|
49 | typedef vecnd<float,3> vec3d; |
|
|
50 | |
|
|
51 | #endif |
|
|
52 | |
|
|
53 | #include "global.h" |
34 | |
54 | |
35 | vec2d |
55 | vec2d |
36 | inline floor (vec2d v) |
56 | inline floor (vec2d v) |
37 | { |
57 | { |
38 | return vec2d (fastfloor (v[0]), fastfloor (v[1])); |
58 | return vec2d (fastfloor (v[0]), fastfloor (v[1])); |
… | |
… | |
219 | |
239 | |
220 | frac_gen (int octaves = 3, value_t lacunarity = 2, value_t hurst_expo = .5, uint32_t seed = 0); |
240 | frac_gen (int octaves = 3, value_t lacunarity = 2, value_t hurst_expo = .5, uint32_t seed = 0); |
221 | |
241 | |
222 | value_t noise (vec_t P, uint32_t seed = 0) func_pure |
242 | value_t noise (vec_t P, uint32_t seed = 0) func_pure |
223 | { |
243 | { |
224 | return operator() (P, seed); |
244 | return this->operator() (P, seed); |
225 | } |
245 | } |
226 | |
246 | |
227 | value_t fBm (vec_t P) func_pure; |
247 | value_t fBm (vec_t P) func_pure; |
228 | value_t turbulence (vec_t P) func_pure; |
248 | value_t turbulence (vec_t P) func_pure; |
229 | value_t multifractal (vec_t P, value_t offset = 1) func_pure; |
249 | value_t multifractal (vec_t P, value_t offset = 1) func_pure; |