|
OpenSimplex2 1.0.129.5289e30
The most fast implementation of the OpenSimplex noise (2D, 3D and 4D) in C
|
#include <stdlib.h>#include <math.h>#include <stdbool.h>#include <string.h>#include "OpenSimplex2F.h"
Data Structures | |
| struct | Grad2 |
| struct | Grad3 |
| struct | Grad4 |
| struct | LatticePoint2D |
| struct | LatticePoint3D |
| struct | LatticePoint4D |
| struct | OpenSimplex2F_context |
Macros | |
| #define | PSIZE (2048) |
| K.jpg's OpenSimplex 2, faster variant. | |
| #define | PMASK (2047) |
| #define | B0000 0x00 |
| #define | B0001 0x01 |
| #define | B0010 0x02 |
| #define | B0011 0x03 |
| #define | B0100 0x04 |
| #define | B0101 0x05 |
| #define | B0110 0x06 |
| #define | B0111 0x07 |
| #define | B1000 0x08 |
| #define | B1001 0x09 |
| #define | B1010 0x0a |
| #define | B1011 0x0b |
| #define | B1100 0x0c |
| #define | B1101 0x0d |
| #define | B1110 0x0e |
| #define | B1111 0x0f |
| #define | ARRAYSIZE(x) |
Functions | |
| void | OpenSimplex2F_shutdown (void) |
| void | OpenSimplex2F_free (struct OpenSimplex2F_context *ctx) |
| int | OpenSimplex2F (int64_t seed, struct OpenSimplex2F_context **ctx) |
| double | OpenSimplex2F_noise2 (struct OpenSimplex2F_context *ctx, double x, double y) |
| 2D Simplex noise, standard lattice orientation. | |
| double | OpenSimplex2F_noise2_XBeforeY (struct OpenSimplex2F_context *ctx, double x, double y) |
| 2D Simplex noise, with Y pointing down the main diagonal. | |
| double | OpenSimplex2F_noise3_Classic (struct OpenSimplex2F_context *ctx, double x, double y, double z) |
| 3D Re-oriented 4-point BCC noise, classic orientation. | |
| double | OpenSimplex2F_noise3_XYBeforeZ (struct OpenSimplex2F_context *ctx, double x, double y, double z) |
| 3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Y). | |
| double | OpenSimplex2F_noise3_XZBeforeY (struct OpenSimplex2F_context *ctx, double x, double y, double z) |
| 3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Z). | |
| double | OpenSimplex2F_noise4_Classic (struct OpenSimplex2F_context *ctx, double x, double y, double z, double w) |
| 4D OpenSimplex2F noise, classic lattice orientation. | |
| double | OpenSimplex2F_noise4_XYBeforeZW (struct OpenSimplex2F_context *ctx, double x, double y, double z, double w) |
| 4D OpenSimplex2F noise, with XY and ZW forming orthogonal triangular-based planes. | |
| double | OpenSimplex2F_noise4_XZBeforeYW (struct OpenSimplex2F_context *ctx, double x, double y, double z, double w) |
| 4D OpenSimplex2F noise, with XZ and YW forming orthogonal triangular-based planes. | |
| double | OpenSimplex2F_noise4_XYZBeforeW (struct OpenSimplex2F_context *ctx, double x, double y, double z, double w) |
| 4D OpenSimplex2F noise, with XYZ oriented like noise3_Classic, and W for an extra degree of freedom. | |
| #define ARRAYSIZE | ( | x | ) |
| #define B0000 0x00 |
| #define B0001 0x01 |
| #define B0010 0x02 |
| #define B0011 0x03 |
| #define B0100 0x04 |
| #define B0101 0x05 |
| #define B0110 0x06 |
| #define B0111 0x07 |
| #define B1000 0x08 |
| #define B1001 0x09 |
| #define B1010 0x0a |
| #define B1011 0x0b |
| #define B1100 0x0c |
| #define B1101 0x0d |
| #define B1110 0x0e |
| #define B1111 0x0f |
| #define PMASK (2047) |
| #define PSIZE (2048) |
K.jpg's OpenSimplex 2, faster variant.
Multiple versions of each function are provided. See the documentation above each, for more info.
| int OpenSimplex2F | ( | int64_t | seed, |
| struct OpenSimplex2F_context ** | ctx ) |


| void OpenSimplex2F_free | ( | struct OpenSimplex2F_context * | ctx | ) |


| double OpenSimplex2F_noise2 | ( | struct OpenSimplex2F_context * | ctx, |
| double | x, | ||
| double | y ) |
2D Simplex noise, standard lattice orientation.


| double OpenSimplex2F_noise2_XBeforeY | ( | struct OpenSimplex2F_context * | ctx, |
| double | x, | ||
| double | y ) |
2D Simplex noise, with Y pointing down the main diagonal.
Might be better for a 2D sandbox style game, where Y is vertical. Probably slightly less optimal for heightmaps or continent maps.


| double OpenSimplex2F_noise3_Classic | ( | struct OpenSimplex2F_context * | ctx, |
| double | x, | ||
| double | y, | ||
| double | z ) |
3D Re-oriented 4-point BCC noise, classic orientation.
Proper substitute for 3D Simplex in light of Forbidden Formulae. Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.


| double OpenSimplex2F_noise3_XYBeforeZ | ( | struct OpenSimplex2F_context * | ctx, |
| double | x, | ||
| double | y, | ||
| double | z ) |
3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Y).
Recommended for 3D terrain and time-varied animations. The Z coordinate should always be the "different" coordinate in your use case. If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY. If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z). For a time varied animation, call noise3_XYBeforeZ(x, y, T).


| double OpenSimplex2F_noise3_XZBeforeY | ( | struct OpenSimplex2F_context * | ctx, |
| double | x, | ||
| double | y, | ||
| double | z ) |
3D Re-oriented 4-point BCC noise, with better visual isotropy in (X, Z).
Recommended for 3D terrain and time-varied animations. The Y coordinate should always be the "different" coordinate in your use case. If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z). If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ. For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ.


| double OpenSimplex2F_noise4_Classic | ( | struct OpenSimplex2F_context * | ctx, |
| double | x, | ||
| double | y, | ||
| double | z, | ||
| double | w ) |
4D OpenSimplex2F noise, classic lattice orientation.


| double OpenSimplex2F_noise4_XYBeforeZW | ( | struct OpenSimplex2F_context * | ctx, |
| double | x, | ||
| double | y, | ||
| double | z, | ||
| double | w ) |
4D OpenSimplex2F noise, with XY and ZW forming orthogonal triangular-based planes.
Recommended for 3D terrain, where X and Y (or Z and W) are horizontal. Recommended for noise(x, y, sin(time), cos(time)) trick.


| double OpenSimplex2F_noise4_XYZBeforeW | ( | struct OpenSimplex2F_context * | ctx, |
| double | x, | ||
| double | y, | ||
| double | z, | ||
| double | w ) |
4D OpenSimplex2F noise, with XYZ oriented like noise3_Classic, and W for an extra degree of freedom.
W repeats eventually. Recommended for time-varied animations which texture a 3D object (W=time)


| double OpenSimplex2F_noise4_XZBeforeYW | ( | struct OpenSimplex2F_context * | ctx, |
| double | x, | ||
| double | y, | ||
| double | z, | ||
| double | w ) |
4D OpenSimplex2F noise, with XZ and YW forming orthogonal triangular-based planes.
Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.


| void OpenSimplex2F_shutdown | ( | void | ) |

