Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > c64f89a8a05df304b0d9ff680ae1aa00 > files > 38

mercator-devel-0.2.7-4.fc15.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Mercator: GrassShader.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Mercator</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>GrassShader.h</h1>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// This file may be redistributed and modified only under the terms of</span>
<a name="l00002"></a>00002 <span class="comment">// the GNU General Public License (See COPYING for details).</span>
<a name="l00003"></a>00003 <span class="comment">// Copyright (C) 2003 Alistair Riddoch</span>
<a name="l00004"></a>00004 
<a name="l00005"></a>00005 <span class="preprocessor">#ifndef MERCATOR_FILL_GRASS_SHADER_H</span>
<a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#define MERCATOR_FILL_GRASS_SHADER_H</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;Mercator/Shader.h&gt;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;Mercator/Surface.h&gt;</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="comment">/* alpha ^</span>
<a name="l00012"></a>00012 <span class="comment"> *       |</span>
<a name="l00013"></a>00013 <span class="comment"> *     1 |_______________________ cutoff</span>
<a name="l00014"></a>00014 <span class="comment"> *       |                       \ </span>
<a name="l00015"></a>00015 <span class="comment"> *       |                        \ </span>
<a name="l00016"></a>00016 <span class="comment"> *       |                         \ </span>
<a name="l00017"></a>00017 <span class="comment"> *       |                          \ </span>
<a name="l00018"></a>00018 <span class="comment"> *       |                           \ </span>
<a name="l00019"></a>00019 <span class="comment"> *       |                            \ </span>
<a name="l00020"></a>00020 <span class="comment"> *       |                             \ </span>
<a name="l00021"></a>00021 <span class="comment"> *       |                              \ </span>
<a name="l00022"></a>00022 <span class="comment"> *       |                               \ </span>
<a name="l00023"></a>00023 <span class="comment"> *       |                                \  intercept</span>
<a name="l00024"></a>00024 <span class="comment"> *     0 |_________________________________\_________________________&gt; slope</span>
<a name="l00025"></a>00025 <span class="comment"> *</span>
<a name="l00026"></a>00026 <span class="comment"> * This shader is used to add grassy vegetation to some terrain.</span>
<a name="l00027"></a>00027 <span class="comment"> * The mask generated by this shader depends on two factors. The altitude</span>
<a name="l00028"></a>00028 <span class="comment"> * of the terrain, and its slope. Two parameter specify the low and high</span>
<a name="l00029"></a>00029 <span class="comment"> * altitude values between which vegetation grows. The low value will typically</span>
<a name="l00030"></a>00030 <span class="comment"> * be just above sea level, and the high value could be anything up to the</span>
<a name="l00031"></a>00031 <span class="comment"> * height above which plants cannot grow.</span>
<a name="l00032"></a>00032 <span class="comment"> *</span>
<a name="l00033"></a>00033 <span class="comment"> * The cutoff parameter specifies the slope below which the vegetation is</span>
<a name="l00034"></a>00034 <span class="comment"> * completely opaque. The intercept parameter specifies the slope above which</span>
<a name="l00035"></a>00035 <span class="comment"> * vegetetation will not grow on the terrain. Between these values the</span>
<a name="l00036"></a>00036 <span class="comment"> * vegetation is blended onto the terrain to give an impression of a light</span>
<a name="l00037"></a>00037 <span class="comment"> * covering.</span>
<a name="l00038"></a>00038 <span class="comment"> */</span>
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="keyword">namespace </span>Mercator {
<a name="l00041"></a>00041 
<a name="l00050"></a><a class="code" href="classMercator_1_1GrassShader.html">00050</a> <span class="keyword">class </span><a class="code" href="classMercator_1_1GrassShader.html" title="Shader for adding grass to the terrain.">GrassShader</a> : <span class="keyword">public</span> <a class="code" href="classMercator_1_1Shader.html" title="Base class for Shader objects which create surface data for use when rendering terrain.">Shader</a> {
<a name="l00051"></a>00051   <span class="keyword">private</span>:
<a name="l00053"></a><a class="code" href="classMercator_1_1GrassShader.html#a9e1f5fd4ee215a3b19d5212ab3714f8e">00053</a>     <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a9e1f5fd4ee215a3b19d5212ab3714f8e" title="The level above which the shader renders.">m_lowThreshold</a>;
<a name="l00055"></a><a class="code" href="classMercator_1_1GrassShader.html#a8d0da28f85bb285b0553b07e76c824cd">00055</a>     <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a8d0da28f85bb285b0553b07e76c824cd" title="The level below which the shader renders.">m_highThreshold</a>;
<a name="l00057"></a><a class="code" href="classMercator_1_1GrassShader.html#a8a76a8ee6b0d1d14342656328fd59bc2">00057</a>     <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a8a76a8ee6b0d1d14342656328fd59bc2" title="The slope below which grass is opaque.">m_cutoff</a>;
<a name="l00059"></a><a class="code" href="classMercator_1_1GrassShader.html#aa94b0da36fa07d978553bd403b445f97">00059</a>     <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#aa94b0da36fa07d978553bd403b445f97" title="The slope steeper than which no grass grows.">m_intercept</a>;
<a name="l00060"></a>00060 
<a name="l00067"></a>00067     ColorT <a class="code" href="classMercator_1_1GrassShader.html#a59ee673c009458a89164308d7a82c546" title="Determine the alpha value for grass for a given slope.">slopeToAlpha</a>(<span class="keywordtype">float</span> height, <span class="keywordtype">float</span> slope) <span class="keyword">const</span>;
<a name="l00068"></a>00068   <span class="keyword">public</span>:
<a name="l00070"></a><a class="code" href="classMercator_1_1GrassShader.html#ae63899938d7d2277b58846c85ba87328">00070</a>     <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="classMercator_1_1GrassShader.html#ae63899938d7d2277b58846c85ba87328" title="Key string used when specifying the low threshold parameter.">key_lowThreshold</a>;
<a name="l00072"></a><a class="code" href="classMercator_1_1GrassShader.html#a9ef39ec949a2d3831a7bc914a2cc275b">00072</a>     <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="classMercator_1_1GrassShader.html#a9ef39ec949a2d3831a7bc914a2cc275b" title="Key string used when specifying the high threshold parameter.">key_highThreshold</a>;
<a name="l00074"></a><a class="code" href="classMercator_1_1GrassShader.html#a22cabe8f7104b4c6f5e6cc2a1917d849">00074</a>     <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="classMercator_1_1GrassShader.html#a22cabe8f7104b4c6f5e6cc2a1917d849" title="Key string used when specifying the cutoff parameter.">key_cutoff</a>;
<a name="l00076"></a><a class="code" href="classMercator_1_1GrassShader.html#ae125f1a11685edf2b522a2e884ca8c70">00076</a>     <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="classMercator_1_1GrassShader.html#ae125f1a11685edf2b522a2e884ca8c70" title="Key string used when specifying the intercept parameter.">key_intercept</a>;
<a name="l00077"></a>00077 
<a name="l00079"></a><a class="code" href="classMercator_1_1GrassShader.html#a353104cea611576f69e007b9ec6a74c9">00079</a>     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a353104cea611576f69e007b9ec6a74c9" title="Default level above which the shader renders.">default_lowThreshold</a>;
<a name="l00081"></a><a class="code" href="classMercator_1_1GrassShader.html#a56db80a396fe1eddb98567cc43b3bf10">00081</a>     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a56db80a396fe1eddb98567cc43b3bf10" title="Default level below which the shader renders.">default_highThreshold</a>;
<a name="l00083"></a><a class="code" href="classMercator_1_1GrassShader.html#ac2c3d7c576d14496042338f0a9fdb96f">00083</a>     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#ac2c3d7c576d14496042338f0a9fdb96f" title="Default slope below which grass is opaque.">default_cutoff</a>;
<a name="l00085"></a><a class="code" href="classMercator_1_1GrassShader.html#a75912f4e52148c66dccc83ea33d02964">00085</a>     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a75912f4e52148c66dccc83ea33d02964" title="Default slope steeper than which no grass grows.">default_intercept</a>;
<a name="l00086"></a>00086 
<a name="l00093"></a>00093     <span class="keyword">explicit</span> <a class="code" href="classMercator_1_1GrassShader.html#a4c60cc822447f50231c301f00f04a351" title="Constructor.">GrassShader</a>(<span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a2282e21caa1a670ddf100657db682c36" title="Accessor for level above which the shader renders.">lowThreshold</a> = <a class="code" href="classMercator_1_1GrassShader.html#a353104cea611576f69e007b9ec6a74c9" title="Default level above which the shader renders.">default_lowThreshold</a>,
<a name="l00094"></a>00094                          <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a4170e33ff183e4180abf18f2965657f3" title="Accessor for level below which the shader renders.">highThreshold</a> = <a class="code" href="classMercator_1_1GrassShader.html#a56db80a396fe1eddb98567cc43b3bf10" title="Default level below which the shader renders.">default_highThreshold</a>,
<a name="l00095"></a>00095                          <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a92d34aed191166edd4f1e1f149e7d093" title="Accessor for slope below which grass is opaque.">cutoff</a> = <a class="code" href="classMercator_1_1GrassShader.html#ac2c3d7c576d14496042338f0a9fdb96f" title="Default slope below which grass is opaque.">default_cutoff</a>,
<a name="l00096"></a>00096                          <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a32190113d1fb7c84106adf71c6fec58a" title="Accessor for slope steeper than which no grass grows.">intercept</a> = <a class="code" href="classMercator_1_1GrassShader.html#a75912f4e52148c66dccc83ea33d02964" title="Default slope steeper than which no grass grows.">default_intercept</a>);
<a name="l00100"></a>00100     <span class="keyword">explicit</span> <a class="code" href="classMercator_1_1GrassShader.html#a4c60cc822447f50231c301f00f04a351" title="Constructor.">GrassShader</a>(<span class="keyword">const</span> <a class="code" href="classMercator_1_1Shader.html#a1e99426c6c90afbb8c54114bb692b861" title="STL map of parameter values for a shader constructor.">Parameters</a> &amp; params);
<a name="l00101"></a>00101     <span class="keyword">virtual</span> ~<a class="code" href="classMercator_1_1GrassShader.html" title="Shader for adding grass to the terrain.">GrassShader</a>();
<a name="l00102"></a>00102 
<a name="l00104"></a><a class="code" href="classMercator_1_1GrassShader.html#a2282e21caa1a670ddf100657db682c36">00104</a>     <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a2282e21caa1a670ddf100657db682c36" title="Accessor for level above which the shader renders.">lowThreshold</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1GrassShader.html#a9e1f5fd4ee215a3b19d5212ab3714f8e" title="The level above which the shader renders.">m_lowThreshold</a>; }
<a name="l00106"></a><a class="code" href="classMercator_1_1GrassShader.html#a4170e33ff183e4180abf18f2965657f3">00106</a>     <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a4170e33ff183e4180abf18f2965657f3" title="Accessor for level below which the shader renders.">highThreshold</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1GrassShader.html#a8d0da28f85bb285b0553b07e76c824cd" title="The level below which the shader renders.">m_highThreshold</a>; }
<a name="l00108"></a><a class="code" href="classMercator_1_1GrassShader.html#a92d34aed191166edd4f1e1f149e7d093">00108</a>     <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a92d34aed191166edd4f1e1f149e7d093" title="Accessor for slope below which grass is opaque.">cutoff</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1GrassShader.html#a8a76a8ee6b0d1d14342656328fd59bc2" title="The slope below which grass is opaque.">m_cutoff</a>; }
<a name="l00110"></a><a class="code" href="classMercator_1_1GrassShader.html#a32190113d1fb7c84106adf71c6fec58a">00110</a>     <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1GrassShader.html#a32190113d1fb7c84106adf71c6fec58a" title="Accessor for slope steeper than which no grass grows.">intercept</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1GrassShader.html#aa94b0da36fa07d978553bd403b445f97" title="The slope steeper than which no grass grows.">m_intercept</a>; }
<a name="l00111"></a>00111 
<a name="l00112"></a>00112     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classMercator_1_1GrassShader.html#ab2a6bd393a2953b5905643fe9b70edb6" title="Check whether this Shader has any effect on the given Segment.">checkIntersect</a>(<span class="keyword">const</span> <a class="code" href="classMercator_1_1Segment.html" title="Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...">Segment</a> &amp;) <span class="keyword">const</span>;
<a name="l00113"></a>00113     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1GrassShader.html#a7700ee2afd2b0f4cdbc05f4bd9a033e5" title="Populate a Surface with data.">shade</a>(<a class="code" href="classMercator_1_1Surface.html" title="Data store for terrain surface data.">Surface</a> &amp;) <span class="keyword">const</span>;
<a name="l00114"></a>00114 };
<a name="l00115"></a>00115 
<a name="l00116"></a>00116 } <span class="comment">// namespace Mercator</span>
<a name="l00117"></a>00117 
<a name="l00118"></a>00118 <span class="preprocessor">#endif // MERCATOR_FILL_GRASS_SHADER_H</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated for Mercator by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>