Krita Source Code Documentation
Loading...
Searching...
No Matches
open-simplex-noise.h
Go to the documentation of this file.
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 (defined (__STDC_VERSION__) || defined (__GNUC_STDC_INLINE__))
24 #if ((__GNUC_STDC_INLINE__) || (__STDC_VERSION__ >= 199901L))
25 #include <stdint.h>
26 #define INLINE inline
27 #endif
28#elif (defined (_MSC_VER) || defined (__GNUC_GNU_INLINE__))
29 #include <stdint.h>
30 #define INLINE __inline
31#else
32 /* ANSI C doesn't have inline or stdint.h. */
33 #define INLINE
34#endif
35
36#ifdef __cplusplus
37 extern "C" {
38#endif
39
40struct osn_context;
41
42int open_simplex_noise(int64_t seed, struct osn_context **ctx);
43void open_simplex_noise_free(struct osn_context *ctx);
44int open_simplex_noise_init_perm(struct osn_context *ctx, int16_t p[], int nelements);
45double open_simplex_noise2(struct osn_context *ctx, double x, double y);
46double open_simplex_noise3(struct osn_context *ctx, double x, double y, double z);
47double open_simplex_noise4(struct osn_context *ctx, double x, double y, double z, double w);
48
49#ifdef __cplusplus
50 }
51#endif
52
53#endif
const Params2D p
int open_simplex_noise(int64_t seed, struct osn_context **ctx)
void open_simplex_noise_free(struct osn_context *ctx)
double open_simplex_noise2(struct osn_context *ctx, double x, double y)
int open_simplex_noise_init_perm(struct osn_context *ctx, int16_t p[], int nelements)
double open_simplex_noise3(struct osn_context *ctx, double x, double y, double z)
double open_simplex_noise4(struct osn_context *ctx, double x, double y, double z, double w)