Blender  V2.93
Noise.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include "Geom.h"
25 
26 #include "../system/FreestyleConfig.h"
27 
28 #ifdef WITH_CXX_GUARDEDALLOC
29 # include "MEM_guardedalloc.h"
30 #endif
31 
32 using namespace std;
33 
34 namespace Freestyle {
35 
36 #define _NOISE_B 0x100
37 
38 using namespace Geometry;
39 
41 class Noise {
42  public:
44  Noise(long seed = -1);
45 
48  {
49  }
50 
52  float turbulence1(float arg, float freq, float amp, unsigned oct = 4);
53 
55  float turbulence2(Vec2f &v, float freq, float amp, unsigned oct = 4);
56 
58  float turbulence3(Vec3f &v, float freq, float amp, unsigned oct = 4);
59 
61  float smoothNoise1(float arg);
62 
64  float smoothNoise2(Vec2f &vec);
65 
67  float smoothNoise3(Vec3f &vec);
68 
69  private:
70  int p[_NOISE_B + _NOISE_B + 2];
71  float g3[_NOISE_B + _NOISE_B + 2][3];
72  float g2[_NOISE_B + _NOISE_B + 2][2];
73  float g1[_NOISE_B + _NOISE_B + 2];
74  /* UNUSED */
75  // int start;
76 
77 #ifdef WITH_CXX_GUARDEDALLOC
78  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Noise")
79 #endif
80 };
81 
82 } /* namespace Freestyle */
Vectors and Matrices (useful type definitions)
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White Noise
#define _NOISE_B
Definition: Noise.h:36
ATTR_WARN_UNUSED_RESULT const BMVert * v
static unsigned long seed
Definition: btSoftBody.h:39
inherits from class Rep
Definition: AppCanvas.cpp:32