<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>libnoise: Documentation</title> <link rel='stylesheet' type='text/css' href='doxygen.css'> <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'> </head> <body> <table class='layout'> <tr> <td class='sidebar' rowspan='2'> <p> Navigation menu </p> <ul class='toc'> <li> <a href='http://libnoise.sourceforge.net/index.html'>Main</a> </li> <li> <a href='http://libnoise.sourceforge.net/downloads/index.html'>Downloads</a> </li> <li> <a href='http://libnoise.sourceforge.net/coherentnoise/index.html'>What is coherent noise?</a> </li> <li> <a href='http://libnoise.sourceforge.net/noisegen/index.html'>Generating coherent noise</a> </li> <li> <a href='http://libnoise.sourceforge.net/glossary/index.html'>Glossary</a> </li> <li> <a href='http://libnoise.sourceforge.net/examples/index.html'>Examples</a> <ul class='toc'> <li> <a href='http://libnoise.sourceforge.net/examples/textures/index.html'>Procedural textures</a> </li> <li> <a href='http://libnoise.sourceforge.net/examples/complexplanet/index.html'>Complex planetary surface</a> </li> <li> <a href='http://libnoise.sourceforge.net/examples/worms/index.html'>Perlin worms</a> </li> </ul> </li> <li> <strong>Docs</strong> </li> <li> <a href='tutorials/index.html'>Tutorials</a> <ul class='toc'> <li> <a href='http://libnoise.sourceforge.net/tutorials/tutorial1.html'>Tutorial 1</a> </li> <li> <a href='http://libnoise.sourceforge.net/tutorials/tutorial2.html'>Tutorial 2</a> </li> <li> <a href='http://libnoise.sourceforge.net/tutorials/tutorial3.html'>Tutorial 3</a> </li> <li> <a href='http://libnoise.sourceforge.net/tutorials/tutorial4.html'>Tutorial 4</a> </li> <li> <a href='http://libnoise.sourceforge.net/tutorials/tutorial5.html'>Tutorial 5</a> </li> <li> <a href='http://libnoise.sourceforge.net/tutorials/tutorial6.html'>Tutorial 6</a> </li> <li> <a href='http://libnoise.sourceforge.net/tutorials/tutorial7.html'>Tutorial 7</a> </li> <li> <a href='http://libnoise.sourceforge.net/tutorials/tutorial8.html'>Tutorial 8</a> </li> </ul> </li> <li> <a href='http://libnoise.sourceforge.net/cvs/index.html'>CVS</a> </li> <li> <a href='http://libnoise.sourceforge.net/links/index.html'>Links</a> </li> </ul> </td> <td class='header'> <p> <img src='libnoise.png' alt='libnoise logo'> </p> <p> A portable, open-source, coherent noise-generating library for C++ </p> <hr> </td> </tr> <tr> <td class='content'> <!-- start rich gooey content --> <!-- Generated by Doxygen 1.3.9.1 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a></div> <div class="nav"> <a class="el" href="dir_000000.html">src</a> / <a class="el" href="dir_000001.html">module</a></div> <h1>perlin.h</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">// perlin.h</span> 00002 <span class="comment">//</span> 00003 <span class="comment">// Copyright (C) 2003, 2004 Jason Bevins</span> 00004 <span class="comment">//</span> 00005 <span class="comment">// This library is free software; you can redistribute it and/or modify it</span> 00006 <span class="comment">// under the terms of the GNU Lesser General Public License as published by</span> 00007 <span class="comment">// the Free Software Foundation; either version 2.1 of the License, or (at</span> 00008 <span class="comment">// your option) any later version.</span> 00009 <span class="comment">//</span> 00010 <span class="comment">// This library is distributed in the hope that it will be useful, but WITHOUT</span> 00011 <span class="comment">// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or</span> 00012 <span class="comment">// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public</span> 00013 <span class="comment">// License (COPYING.txt) for more details.</span> 00014 <span class="comment">//</span> 00015 <span class="comment">// You should have received a copy of the GNU Lesser General Public License</span> 00016 <span class="comment">// along with this library; if not, write to the Free Software Foundation,</span> 00017 <span class="comment">// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span> 00018 <span class="comment">//</span> 00019 <span class="comment">// The developer's email is jlbezigvins@gmzigail.com (for great email, take</span> 00020 <span class="comment">// off every 'zig'.)</span> 00021 <span class="comment">//</span> 00022 00023 <span class="preprocessor">#ifndef NOISE_MODULE_PERLIN_H</span> 00024 <span class="preprocessor"></span><span class="preprocessor">#define NOISE_MODULE_PERLIN_H</span> 00025 <span class="preprocessor"></span> 00026 <span class="preprocessor">#include "modulebase.h"</span> 00027 00028 <span class="keyword">namespace </span>noise 00029 { 00030 00031 <span class="keyword">namespace </span>module 00032 { 00033 00036 00039 00042 <a name="l00044"></a><a class="code" href="group__generatormodules.html#ga9">00044</a> <span class="keyword">const</span> <span class="keywordtype">double</span> DEFAULT_PERLIN_FREQUENCY = 1.0; 00045 <a name="l00047"></a><a class="code" href="group__generatormodules.html#ga10">00047</a> <span class="keyword">const</span> <span class="keywordtype">double</span> DEFAULT_PERLIN_LACUNARITY = 2.0; 00048 <a name="l00050"></a><a class="code" href="group__generatormodules.html#ga11">00050</a> <span class="keyword">const</span> <span class="keywordtype">int</span> DEFAULT_PERLIN_OCTAVE_COUNT = 6; 00051 <a name="l00053"></a><a class="code" href="group__generatormodules.html#ga12">00053</a> <span class="keyword">const</span> <span class="keywordtype">double</span> DEFAULT_PERLIN_PERSISTENCE = 0.5; 00054 <a name="l00056"></a><a class="code" href="group__generatormodules.html#ga13">00056</a> <span class="keyword">const</span> noise::NoiseQuality DEFAULT_PERLIN_QUALITY = QUALITY_STD; 00057 <a name="l00059"></a><a class="code" href="group__generatormodules.html#ga14">00059</a> <span class="keyword">const</span> <span class="keywordtype">int</span> DEFAULT_PERLIN_SEED = 0; 00060 <a name="l00062"></a><a class="code" href="group__generatormodules.html#ga15">00062</a> <span class="keyword">const</span> <span class="keywordtype">int</span> PERLIN_MAX_OCTAVE = 30; 00063 <a name="l00160"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html">00160</a> <span class="keyword">class </span><a class="code" href="classnoise_1_1module_1_1Perlin.html">Perlin</a>: <span class="keyword">public</span> <a class="code" href="classnoise_1_1module_1_1Module.html">Module</a> 00161 { 00162 00163 <span class="keyword">public</span>: 00164 00181 <a class="code" href="classnoise_1_1module_1_1Perlin.html">Perlin</a> (); 00182 <a name="l00186"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a1">00186</a> <span class="keywordtype">double</span> GetFrequency ()<span class="keyword"> const</span> 00187 <span class="keyword"> </span>{ 00188 <span class="keywordflow">return</span> m_frequency; 00189 } 00190 <a name="l00197"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a2">00197</a> <span class="keywordtype">double</span> GetLacunarity ()<span class="keyword"> const</span> 00198 <span class="keyword"> </span>{ 00199 <span class="keywordflow">return</span> m_lacunarity; 00200 } 00201 <a name="l00208"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a3">00208</a> noise::NoiseQuality GetNoiseQuality ()<span class="keyword"> const</span> 00209 <span class="keyword"> </span>{ 00210 <span class="keywordflow">return</span> m_noiseQuality; 00211 } 00212 <a name="l00219"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a4">00219</a> <span class="keywordtype">int</span> GetOctaveCount ()<span class="keyword"> const</span> 00220 <span class="keyword"> </span>{ 00221 <span class="keywordflow">return</span> m_octaveCount; 00222 } 00223 <a name="l00229"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a5">00229</a> <span class="keywordtype">double</span> GetPersistence ()<span class="keyword"> const</span> 00230 <span class="keyword"> </span>{ 00231 <span class="keywordflow">return</span> m_persistence; 00232 } 00233 <a name="l00237"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a6">00237</a> <span class="keywordtype">int</span> GetSeed ()<span class="keyword"> const</span> 00238 <span class="keyword"> </span>{ 00239 <span class="keywordflow">return</span> m_seed; 00240 } 00241 <a name="l00242"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a7">00242</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> GetSourceModuleCount ()<span class="keyword"> const</span> 00243 <span class="keyword"> </span>{ 00244 <span class="keywordflow">return</span> 0; 00245 } 00246 00247 <span class="keyword">virtual</span> <span class="keywordtype">double</span> GetValue (<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y, <span class="keywordtype">double</span> z) <span class="keyword">const</span>; 00248 <a name="l00252"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a9">00252</a> <span class="keywordtype">void</span> SetFrequency (<span class="keywordtype">double</span> frequency) 00253 { 00254 m_frequency = frequency; 00255 } 00256 <a name="l00266"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a10">00266</a> <span class="keywordtype">void</span> SetLacunarity (<span class="keywordtype">double</span> lacunarity) 00267 { 00268 m_lacunarity = lacunarity; 00269 } 00270 <a name="l00277"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a11">00277</a> <span class="keywordtype">void</span> SetNoiseQuality (noise::NoiseQuality noiseQuality) 00278 { 00279 m_noiseQuality = noiseQuality; 00280 } 00281 <a name="l00298"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a12">00298</a> <span class="keywordtype">void</span> SetOctaveCount (<span class="keywordtype">int</span> octaveCount) 00299 { 00300 <span class="keywordflow">if</span> (octaveCount < 1 || octaveCount > PERLIN_MAX_OCTAVE) { 00301 <span class="keywordflow">throw</span> <a class="code" href="classnoise_1_1ExceptionInvalidParam.html">noise::ExceptionInvalidParam</a> (); 00302 } 00303 m_octaveCount = octaveCount; 00304 } 00305 <a name="l00314"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a13">00314</a> <span class="keywordtype">void</span> SetPersistence (<span class="keywordtype">double</span> persistence) 00315 { 00316 m_persistence = persistence; 00317 } 00318 <a name="l00322"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#a14">00322</a> <span class="keywordtype">void</span> SetSeed (<span class="keywordtype">int</span> seed) 00323 { 00324 m_seed = seed; 00325 } 00326 00327 <span class="keyword">protected</span>: 00328 <a name="l00330"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#p0">00330</a> <span class="keywordtype">double</span> m_frequency; 00331 <a name="l00333"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#p1">00333</a> <span class="keywordtype">double</span> m_lacunarity; 00334 <a name="l00336"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#p2">00336</a> noise::NoiseQuality m_noiseQuality; 00337 <a name="l00339"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#p3">00339</a> <span class="keywordtype">int</span> m_octaveCount; 00340 <a name="l00342"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#p4">00342</a> <span class="keywordtype">double</span> m_persistence; 00343 <a name="l00345"></a><a class="code" href="classnoise_1_1module_1_1Perlin.html#p5">00345</a> <span class="keywordtype">int</span> m_seed; 00346 00347 }; 00348 00350 00352 00354 00355 } 00356 00357 } 00358 00359 <span class="preprocessor">#endif</span> </pre></div><!-- end rich gooey content --> </td> </tr> <tr> <td class='footer' colspan='2'> <p> © 2003-2005 Jason Bevins </p> <p> <a href='http://www.doxygen.org/'><img src='doxygen.png' alt='Doxygen logo'></a> <br> The libnoise source documentation was generated by <a href='http://www.doxygen.org/'>doxygen</a> 1.3.9.1 </p> </td> </tr> </table> </body> </html>