cstool/noise/module/billow.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

cstool/noise/module/billow.h

    00001 // 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 CS {
    00029 namespace Math {
    00030 namespace Noise {
    00031 namespace Module {
    00032
    00035
    00038
    00041
    00043     const double DEFAULT_BILLOW_FREQUENCY = 1.0;
    00044
    00046     const double DEFAULT_BILLOW_LACUNARITY = 2.0;
    00047
    00050     const int DEFAULT_BILLOW_OCTAVE_COUNT = 6;
    00051
    00054     const double DEFAULT_BILLOW_PERSISTENCE = 0.5;
    00055
    00057     const CS::Math::Noise::NoiseQuality DEFAULT_BILLOW_QUALITY = QUALITY_STD;
    00058
    00060     const int DEFAULT_BILLOW_SEED = 0;
    00061
    00064     const int BILLOW_MAX_OCTAVE = 30;
    00065
    00077     class CS_CRYSTALSPACE_EXPORT Billow: public Module
    00078     {
    00079
    00080       public:
    00081
    00098         Billow ();
    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         CS::Math::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 (CS::Math::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 CS::Math::Noise::ExceptionInvalidParam ();
    00220             CS_ASSERT (false);
    00221           }
    00222           m_octaveCount = octaveCount;
    00223         }
    00224
    00233         void SetPersistence (double persistence)
    00234         {
    00235           m_persistence = persistence;
    00236         }
    00237
    00241         void SetSeed (int seed)
    00242         {
    00243           m_seed = seed;
    00244         }
    00245
    00246       protected:
    00247
    00249         double m_frequency;
    00250
    00252         double m_lacunarity;
    00253
    00255         CS::Math::Noise::NoiseQuality m_noiseQuality;
    00256
    00258         int m_octaveCount;
    00259
    00261         double m_persistence;
    00262
    00264         int m_seed;
    00265
    00266     };
    00267
    00269
    00271
    00273
    00274 } // namespace Module
    00275 } // namespace Noise
    00276 } // namespace Math
    00277 } // namespace CS
    00278
    00279 #endif