OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
| 3 * |
| 4 * This program is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU General Public License |
| 6 * as published by the Free Software Foundation; either version 2 |
| 7 * of the License, or (at your option) any later version. |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software Foundation, |
| 16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 * |
| 18 * The Original Code is Copyright (C) 2010 Blender Foundation. |
| 19 * All rights reserved. |
| 20 * |
| 21 * The Original Code is: all of this file. |
| 22 * |
| 23 * Contributor(s): none yet. |
| 24 * |
| 25 * ***** END GPL LICENSE BLOCK ***** |
| 26 */ |
| 27 |
| 28 #ifndef __NOISE_H__ |
| 29 #define __NOISE_H__ |
| 30 |
| 31 /** \file blender/freestyle/intern/geometry/Noise.h |
| 32 * \ingroup freestyle |
| 33 * \brief Class to define Perlin noise |
| 34 * \author Emmanuel Turquin |
| 35 * \date 12/01/2004 |
| 36 */ |
| 37 |
| 38 #include "Geom.h" |
| 39 |
| 40 #include "../system/FreestyleConfig.h" |
| 41 |
| 42 #define _NOISE_B 0x100 |
| 43 |
| 44 using namespace Geometry; |
| 45 using namespace std; |
| 46 |
| 47 /*! Class to provide Perlin Noise functionalities */ |
| 48 class LIB_GEOMETRY_EXPORT Noise |
| 49 { |
| 50 public: |
| 51 /*! Builds a Noise object */ |
| 52 Noise(long seed = -1); |
| 53 |
| 54 /*! Destructor */ |
| 55 ~Noise() {} |
| 56 |
| 57 /*! Returns a noise value for a 1D element */ |
| 58 float turbulence1(float arg, float freq, float amp, unsigned oct = 4); |
| 59 |
| 60 /*! Returns a noise value for a 2D element */ |
| 61 float turbulence2(Vec2f& v, float freq, float amp, unsigned oct = 4); |
| 62 |
| 63 /*! Returns a noise value for a 3D element */ |
| 64 float turbulence3(Vec3f& v, float freq, float amp, unsigned oct = 4); |
| 65 |
| 66 /*! Returns a smooth noise value for a 1D element */ |
| 67 float smoothNoise1(float arg); |
| 68 |
| 69 /*! Returns a smooth noise value for a 2D element */ |
| 70 float smoothNoise2(Vec2f& vec); |
| 71 |
| 72 /*! Returns a smooth noise value for a 3D element */ |
| 73 float smoothNoise3(Vec3f& vec); |
| 74 |
| 75 private: |
| 76 int p[_NOISE_B + _NOISE_B + 2]; |
| 77 float g3[_NOISE_B + _NOISE_B + 2][3]; |
| 78 float g2[_NOISE_B + _NOISE_B + 2][2]; |
| 79 float g1[_NOISE_B + _NOISE_B + 2]; |
| 80 int start; |
| 81 }; |
| 82 |
| 83 #endif // __NOISE_H__ |
OLD | NEW |