source: OGRE/trunk/ogrenew/Docs/api/html/OgreController_8h-source.html @ 692

Revision 692, 15.3 KB checked in by mattausch, 18 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1<html>
2<head>
3<title>OgreController.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
4<link type="text/css" rel="stylesheet" href="style.css">
5</head>
6
7<body>
8<!-- Generated by Doxygen 1.3.6 -->
9<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
10<h1>OgreController.h</h1><a href="OgreController_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>
1100002 <span class="comment">-----------------------------------------------------------------------------</span>
1200003 <span class="comment">This source file is part of OGRE</span>
1300004 <span class="comment">    (Object-oriented Graphics Rendering Engine)</span>
1400005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span>
1500006 <span class="comment"></span>
1600007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span>
1700008 <span class="comment">Also see acknowledgements in Readme.html</span>
1800009 <span class="comment"></span>
1900010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span>
2000011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span>
2100012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span>
2200013 <span class="comment">version.</span>
2300014 <span class="comment"></span>
2400015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span>
2500016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span>
2600017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span>
2700018 <span class="comment"></span>
2800019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span>
2900020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span>
3000021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span>
3100022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span>
3200023 <span class="comment">-----------------------------------------------------------------------------</span>
3300024 <span class="comment">*/</span>
3400025 <span class="preprocessor">#ifndef __Controller_H__</span>
3500026 <span class="preprocessor"></span><span class="preprocessor">#define __Controller_H__</span>
3600027 <span class="preprocessor"></span>
3700028 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span>
3800029
3900030 <span class="preprocessor">#include "<a class="code" href="OgreSharedPtr_8h.html">OgreSharedPtr.h</a>"</span>
4000031
4100032 <span class="keyword">namespace </span>Ogre {
4200033
4300034
4400035     
4500036     
4600046     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;
47<a name="l00047"></a><a class="code" href="classOgre_1_1ControllerFunction.html">00047</a>     <span class="keyword">class </span><a class="code" href="classOgre_1_1ControllerFunction.html">ControllerFunction</a>
4800048     {
4900049     <span class="keyword">protected</span>:
50<a name="l00051"></a><a class="code" href="classOgre_1_1ControllerFunction.html#Ogre_1_1ControllerFunctionp0">00051</a>         <span class="keywordtype">bool</span> mDeltaInput;
51<a name="l00052"></a><a class="code" href="classOgre_1_1ControllerFunction.html#Ogre_1_1ControllerFunctionp1">00052</a>         T mDeltaCount;
5200053
53<a name="l00056"></a><a class="code" href="classOgre_1_1ControllerFunction.html#Ogre_1_1ControllerFunctionb0">00056</a>         T <a class="code" href="classOgre_1_1ControllerFunction.html#Ogre_1_1ControllerFunctionb0">getAdjustedInput</a>(T input)
5400057         {
5500058             <span class="keywordflow">if</span> (mDeltaInput)
5600059             {
5700060                 mDeltaCount += input;
5800061                 <span class="comment">// Wrap</span>
5900062                 <span class="keywordflow">while</span> (mDeltaCount &gt;= 1.0)
6000063                     mDeltaCount -= 1.0;
6100064                 <span class="keywordflow">while</span> (mDeltaCount &lt; 0.0)
6200065                     mDeltaCount += 1.0;
6300066
6400067                 <span class="keywordflow">return</span> mDeltaCount;
6500068             }
6600069             <span class="keywordflow">else</span>
6700070             {
6800071                 <span class="keywordflow">return</span> input;
6900072             }
7000073         }
7100074
7200075     <span class="keyword">public</span>:
73<a name="l00081"></a><a class="code" href="classOgre_1_1ControllerFunction.html#Ogre_1_1ControllerFunctiona0">00081</a>         <a class="code" href="classOgre_1_1ControllerFunction.html#Ogre_1_1ControllerFunctiona0">ControllerFunction</a>(<span class="keywordtype">bool</span> deltaInput)
7400082         {
7500083             mDeltaInput = deltaInput;
7600084             mDeltaCount = 0;
7700085         }
7800086
79<a name="l00087"></a><a class="code" href="classOgre_1_1ControllerFunction.html#Ogre_1_1ControllerFunctiona1">00087</a>         <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1ControllerFunction.html#Ogre_1_1ControllerFunctiona1">~ControllerFunction</a>() {}
8000088
8100089         <span class="keyword">virtual</span> T <a class="code" href="classOgre_1_1ControllerFunction.html#Ogre_1_1ControllerFunctiona2">calculate</a>(T sourceValue) = 0;
8200090     };
8300091
8400092
8500095     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;
86<a name="l00096"></a><a class="code" href="classOgre_1_1ControllerValue.html">00096</a>     <span class="keyword">class </span><a class="code" href="classOgre_1_1ControllerValue.html">ControllerValue</a>
8700097     {
8800098
8900099     <span class="keyword">public</span>:
90<a name="l00100"></a><a class="code" href="classOgre_1_1ControllerValue.html#Ogre_1_1ControllerValuea0">00100</a>         <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1ControllerValue.html#Ogre_1_1ControllerValuea0">~ControllerValue</a>() { }
9100101         <span class="keyword">virtual</span> T <a class="code" href="classOgre_1_1ControllerValue.html#Ogre_1_1ControllerValuea1">getValue</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span> = 0;
9200102         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1ControllerValue.html#Ogre_1_1ControllerValuea2">setValue</a>(T value) = 0;
9300103
9400104     };
9500105
9600126     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;
97<a name="l00127"></a><a class="code" href="classOgre_1_1Controller.html">00127</a>     <span class="keyword">class </span><a class="code" href="classOgre_1_1Controller.html">Controller</a>
9800128     {
9900129     <span class="keyword">protected</span>:
100<a name="l00131"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllerp0">00131</a>         <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr&lt; ControllerValue&lt;T&gt;</a> &gt; mSource;
101<a name="l00133"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllerp1">00133</a>         <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr&lt; ControllerValue&lt;T&gt;</a> &gt; mDest;
102<a name="l00135"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllerp2">00135</a>         <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr&lt; ControllerFunction&lt;T&gt;</a> &gt; mFunc;
103<a name="l00137"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllerp3">00137</a>         <span class="keywordtype">bool</span> mEnabled;
10400138
10500139
10600140     <span class="keyword">public</span>:
10700141
108<a name="l00147"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera0">00147</a>         <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera0">Controller</a>(<span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a>&lt; <a class="code" href="classOgre_1_1ControllerValue.html">ControllerValue&lt;T&gt;</a> &gt;&amp; src,
10900148             <span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a>&lt; <a class="code" href="classOgre_1_1ControllerValue.html">ControllerValue&lt;T&gt;</a> &gt;&amp; dest, <span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a>&lt; <a class="code" href="classOgre_1_1ControllerFunction.html">ControllerFunction&lt;T&gt;</a> &gt;&amp; func)
11000149             : mSource(src), mDest(dest), mFunc(func)
11100150         {
11200151             mEnabled = <span class="keyword">true</span>;
11300152         }
11400153
115<a name="l00156"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera1">00156</a>         <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera1">~Controller</a>() {}
11600157
11700158
118<a name="l00160"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera2">00160</a>         <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera2">setSource</a>(<span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a>&lt; <a class="code" href="classOgre_1_1ControllerValue.html">ControllerValue&lt;T&gt;</a> &gt;&amp; src)
11900161         {
12000162             mSource = src;
12100163         }
122<a name="l00165"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera3">00165</a>         <span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr&lt; ControllerValue&lt;T&gt;</a> &gt;&amp; <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera3">getSource</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
12300166 <span class="keyword">        </span>{
12400167             <span class="keywordflow">return</span> mSource;
12500168         }
126<a name="l00170"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera4">00170</a>         <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera4">setDestination</a>(<span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a>&lt; <a class="code" href="classOgre_1_1ControllerValue.html">ControllerValue&lt;T&gt;</a> &gt;&amp; dest)
12700171         {
12800172             mDest = dest;
12900173         }
13000174
131<a name="l00176"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera5">00176</a>         <span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr&lt; ControllerValue&lt;T&gt;</a> &gt;&amp; <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera5">getDestination</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
13200177 <span class="keyword">        </span>{
13300178             <span class="keywordflow">return</span> mDest;
13400179         }
13500180
136<a name="l00182"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera6">00182</a>         <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera6">getEnabled</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
13700183 <span class="keyword">        </span>{
13800184             <span class="keywordflow">return</span> mEnabled;
13900185         }
14000186
141<a name="l00188"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera7">00188</a>         <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera7">setEnabled</a>(<span class="keywordtype">bool</span> enabled)
14200189         {
14300190             mEnabled = enabled;
14400191         }
14500192
146<a name="l00195"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera8">00195</a>         <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera8">setFunction</a>(<span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a>&lt; <a class="code" href="classOgre_1_1ControllerFunction.html">ControllerFunction&lt;T&gt;</a> &gt;&amp; func)
14700196         {
14800197             mFunc = func;
14900198         }
15000199
151<a name="l00202"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera9">00202</a>         <span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr&lt; ControllerFunction&lt;T&gt;</a> &gt;&amp; <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera9">getFunction</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
15200203 <span class="keyword">        </span>{
15300204             <span class="keywordflow">return</span> mFunc;
15400205         }
15500206
156<a name="l00212"></a><a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera10">00212</a>         <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1Controller.html#Ogre_1_1Controllera10">update</a>(<span class="keywordtype">void</span>)
15700213         {
15800214             <span class="keywordflow">if</span>(mEnabled)
15900215                 mDest-&gt;setValue(mFunc-&gt;calculate(mSource-&gt;getValue()));
16000216         }
16100217
16200218     };
16300219
16400220
16500221 }
16600222
16700223 <span class="preprocessor">#endif</span>
168</pre></div><hr>
169<p>
170Copyright &copy; 2000-2005 by The OGRE Team<br />
171<!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><br/>
172This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>.<br/>
173                <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
174                <Work rdf:about="">
175                        <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" />
176        <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
177                </Work>
178                <License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> -->
179
180Last modified Sun Mar 12 14:37:39 2006
181</p>
182</body>
183</html>
Note: See TracBrowser for help on using the repository browser.