Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
|
#include <OpenSimplex2S.hpp>
Classes | |
struct | Grad2 |
struct | Grad3 |
struct | Grad4 |
struct | Initializer |
struct | LatticePoint2D |
struct | LatticePoint3D |
struct | LatticePoint4D |
Public Member Functions | |
OpenSimplex2S (long seed=0) | |
double | noise2 (double x, double y) |
double | noise2_XBeforeY (double x, double y) |
double | noise3_Classic (double x, double y, double z) |
double | noise3_XYBeforeZ (double x, double y, double z) |
double | noise3_XZBeforeY (double x, double y, double z) |
double | noise4_Classic (double x, double y, double z, double w) |
double | noise4_XYBeforeZW (double x, double y, double z, double w) |
double | noise4_XZBeforeYW (double x, double y, double z, double w) |
double | noise4_XYZBeforeW (double x, double y, double z, double w) |
Private Member Functions | |
double | noise2_Base (double xs, double ys) |
double | noise3_BCC (double xr, double yr, double zr) |
double | noise4_Base (double xs, double ys, double zs, double ws) |
Static Private Member Functions | |
static int | fastFloor (double x) |
static void | initLatticePoints () |
static void | initGradients () |
Private Attributes | |
short | perm [PSIZE] |
Grad2 | permGrad2 [PSIZE] |
Grad3 | permGrad3 [PSIZE] |
Grad4 | permGrad4 [PSIZE] |
Static Private Attributes | |
static const int | PSIZE = 2048 |
static const int | PMASK = 2047 |
static constexpr const double | N2 = 0.05481866495625118 |
static constexpr const double | N3 = 0.2781926117527186 |
static constexpr const double | N4 = 0.11127401889945551 |
static Grad2 | GRADIENTS_2D [PSIZE] {} |
static Grad3 | GRADIENTS_3D [PSIZE] {} |
static Grad4 | GRADIENTS_4D [PSIZE] {} |
static LatticePoint2D | LOOKUP_2D [8 *4] {} |
static LatticePoint3D | LOOKUP_3D [8] {} |
static LatticePoint4D | LOOKUP_4D [256][20] {} |
static unsigned char | LOOKUP_4D_SIZE [256] {} |
static Initializer | initializer {} |
Ported from https://github.com/KdotJPG/OpenSimplex2/blob/master/java/OpenSimplex2S.java Probably not best implementation of static initialization. Also changed some code to use fixed c-style arrays, to avoid using of std library.
K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
Multiple versions of each function are provided. See the documentation above each, for more info.
Definition at line 30 of file OpenSimplex2S.hpp.
|
explicit |
Definition at line 40 of file OpenSimplex2S.cpp.
|
staticprivate |
Definition at line 367 of file OpenSimplex2S.cpp.
|
staticprivate |
Definition at line 827 of file OpenSimplex2S.cpp.
|
staticprivate |
Definition at line 411 of file OpenSimplex2S.cpp.
2D SuperSimplex noise, standard lattice orientation.
Definition at line 63 of file OpenSimplex2S.cpp.
References noise2_Base().
2D SuperSimplex noise base. Lookup table implementation inspired by DigitalShadow.
Definition at line 91 of file OpenSimplex2S.cpp.
Referenced by noise2(), and noise2_XBeforeY().
2D SuperSimplex 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.
Definition at line 78 of file OpenSimplex2S.cpp.
References noise2_Base().
Generate overlapping cubic lattices for 3D Re-oriented BCC noise. Lookup table implementation inspired by DigitalShadow. It was actually faster to narrow down the points in the loop itself, than to build up the index with enough info to isolate 8 points.
Definition at line 205 of file OpenSimplex2S.cpp.
Referenced by noise3_Classic(), noise3_XYBeforeZ(), and noise3_XZBeforeY().
3D Re-oriented 8-point BCC noise, classic orientation Proper substitute for what 3D SuperSimplex would be, in light of Forbidden Formulae. Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.
Definition at line 139 of file OpenSimplex2S.cpp.
References noise3_BCC().
3D Re-oriented 8-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).
Definition at line 161 of file OpenSimplex2S.cpp.
References noise3_BCC().
3D Re-oriented 8-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.
Definition at line 184 of file OpenSimplex2S.cpp.
References noise3_BCC().
4D SuperSimplex noise base. Using ultra-simple 4x4x4x4 lookup partitioning. This isn't as elegant or SIMD/GPU/etc. portable as other approaches, but it does compete performance-wise with optimized OpenSimplex1.
Definition at line 319 of file OpenSimplex2S.cpp.
Referenced by noise4_Classic(), noise4_XYBeforeZW(), noise4_XYZBeforeW(), and noise4_XZBeforeYW().
4D SuperSimplex noise, classic lattice orientation.
Definition at line 250 of file OpenSimplex2S.cpp.
References noise4_Base().
4D SuperSimplex 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.
Definition at line 267 of file OpenSimplex2S.cpp.
References noise4_Base().
4D SuperSimplex noise, with XYZ oriented like noise3_Classic, and W for an extra degree of freedom. Recommended for time-varied animations which texture a 3D object (W=time)
Definition at line 300 of file OpenSimplex2S.cpp.
References noise4_Base().
4D SuperSimplex noise, with XZ and YW forming orthogonal triangular-based planes. Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.
Definition at line 283 of file OpenSimplex2S.cpp.
References noise4_Base().
|
staticprivate |
K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
Multiple versions of each function are provided. See the documentation above each, for more info.
Definition at line 23 of file OpenSimplex2S.hpp.
|
staticprivate |
Definition at line 24 of file OpenSimplex2S.hpp.
|
staticprivate |
Definition at line 25 of file OpenSimplex2S.hpp.
|
staticprivate |
Definition at line 38 of file OpenSimplex2S.hpp.
|
staticprivate |
Definition at line 27 of file OpenSimplex2S.hpp.
|
staticprivate |
Definition at line 28 of file OpenSimplex2S.hpp.
|
staticprivate |
Definition at line 29 of file OpenSimplex2S.hpp.
|
staticprivate |
Definition at line 30 of file OpenSimplex2S.hpp.
|
staticconstexprprivate |
Definition at line 96 of file OpenSimplex2S.hpp.
|
staticconstexprprivate |
Definition at line 97 of file OpenSimplex2S.hpp.
|
staticconstexprprivate |
Definition at line 98 of file OpenSimplex2S.hpp.
|
private |
Definition at line 109 of file OpenSimplex2S.hpp.
|
private |
Definition at line 110 of file OpenSimplex2S.hpp.
|
private |
Definition at line 111 of file OpenSimplex2S.hpp.
|
private |
Definition at line 112 of file OpenSimplex2S.hpp.
|
staticprivate |
Definition at line 94 of file OpenSimplex2S.hpp.
|
staticprivate |
Definition at line 93 of file OpenSimplex2S.hpp.