cstool/noise/module/ridgedmulti.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/ridgedmulti.h

    00001 // ridgedmulti.h
    00002 //
    00003 // Copyright (C) 2003, 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_RIDGEDMULTI_H
    00024 #define NOISE_MODULE_RIDGEDMULTI_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_RIDGED_FREQUENCY = 1.0;
    00044
    00046     const double DEFAULT_RIDGED_LACUNARITY = 2.0;
    00047
    00050     const int DEFAULT_RIDGED_OCTAVE_COUNT = 6;
    00051
    00054     const CS::Math::Noise::NoiseQuality DEFAULT_RIDGED_QUALITY = QUALITY_STD;
    00055
    00057     const int DEFAULT_RIDGED_SEED = 0;
    00058
    00061     const int RIDGED_MAX_OCTAVE = 30;
    00062
    00127     class CS_CRYSTALSPACE_EXPORT RidgedMulti: public Module
    00128     {
    00129
    00130       public:
    00131
    00145         RidgedMulti ();
    00146
    00150         double GetFrequency () const
    00151         {
    00152           return m_frequency;
    00153         }
    00154
    00161         double GetLacunarity () const
    00162         {
    00163           return m_lacunarity;
    00164         }
    00165
    00172         CS::Math::Noise::NoiseQuality GetNoiseQuality () const
    00173         {
    00174           return m_noiseQuality;
    00175         }
    00176
    00185         int GetOctaveCount () const
    00186         {
    00187           return m_octaveCount;
    00188         }
    00189
    00194         int GetSeed () const
    00195         {
    00196           return m_seed;
    00197         }
    00198
    00199         virtual int GetSourceModuleCount () const
    00200         {
    00201           return 0;
    00202         }
    00203
    00204         virtual double GetValue (double x, double y, double z) const;
    00205
    00209         void SetFrequency (double frequency)
    00210         {
    00211           m_frequency = frequency;
    00212         }
    00213
    00223         void SetLacunarity (double lacunarity)
    00224         {
    00225           m_lacunarity = lacunarity;
    00226           CalcSpectralWeights ();
    00227         }
    00228
    00235         void SetNoiseQuality (CS::Math::Noise::NoiseQuality noiseQuality)
    00236         {
    00237           m_noiseQuality = noiseQuality;
    00238         }
    00239
    00257         void SetOctaveCount (int octaveCount)
    00258         {
    00259           if (octaveCount > RIDGED_MAX_OCTAVE) {
    00260             //throw CS::Math::Noise::ExceptionInvalidParam ();
    00261             CS_ASSERT (false);
    00262           }
    00263           m_octaveCount = octaveCount;
    00264         }
    00265
    00270         void SetSeed (int seed)
    00271         {
    00272           m_seed = seed;
    00273         }
    00274
    00275       protected:
    00276
    00280         void CalcSpectralWeights ();
    00281
    00283         double m_frequency;
    00284
    00286         double m_lacunarity;
    00287
    00289         CS::Math::Noise::NoiseQuality m_noiseQuality;
    00290
    00293         int m_octaveCount;
    00294
    00296         double m_pSpectralWeights[RIDGED_MAX_OCTAVE];
    00297
    00299         int m_seed;
    00300
    00301     };
    00302
    00304
    00306
    00308
    00309 } // namespace Module
    00310 } // namespace Noise
    00311 } // namespace Math
    00312 } // namespace CS
    00313
    00314 #endif