Changeset View
Changeset View
Standalone View
Standalone View
plugins/generators/simplexnoise/c-open-simplex/open-simplex-noise.h
- This file was added.
1 | #ifndef OPEN_SIMPLEX_NOISE_H__ | ||||
---|---|---|---|---|---|
2 | #define OPEN_SIMPLEX_NOISE_H__ | ||||
3 | | ||||
4 | /* | ||||
5 | * OpenSimplex (Simplectic) Noise in C. | ||||
6 | * Ported to C from Kurt Spencer's java implementation by Stephen M. Cameron | ||||
7 | * | ||||
8 | * v1.1 (October 6, 2014) | ||||
9 | * - Ported to C | ||||
10 | * | ||||
11 | * v1.1 (October 5, 2014) | ||||
12 | * - Added 2D and 4D implementations. | ||||
13 | * - Proper gradient sets for all dimensions, from a | ||||
14 | * dimensionally-generalizable scheme with an actual | ||||
15 | * rhyme and reason behind it. | ||||
16 | * - Removed default permutation array in favor of | ||||
17 | * default seed. | ||||
18 | * - Changed seed-based constructor to be independent | ||||
19 | * of any particular randomization library, so results | ||||
20 | * will be the same when ported to other languages. | ||||
21 | */ | ||||
22 | | ||||
23 | #if ((__GNUC_STDC_INLINE__) || (__STDC_VERSION__ >= 199901L)) | ||||
24 | #include <stdint.h> | ||||
25 | #define INLINE inline | ||||
26 | #elif (defined (_MSC_VER) || defined (__GNUC_GNU_INLINE__)) | ||||
27 | #include <stdint.h> | ||||
28 | #define INLINE __inline | ||||
29 | #else | ||||
30 | /* ANSI C doesn't have inline or stdint.h. */ | ||||
31 | #define INLINE | ||||
32 | #endif | ||||
33 | | ||||
34 | #ifdef __cplusplus | ||||
35 | extern "C" { | ||||
36 | #endif | ||||
37 | | ||||
38 | struct osn_context; | ||||
39 | | ||||
40 | int open_simplex_noise(int64_t seed, struct osn_context **ctx); | ||||
41 | void open_simplex_noise_free(struct osn_context *ctx); | ||||
42 | int open_simplex_noise_init_perm(struct osn_context *ctx, int16_t p[], int nelements); | ||||
43 | double open_simplex_noise2(struct osn_context *ctx, double x, double y); | ||||
44 | double open_simplex_noise3(struct osn_context *ctx, double x, double y, double z); | ||||
45 | double open_simplex_noise4(struct osn_context *ctx, double x, double y, double z, double w); | ||||
46 | | ||||
47 | #ifdef __cplusplus | ||||
48 | } | ||||
49 | #endif | ||||
50 | | ||||
51 | #endif |