Navigation menu |
A portable, open-source, coherent noise-generating library for C++ |
billow.h00001 // billow.h 00002 // 00003 // Copyright (C) 2004 Jason Bevins 00004 // 00005 // This library is free software; you can redistribute it and/or modify it 00006 // under the terms of the GNU Lesser General Public License as published by 00007 // the Free Software Foundation; either version 2.1 of the License, or (at 00008 // your option) any later version. 00009 // 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00013 // License (COPYING.txt) for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, 00017 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 // 00019 // The developer's email is jlbezigvins@gmzigail.com (for great email, take 00020 // off every 'zig'.) 00021 // 00022 00023 #ifndef NOISE_MODULE_BILLOW_H 00024 #define NOISE_MODULE_BILLOW_H 00025 00026 #include "modulebase.h" 00027 00028 namespace noise 00029 { 00030 00031 namespace module 00032 { 00033 00036 00039 00042 00044 const double DEFAULT_BILLOW_FREQUENCY = 1.0; 00045 00047 const double DEFAULT_BILLOW_LACUNARITY = 2.0; 00048 00051 const int DEFAULT_BILLOW_OCTAVE_COUNT = 6; 00052 00055 const double DEFAULT_BILLOW_PERSISTENCE = 0.5; 00056 00058 const noise::NoiseQuality DEFAULT_BILLOW_QUALITY = QUALITY_STD; 00059 00061 const int DEFAULT_BILLOW_SEED = 0; 00062 00065 const int BILLOW_MAX_OCTAVE = 30; 00066 00078 class Billow: public Module 00079 { 00080 00081 public: 00082 00099 Billow (); 00100 00104 double GetFrequency () const 00105 { 00106 return m_frequency; 00107 } 00108 00115 double GetLacunarity () const 00116 { 00117 return m_lacunarity; 00118 } 00119 00126 noise::NoiseQuality GetNoiseQuality () const 00127 { 00128 return m_noiseQuality; 00129 } 00130 00137 int GetOctaveCount () const 00138 { 00139 return m_octaveCount; 00140 } 00141 00147 double GetPersistence () const 00148 { 00149 return m_persistence; 00150 } 00151 00155 int GetSeed () const 00156 { 00157 return m_seed; 00158 } 00159 00160 virtual int GetSourceModuleCount () const 00161 { 00162 return 0; 00163 } 00164 00165 virtual double GetValue (double x, double y, double z) const; 00166 00170 void SetFrequency (double frequency) 00171 { 00172 m_frequency = frequency; 00173 } 00174 00184 void SetLacunarity (double lacunarity) 00185 { 00186 m_lacunarity = lacunarity; 00187 } 00188 00195 void SetNoiseQuality (noise::NoiseQuality noiseQuality) 00196 { 00197 m_noiseQuality = noiseQuality; 00198 } 00199 00216 void SetOctaveCount (int octaveCount) 00217 { 00218 if (octaveCount < 1 || octaveCount > BILLOW_MAX_OCTAVE) { 00219 throw noise::ExceptionInvalidParam (); 00220 } 00221 m_octaveCount = octaveCount; 00222 } 00223 00232 void SetPersistence (double persistence) 00233 { 00234 m_persistence = persistence; 00235 } 00236 00240 void SetSeed (int seed) 00241 { 00242 m_seed = seed; 00243 } 00244 00245 protected: 00246 00248 double m_frequency; 00249 00251 double m_lacunarity; 00252 00254 noise::NoiseQuality m_noiseQuality; 00255 00257 int m_octaveCount; 00258 00260 double m_persistence; 00261 00263 int m_seed; 00264 00265 }; 00266 00268 00270 00272 00273 } 00274 00275 } 00276 00277 #endif |
|
© 2003-2005 Jason Bevins
|