Panda3D
stackedPerlinNoise3.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 stackedPerlinNoise3.h
10  * @author drose
11  * @date 2005-10-05
12  */
13 
14 #ifndef STACKEDPERLINNOISE3_H
15 #define STACKEDPERLINNOISE3_H
16 
17 #include "pandabase.h"
18 #include "perlinNoise3.h"
19 #include "epvector.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 StackedPerlinNoise3 {
26 PUBLISHED:
27  INLINE StackedPerlinNoise3();
28  explicit StackedPerlinNoise3(double sx, double sy, double sz, int num_levels = 3,
29  double scale_factor = 4.0f, double amp_scale = 0.5f,
30  int table_size = 256, unsigned long seed = 0);
32  void operator = (const StackedPerlinNoise3 &copy);
33 
34  void add_level(const PerlinNoise3 &level, double amp = 1.0);
35  void clear();
36 
37  INLINE double noise(double x, double y, double z);
38  INLINE float noise(const LVecBase3f &value);
39  double noise(const LVecBase3d &value);
40 
41  INLINE double operator ()(double x, double y, double z);
42  INLINE float operator ()(const LVecBase3f &value);
43  INLINE double operator ()(const LVecBase3d &value);
44 
45 private:
46  class Noise {
47  public:
48  PerlinNoise3 _noise;
49  double _amp;
50  };
51 
52  typedef epvector<Noise> Noises;
53  Noises _noises;
54 };
55 
56 #include "stackedPerlinNoise3.I"
57 
58 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class provides an implementation of Perlin noise for 3 variables.
Definition: perlinNoise3.h:25
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.