00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __NEPERLIN_H
00028 #define __NEPERLIN_H
00029
00030
00037 #include "base.h"
00038
00039
00040 namespace NeoEngine
00041 {
00042
00043
00052 class NEOENGINE_API PerlinNoise
00053 {
00054 protected:
00055
00057 unsigned int m_uiPrimeOne;
00058
00060 unsigned int m_uiPrimeTwo;
00061
00063 unsigned int m_uiPrimeThree;
00064
00066 float *m_afLookUp;
00067
00069 unsigned int m_uiMaxX;
00070
00072 unsigned int m_uiMaxY;
00073
00075 unsigned int m_uiMaxZ;
00076
00077
00078 public:
00079
00083 PerlinNoise();
00084
00088 ~PerlinNoise();
00089
00093 void NewPrimeNumbers();
00094
00100 bool IsPrime( unsigned int uiA );
00101
00108 unsigned int RandomPrime();
00109
00115 float Noise( int iX );
00116
00123 float Noise( int iX, int iY );
00124
00132 float Noise( int iX, int iY, int iZ );
00133
00141 float Interpolate( float fA, float fB, float fX );
00142
00148 float SmoothNoise( int iX );
00149
00156 float SmoothNoise( int iX, int iY );
00157
00165 float SmoothNoise( int iX, int iY, int iZ );
00166
00172 float InterpolateNoise( float fX );
00173
00180 float InterpolateNoise( float fX, float fY );
00181
00189 float InterpolateNoise( float fX, float fY, float fZ );
00190
00198 float PerlinNoise1d( float fX, float fAmplitude, float fXfrequency );
00199
00209 float PerlinNoise2d( float fX, float fY, float fAmplitude, float fXFrequency, float fYFrequency );
00210
00222 float PerlinNoise3d( float fX, float fY, float fZ, float fAmplitude, float fXfrequency, float fYfrequency, float fZfrequency );
00223
00228 void GenerateLookup( unsigned int uiMaxX );
00229
00235 void GenerateLookup( unsigned int uiMaxX, unsigned int uiMaxY );
00236
00243 void GenerateLookup( unsigned int uiMaxX, unsigned int uiMaxY, unsigned int uiMaxZ );
00244 };
00245
00246
00247 };
00248
00249
00250 #endif // __NEPERLIN_H