Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

perlin.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                      perlin.h  -  Perlin noise generator
00003                              -------------------
00004     begin                : Mon Oct 14 2002
00005     copyright            : (C) 2002 by Rob Wanders
00006     email                : forteq@softhome.net
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, perlin.h
00020 
00021  The Initial Developer of the Original Code is Rob Wanders.
00022  Portions created by Rob Wanders are Copyright (C) 2002
00023  Rob Wanders. All Rights Reserved.
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 }; // namespace NeoEngine
00248 
00249 
00250 #endif // __NEPERLIN_H

Generated on Wed Jan 21 14:21:07 2004 for NeoEngine by doxygen 1.3.5