| 1 | // SimplexNoise1234 |
| 2 | // Copyright � 2003-2011, Stefan Gustavson |
| 3 | // |
| 4 | // Contact: stegu@itn.liu.se |
| 5 | // |
| 6 | // This library is public domain software, released by the author |
| 7 | // into the public domain in February 2011. You may do anything |
| 8 | // you like with it. You may even remove all attributions, |
| 9 | // but of course I'd appreciate it if you kept my name somewhere. |
| 10 | // |
| 11 | // This library is distributed in the hope that it will be useful, |
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | // General Public License for more details. |
| 15 | |
| 16 | // Modified by the LOVE Development Team to remove 3D and 4D implementations due |
| 17 | // to patent issues. |
| 18 | |
| 19 | /** \file |
| 20 | \brief Declares the SimplexNoise1234 class for producing Perlin simplex noise. |
| 21 | \author Stefan Gustavson (stegu@itn.liu.se) |
| 22 | */ |
| 23 | |
| 24 | /* |
| 25 | * This is a clean, fast, modern and free Perlin Simplex noise class in C++. |
| 26 | * Being a stand-alone class with no external dependencies, it is |
| 27 | * highly reusable without source code modifications. |
| 28 | * |
| 29 | * |
| 30 | * Note: |
| 31 | * Replacing the "float" type with "double" can actually make this run faster |
| 32 | * on some platforms. A templatized version of SimplexNoise1234 could be useful. |
| 33 | */ |
| 34 | |
| 35 | class SimplexNoise1234 { |
| 36 | |
| 37 | public: |
| 38 | SimplexNoise1234() {} |
| 39 | ~SimplexNoise1234() {} |
| 40 | |
| 41 | /** 1D and 2D float Perlin noise |
| 42 | */ |
| 43 | static float noise( float x ); |
| 44 | static float noise( float x, float y ); |
| 45 | |
| 46 | private: |
| 47 | static unsigned char perm[]; |
| 48 | static float grad( int hash, float x ); |
| 49 | static float grad( int hash, float x, float y ); |
| 50 | |
| 51 | }; |
| 52 | |