Panda3D
 All Classes Functions Variables Enumerations
perlinNoise2.h
1 // Filename: perlinNoise2.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 PERLINNOISE2_H
16 #define PERLINNOISE2_H
17 
18 #include "pandabase.h"
19 #include "perlinNoise.h"
20 
21 ////////////////////////////////////////////////////////////////////
22 // Class : PerlinNoise2
23 // Description : This class provides an implementation of Perlin noise
24 // for 2 variables. This code is loosely based on the
25 // reference implementation at
26 // http://mrl.nyu.edu/~perlin/noise/ .
27 ////////////////////////////////////////////////////////////////////
28 class EXPCL_PANDA_MATHUTIL PerlinNoise2 : public PerlinNoise {
29 PUBLISHED:
30  INLINE PerlinNoise2();
31  INLINE PerlinNoise2(double sx, double sy,
32  int table_size = 256,
33  unsigned long seed = 0);
34  INLINE PerlinNoise2(const PerlinNoise2 &copy);
35  INLINE void operator = (const PerlinNoise2 &copy);
36 
37  INLINE void set_scale(double scale);
38  INLINE void set_scale(double sx, double sy);
39  INLINE void set_scale(const LVecBase2f &scale);
40  INLINE void set_scale(const LVecBase2d &scale);
41 
42  INLINE double noise(double x, double y) const;
43  INLINE float noise(const LVecBase2f &value) const;
44  double noise(const LVecBase2d &value) const;
45 
46  INLINE double operator ()(double x, double y) const;
47  INLINE float operator ()(const LVecBase2f &value) const;
48  INLINE double operator ()(const LVecBase2d &value) const;
49 
50 private:
51  void init_unscaled_xform();
52  INLINE static double grad(int hash, double x, double y);
53 
54 private:
55  LMatrix3d _unscaled_xform;
56  LMatrix3d _input_xform;
57 };
58 
59 #include "perlinNoise2.I"
60 
61 #endif
62 
This is the base class for PerlinNoise2 and PerlinNoise3, different dimensions of Perlin noise implem...
Definition: perlinNoise.h:31
This is the base class for all two-component vectors and points.
Definition: lvecBase2.h:1241
This class provides an implementation of Perlin noise for 2 variables.
Definition: perlinNoise2.h:28
This is a 3-by-3 transform matrix.
Definition: lmatrix.h:4375
This is the base class for all two-component vectors and points.
Definition: lvecBase2.h:105