SimpleNGL 1.0
include/PerlinNoise.h
Go to the documentation of this file.
00001 #ifndef PERLINNOISE_H
00002 #define PERLINNOISE_H
00003 
00004 #include "OpenEXR/ImathVec.h"
00005 #include "OpenEXR/ImathFun.h"
00006 
00008 
00010 #define NOISE_PERM_SIZE 512
00011 
00013 struct NoiseValues{
00014     Imath::V3f val[NOISE_PERM_SIZE][3];
00015 };
00016 
00019 class PerlinNoise{
00020 public:
00022     PerlinNoise();
00023 
00027     PerlinNoise(int _dimensions, int _seed = 0);
00028 
00030     void init();
00031 
00034     inline void setSeed(const int _v){m_seed = _v;}
00035         
00038     inline void setDimenstions(const int _v){m_dimensions= _v;}
00039 
00042     inline Imath::V3f noise(const Imath::V3f &_point)const
00043     {
00044         Imath::V3f v,tmp;
00045         tmp = doPerlin(_point, m_dimensions, m_seed, v);
00046         return tmp;
00047     }
00048 
00049 private:
00056     Imath::V3f doPerlin(const Imath::V3f &_point, int _dims, int _seed, Imath::V3f &_deltaP)const;
00057 
00059         int m_dimensions;
00061         int m_seed;
00062         
00064     Imath::V3f m_values[NOISE_PERM_SIZE][3];
00065 };
00066 
00067 
00068 
00069 #endif // PERLINNOISE_H
 All Classes Namespaces Files Functions Variables Defines