Panda3D
|
00001 // Filename: perlinNoise.h 00002 // Created by: drose (05Oct05) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef PERLINNOISE_H 00016 #define PERLINNOISE_H 00017 00018 #include "pandabase.h" 00019 #include "pvector.h" 00020 #include "vector_int.h" 00021 #include "luse.h" 00022 #include "randomizer.h" 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : PerlinNoise 00026 // Description : This is the base class for PerlinNoise2 and 00027 // PerlinNoise3, different dimensions of Perlin noise 00028 // implementation. The base class just collects the 00029 // common functionality. 00030 //////////////////////////////////////////////////////////////////// 00031 class EXPCL_PANDA_MATHUTIL PerlinNoise { 00032 protected: 00033 PerlinNoise(int table_size, unsigned long seed); 00034 PerlinNoise(const PerlinNoise ©); 00035 void operator = (const PerlinNoise ©); 00036 00037 INLINE static double fade(double t); 00038 INLINE static double lerp(double t, double a, double b); 00039 00040 PUBLISHED: 00041 INLINE unsigned long get_seed(); 00042 00043 protected: 00044 int _table_size; 00045 int _table_size_mask; 00046 00047 Randomizer _randomizer; 00048 00049 typedef vector_int Index; 00050 Index _index; 00051 }; 00052 00053 #include "perlinNoise.I" 00054 00055 #endif