888
|
1 /*
|
|
2 * DMLib
|
|
3 * -- Perlin noise functionality
|
|
4 * Programmed and designed by Matti 'ccr' Hamalainen
|
|
5 * (C) Copyright 2012 Tecnic Software productions (TNSP)
|
|
6 */
|
|
7 #ifndef DMPERLIN_H
|
|
8 #define DMPERLIN_H
|
|
9
|
|
10 #include "dmlib.h"
|
|
11
|
|
12 #ifdef __cplusplus
|
|
13 extern "C" {
|
|
14 #endif
|
|
15
|
|
16
|
|
17 #define DM_PLNS_B (0x100)
|
|
18 #define DM_PLNS_BM (0x0ff)
|
|
19 #define DM_PLNS_N (0x1000)
|
|
20
|
|
21 typedef struct
|
|
22 {
|
|
23 int p[DM_PLNS_B + DM_PLNS_B + 2];
|
|
24 DMFloat g2[DM_PLNS_B + DM_PLNS_B + 2][2];
|
|
25 DMFloat g1[DM_PLNS_B + DM_PLNS_B + 2];
|
|
26 } DMPerlinContext;
|
|
27
|
|
28
|
|
29 int dmPerlinInit(DMPerlinContext *ctx, const int seed);
|
|
30 DMFloat dmPerlinNoise2D(const DMPerlinContext *ctx, DMFloat x, DMFloat y, DMFloat alpha, DMFloat beta, int n);
|
|
31
|
|
32
|
|
33 #ifdef __cplusplus
|
|
34 }
|
|
35 #endif
|
|
36
|
|
37 #endif // DMPERLIN_H
|