A portable, open-source, coherent noise-generating library for C++

Main Page | Modules | Class Hierarchy | Class List | File List | Class Members

# displace.h

    00001 // displace.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_DISPLACE_H
    00024 #define NOISE_MODULE_DISPLACE_H
    00025
    00026 #include "modulebase.h"
    00027
    00028 namespace noise
    00029 {
    00030
    00031   namespace module
    00032   {
    00033
    00036
    00039
    00043
    00069     class Displace: public Module
    00070     {
    00071
    00072       public:
    00073
    00075       Displace ();
    00076
    00077       virtual int GetSourceModuleCount () const
    00078       {
    00079         return 4;
    00080       }
    00081
    00082       virtual double GetValue (double x, double y, double z) const;
    00083
    00098       const Module& GetXDisplaceModule () const
    00099       {
    00100         if (m_pSourceModule == NULL || m_pSourceModule[1] == NULL) {
    00101           throw noise::ExceptionNoModule ();
    00102         }
    00103         return *(m_pSourceModule[1]);
    00104       }
    00105
    00120       const Module& GetYDisplaceModule () const
    00121       {
    00122         if (m_pSourceModule == NULL || m_pSourceModule[2] == NULL) {
    00123           throw noise::ExceptionNoModule ();
    00124         }
    00125         return *(m_pSourceModule[2]);
    00126       }
    00127
    00142       const Module& GetZDisplaceModule () const
    00143       {
    00144         if (m_pSourceModule == NULL || m_pSourceModule[3] == NULL) {
    00145           throw noise::ExceptionNoModule ();
    00146         }
    00147         return *(m_pSourceModule[3]);
    00148       }
    00149
    00170       void SetDisplaceModules (const Module& xDisplaceModule,
    00171         const Module& yDisplaceModule, const Module& zDisplaceModule)
    00172       {
    00173         SetXDisplaceModule (xDisplaceModule);
    00174         SetYDisplaceModule (yDisplaceModule);
    00175         SetZDisplaceModule (zDisplaceModule);
    00176       }
    00177
    00195       void SetXDisplaceModule (const Module& xDisplaceModule)
    00196       {
    00197         assert (m_pSourceModule != NULL);
    00198         m_pSourceModule[1] = &xDisplaceModule;
    00199       }
    00200
    00218       void SetYDisplaceModule (const Module& yDisplaceModule)
    00219       {
    00220         assert (m_pSourceModule != NULL);
    00221         m_pSourceModule[2] = &yDisplaceModule;
    00222       }
    00223
    00241       void SetZDisplaceModule (const Module& zDisplaceModule)
    00242       {
    00243         assert (m_pSourceModule != NULL);
    00244         m_pSourceModule[3] = &zDisplaceModule;
    00245       }
    00246
    00247     };
    00248
    00250
    00252
    00254
    00255   }
    00256
    00257 }
    00258
    00259 #endif