Panda3D
perlinNoise.h
1 // Filename: perlinNoise.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 PERLINNOISE_H
16 #define PERLINNOISE_H
17 
18 #include "pandabase.h"
19 #include "pvector.h"
20 #include "vector_int.h"
21 #include "luse.h"
22 #include "randomizer.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : PerlinNoise
26 // Description : This is the base class for PerlinNoise2 and
27 // PerlinNoise3, different dimensions of Perlin noise
28 // implementation. The base class just collects the
29 // common functionality.
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_PANDA_MATHUTIL PerlinNoise {
32 protected:
33  PerlinNoise(int table_size, unsigned long seed);
34  PerlinNoise(const PerlinNoise &copy);
35  void operator = (const PerlinNoise &copy);
36 
37  INLINE static double fade(double t);
38  INLINE static double lerp(double t, double a, double b);
39 
40 PUBLISHED:
41  INLINE unsigned long get_seed();
42 
43 protected:
44  int _table_size;
45  int _table_size_mask;
46 
47  Randomizer _randomizer;
48 
49  typedef vector_int Index;
50  Index _index;
51 };
52 
53 #include "perlinNoise.I"
54 
55 #endif
This is the base class for PerlinNoise2 and PerlinNoise3, different dimensions of Perlin noise implem...
Definition: perlinNoise.h:31
A handy class to return random numbers.
Definition: randomizer.h:28