1 module open_simplex_2.open_simplex_2; 2 3 /** 4 * Interface defining methods common to OpenSimplex2 implementations. 5 */ 6 interface OpenSimplex2 { 7 /** 8 * 2D OpenSimplex2 noise, standard lattice orientation. 9 */ 10 double noise2(double x, double y); 11 12 /** 13 * 2D OpenSimplex2 noise, with Y pointing down the main diagonal. 14 * Might be better for a 2D sandbox style game, where Y is vertical. 15 * Probably slightly less optimal for heightmaps or continent maps. 16 */ 17 double noise2_XBeforeY(double x, double y); 18 19 /** 20 * 3D OpenSimplex2 noise, classic orientation. 21 * Proper substitute for 3D Simplex in light of Forbidden Formulae. 22 * Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate. 23 */ 24 double noise3_Classic(double x, double y, double z); 25 26 /** 27 * 3D OpenSimplex2 noise, with better visual isotropy in (X, Y). 28 * Recommended for 3D terrain and time-varied animations. 29 * The Z coordinate should always be the "different" coordinate in your use case. 30 * If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY. 31 * If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z). 32 * For a time varied animation, call noise3_XYBeforeZ(x, y, T). 33 */ 34 double noise3_XYBeforeZ(double x, double y, double z); 35 36 /** 37 * 3D OpenSimplex2 noise, with better visual isotropy in (X, Z). 38 * Recommended for 3D terrain and time-varied animations. 39 * The Y coordinate should always be the "different" coordinate in your use case. 40 * If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z). 41 * If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ. 42 * For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ. 43 */ 44 double noise3_XZBeforeY(double x, double y, double z); 45 46 /** 47 * 4D OpenSimplex2 noise, classic lattice orientation. 48 */ 49 double noise4_Classic(double x, double y, double z, double w); 50 51 /** 52 * 4D OpenSimplex2 noise, with XY and ZW forming orthogonal triangular-based planes. 53 * Recommended for 3D terrain, where X and Y (or Z and W) are horizontal. 54 * Recommended for noise(x, y, sin(time), cos(time)) trick. 55 */ 56 double noise4_XYBeforeZW(double x, double y, double z, double w); 57 58 /** 59 * 4D OpenSimplex2 noise, with XZ and YW forming orthogonal triangular-based planes. 60 * Recommended for 3D terrain, where X and Z (or Y and W) are horizontal. 61 */ 62 double noise4_XZBeforeYW(double x, double y, double z, double w); 63 64 /** 65 * 4D OpenSimplex2 noise, with XYZ oriented like noise3_Classic, 66 * and W for an extra degree of freedom. W repeats eventually. 67 * Recommended for time-varied animations which texture a 3D object (W=time) 68 */ 69 double noise4_XYZBeforeW(double x, double y, double z, double w); 70 }