Panda3D
stackedPerlinNoise3.h
1 // Filename: stackedPerlinNoise3.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 STACKEDPERLINNOISE3_H
16 #define STACKEDPERLINNOISE3_H
17 
18 #include "pandabase.h"
19 #include "perlinNoise3.h"
20 #include "epvector.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : StackedPerlinNoise3
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 StackedPerlinNoise3 {
29 PUBLISHED:
30  INLINE StackedPerlinNoise3();
31  StackedPerlinNoise3(double sx, double sy, double sz, int num_levels = 3,
32  double scale_factor = 4.0f, double amp_scale = 0.5f,
33  int table_size = 256, unsigned long seed = 0);
34  StackedPerlinNoise3(const StackedPerlinNoise3 &copy);
35  void operator = (const StackedPerlinNoise3 &copy);
36 
37  void add_level(const PerlinNoise3 &level, double amp = 1.0);
38  void clear();
39 
40  INLINE double noise(double x, double y, double z);
41  INLINE float noise(const LVecBase3f &value);
42  double noise(const LVecBase3d &value);
43 
44  INLINE double operator ()(double x, double y, double z);
45  INLINE float operator ()(const LVecBase3f &value);
46  INLINE double operator ()(const LVecBase3d &value);
47 
48 private:
49  class Noise {
50  public:
51  PerlinNoise3 _noise;
52  double _amp;
53  };
54 
55  typedef epvector<Noise> Noises;
56  Noises _noises;
57 };
58 
59 #include "stackedPerlinNoise3.I"
60 
61 #endif
62 
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
This class provides an implementation of Perlin noise for 3 variables.
Definition: perlinNoise3.h:28
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:1471
Implements a multi-layer PerlinNoise, with one or more high-frequency noise functions added to a lowe...