Panda3D
 All Classes Functions Variables Enumerations
perlinNoise3.h
00001 // Filename: perlinNoise3.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 PERLINNOISE3_H
00016 #define PERLINNOISE3_H
00017 
00018 #include "pandabase.h"
00019 #include "perlinNoise.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //       Class : PerlinNoise3
00023 // Description : This class provides an implementation of Perlin noise
00024 //               for 3 variables.  This code is loosely based on the
00025 //               reference implementation at
00026 //               http://mrl.nyu.edu/~perlin/noise/ .
00027 ////////////////////////////////////////////////////////////////////
00028 class EXPCL_PANDA_MATHUTIL PerlinNoise3 : public PerlinNoise {
00029 PUBLISHED:
00030   INLINE PerlinNoise3();
00031   INLINE PerlinNoise3(double sx, double sy, double sz,
00032                       int table_size = 256, unsigned long seed = 0);
00033   INLINE PerlinNoise3(const PerlinNoise3 &copy);
00034   INLINE void operator = (const PerlinNoise3 &copy);
00035 
00036   INLINE void set_scale(double scale);
00037   INLINE void set_scale(double sx, double sy, double sz);
00038   INLINE void set_scale(const LVecBase3f &scale);
00039   INLINE void set_scale(const LVecBase3d &scale);
00040 
00041   INLINE double noise(double x, double y, double z) const;
00042   INLINE float noise(const LVecBase3f &value) const;
00043   double noise(const LVecBase3d &value) const;
00044 
00045   INLINE double operator ()(double x, double y, double z) const;
00046   INLINE float operator ()(const LVecBase3f &value) const;
00047   INLINE double operator ()(const LVecBase3d &value) const;
00048   
00049 private:
00050   void init_unscaled_xform();
00051   INLINE static double grad(int hash, double x, double y, double z);
00052 
00053 private:
00054   LMatrix4d _unscaled_xform;
00055   LMatrix4d _input_xform;
00056 };
00057 
00058 #include "perlinNoise3.I"
00059 
00060 #endif
00061 
 All Classes Functions Variables Enumerations