diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-12-22 22:25:01 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-12-22 22:25:01 +0400 |
commit | fa0211df269a3398dd70467982f9e129c79e501b (patch) | |
tree | 404ee267890602b49470cb640986b50d2c2055c1 /source/blender/freestyle/intern/geometry/Noise.h | |
parent | 8b57a67f3eb57366c2b3abcb8f3b04403d339e1a (diff) |
Another "insanely" big code clean-up patch by Bastien Montagne, many thanks!
Diffstat (limited to 'source/blender/freestyle/intern/geometry/Noise.h')
-rw-r--r-- | source/blender/freestyle/intern/geometry/Noise.h | 128 |
1 files changed, 67 insertions, 61 deletions
diff --git a/source/blender/freestyle/intern/geometry/Noise.h b/source/blender/freestyle/intern/geometry/Noise.h index f92cf07e914..35d1af3712f 100644 --- a/source/blender/freestyle/intern/geometry/Noise.h +++ b/source/blender/freestyle/intern/geometry/Noise.h @@ -1,40 +1,45 @@ -// -// Filename : Noise.h -// Author(s) : Emmanuel Turquin -// Purpose : Class to define Perlin noise -// Date of creation : 12/01/2004 -// -/////////////////////////////////////////////////////////////////////////////// - - -// -// Copyright (C) : Please refer to the COPYRIGHT file distributed -// with this source distribution. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef NOISE_H -# define NOISE_H - - -# include "../system/FreestyleConfig.h" -# include "Geom.h" - -#define _Noise_B_ 0x100 +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2010 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __NOISE_H__ +#define __NOISE_H__ + +/** \file blender/freestyle/intern/geometry/Noise.h + * \ingroup freestyle + * \brief Class to define Perlin noise + * \author Emmanuel Turquin + * \date 12/01/2004 + */ + +#include "Geom.h" + +#include "../system/FreestyleConfig.h" + +#define _NOISE_B 0x100 using namespace Geometry; using namespace std; @@ -42,36 +47,37 @@ using namespace std; /*! Class to provide Perlin Noise functionalities */ class LIB_GEOMETRY_EXPORT Noise { - public: +public: + /*! Builds a Noise object */ + Noise(long seed = -1); - /*! Builds a Noise object */ - Noise(long seed = -1); - /*! Destructor */ - ~Noise() {} + /*! Destructor */ + ~Noise() {} - /*! Returns a noise value for a 1D element */ - float turbulence1(float arg, float freq, float amp, unsigned oct = 4); + /*! Returns a noise value for a 1D element */ + float turbulence1(float arg, float freq, float amp, unsigned oct = 4); - /*! Returns a noise value for a 2D element */ - float turbulence2(Vec2f& v, float freq, float amp, unsigned oct = 4); + /*! Returns a noise value for a 2D element */ + float turbulence2(Vec2f& v, float freq, float amp, unsigned oct = 4); - /*! Returns a noise value for a 3D element */ - float turbulence3(Vec3f& v, float freq, float amp, unsigned oct = 4); + /*! Returns a noise value for a 3D element */ + float turbulence3(Vec3f& v, float freq, float amp, unsigned oct = 4); - /*! Returns a smooth noise value for a 1D element */ - float smoothNoise1(float arg); - /*! Returns a smooth noise value for a 2D element */ - float smoothNoise2(Vec2f& vec); - /*! Returns a smooth noise value for a 3D element */ - float smoothNoise3(Vec3f& vec); + /*! Returns a smooth noise value for a 1D element */ + float smoothNoise1(float arg); - private: + /*! Returns a smooth noise value for a 2D element */ + float smoothNoise2(Vec2f& vec); - int p[ _Noise_B_ + _Noise_B_ + 2]; - float g3[ _Noise_B_ + _Noise_B_ + 2][3]; - float g2[ _Noise_B_ + _Noise_B_ + 2][2]; - float g1[ _Noise_B_ + _Noise_B_ + 2]; - int start; + /*! Returns a smooth noise value for a 3D element */ + float smoothNoise3(Vec3f& vec); + +private: + int p[_NOISE_B + _NOISE_B + 2]; + float g3[_NOISE_B + _NOISE_B + 2][3]; + float g2[_NOISE_B + _NOISE_B + 2][2]; + float g1[_NOISE_B + _NOISE_B + 2]; + int start; }; -#endif // NOISE_H +#endif // __NOISE_H__ |