Panda3D
stackedPerlinNoise2.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file stackedPerlinNoise2.h
10  * @author drose
11  * @date 2005-10-05
12  */
13 
14 #ifndef STACKEDPERLINNOISE2_H
15 #define STACKEDPERLINNOISE2_H
16 
17 #include "pandabase.h"
18 #include "perlinNoise2.h"
19 #include "pvector.h"
20 
21 /**
22  * Implements a multi-layer PerlinNoise, with one or more high-frequency noise
23  * functions added to a lower-frequency base noise function.
24  */
25 class EXPCL_PANDA_MATHUTIL StackedPerlinNoise2 {
26 PUBLISHED:
27  INLINE StackedPerlinNoise2();
28  explicit StackedPerlinNoise2(double sx, double sy, int num_levels = 2,
29  double scale_factor = 4.0f, double amp_scale = 0.5f,
30  int table_size = 256, unsigned long seed = 0);
32  void operator = (const StackedPerlinNoise2 &copy);
33 
34  void add_level(const PerlinNoise2 &level, double amp = 1.0);
35  void clear();
36 
37  INLINE double noise(double x, double y);
38  INLINE float noise(const LVecBase2f &value);
39  double noise(const LVecBase2d &value);
40 
41  INLINE double operator ()(double x, double y);
42  INLINE float operator ()(const LVecBase2f &value);
43  INLINE double operator ()(const LVecBase2d &value);
44 
45 private:
46  class Noise {
47  public:
48  PerlinNoise2 _noise;
49  double _amp;
50  };
51 
52  typedef pvector<Noise> Noises;
53  Noises _noises;
54 };
55 
56 #include "stackedPerlinNoise2.I"
57 
58 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class provides an implementation of Perlin noise for 2 variables.
Definition: perlinNoise2.h:25
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Implements a multi-layer PerlinNoise, with one or more high-frequency noise functions added to a lowe...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.