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