source: OGRE/trunk/ogrenew/Docs/api/html/OgreProgressiveMesh_8h-source.html @ 657

Revision 657, 20.2 KB checked in by mattausch, 18 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1<html>
2<head>
3<title>OgreProgressiveMesh.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>OgreProgressiveMesh.h</h1><a href="OgreProgressiveMesh_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="comment">// The underlying algorithms in this class are based heavily on:</span>
3500026 <span class="comment">/*</span>
3600027 <span class="comment"> *  Progressive Mesh type Polygon Reduction Algorithm</span>
3700028 <span class="comment"> *  by Stan Melax (c) 1998</span>
3800029 <span class="comment"> */</span>
3900030
4000031 <span class="preprocessor">#ifndef __ProgressiveMesh_H_</span>
4100032 <span class="preprocessor"></span><span class="preprocessor">#define __ProgressiveMesh_H_</span>
4200033 <span class="preprocessor"></span>
4300034 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span>
4400035 <span class="preprocessor">#include "<a class="code" href="OgreVector3_8h.html">OgreVector3.h</a>"</span>
4500036 <span class="preprocessor">#include "<a class="code" href="OgreHardwareVertexBuffer_8h.html">OgreHardwareVertexBuffer.h</a>"</span>
4600037 <span class="preprocessor">#include "<a class="code" href="OgreHardwareIndexBuffer_8h.html">OgreHardwareIndexBuffer.h</a>"</span>
4700038 <span class="preprocessor">#include "<a class="code" href="OgreRenderOperation_8h.html">OgreRenderOperation.h</a>"</span>
4800039
4900040 <span class="keyword">namespace </span>Ogre {
5000041
51<a name="l00055"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html">00055</a>     <span class="keyword">class </span><a class="code" href="OgrePlatform_8h.html#a16">_OgreExport</a> ProgressiveMesh
5200056     {
5300057     <span class="keyword">public</span>:
5400058
55<a name="l00060"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshw3">00060</a>         <span class="keyword">enum</span> VertexReductionQuota
5600061         {
5700063             VRQ_CONSTANT,
5800065             VRQ_PROPORTIONAL
5900066         };
6000067
61<a name="l00068"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshw0">00068</a>         <span class="keyword">typedef</span> std::vector&lt;IndexData*&gt; <a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshw0">LODFaceList</a>;
6200069
6300077         ProgressiveMesh(<span class="keyword">const</span> <a class="code" href="classOgre_1_1VertexData.html">VertexData</a>* vertexData, <span class="keyword">const</span> <a class="code" href="classOgre_1_1IndexData.html">IndexData</a>* indexData);
6400078         <span class="keyword">virtual</span> ~ProgressiveMesh();
6500079
6600095         <span class="keyword">virtual</span> <span class="keywordtype">void</span> addExtraVertexPositionBuffer(<span class="keyword">const</span> <a class="code" href="classOgre_1_1VertexData.html">VertexData</a>* vertexData);
6700096
6800105         <span class="keyword">virtual</span> <span class="keywordtype">void</span> build(<a class="code" href="namespaceOgre.html#a422">ushort</a> numLevels, <a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshw0">LODFaceList</a>* outList,
6900106             VertexReductionQuota quota = VRQ_PROPORTIONAL, <a class="code" href="namespaceOgre.html#a420">Real</a> reductionValue = 0.5f );
7000107
7100108     <span class="keyword">protected</span>:
72<a name="l00109"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshp0">00109</a>         <span class="keyword">const</span> <a class="code" href="classOgre_1_1VertexData.html">VertexData</a> *mpVertexData;
73<a name="l00110"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshp1">00110</a>         <span class="keyword">const</span> <a class="code" href="classOgre_1_1IndexData.html">IndexData</a> *mpIndexData;
7400111
75<a name="l00112"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshp2">00112</a>         size_t mCurrNumIndexes;
76<a name="l00113"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshp3">00113</a>         size_t mNumCommonVertices;
7700114
7800115         <span class="comment">// Internal classes</span>
7900116         <span class="keyword">class </span><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html">PMTriangle</a>;
8000117         <span class="keyword">class </span><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a>;
8100118
8200119         <span class="keyword">public</span>: <span class="comment">// VC6 hack</span>
8300120
84<a name="l00123"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html">00123</a>         <span class="keyword">class </span><a class="code" href="OgrePlatform_8h.html#a17">_OgrePrivate</a> PMFaceVertex {
8500124         <span class="keyword">public</span>:
86<a name="l00125"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html#Ogre_1_1ProgressiveMesh_1_1PMFaceVertexo0">00125</a>             size_t realIndex;
87<a name="l00126"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html#Ogre_1_1ProgressiveMesh_1_1PMFaceVertexo1">00126</a>             <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a>* commonVertex;
8800127         };
8900128
9000129         <span class="keyword">protected</span>:
9100130
92<a name="l00132"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html">00132</a>         <span class="keyword">class </span><a class="code" href="class__OgrePrivate.html">_OgrePrivate</a> PMTriangle {
9300133         <span class="keyword">public</span>:
9400134             PMTriangle();
9500135             <span class="keywordtype">void</span> setDetails(size_t index, PMFaceVertex *v0, PMFaceVertex *v1, PMFaceVertex *v2);
9600136             <span class="keywordtype">void</span> computeNormal(<span class="keywordtype">void</span>);
9700137             <span class="keywordtype">void</span> replaceVertex(PMFaceVertex *vold, PMFaceVertex *vnew);
9800138             <span class="keywordtype">bool</span> hasCommonVertex(<a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a> *v) <span class="keyword">const</span>;
9900139             <span class="keywordtype">bool</span> hasFaceVertex(PMFaceVertex *v) <span class="keyword">const</span>;
10000140             PMFaceVertex* getFaceVertexFromCommon(<a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a>* commonVert);
10100141             <span class="keywordtype">void</span> notifyRemoved(<span class="keywordtype">void</span>);
10200142
103<a name="l00143"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html#Ogre_1_1ProgressiveMesh_1_1PMTriangleo0">00143</a>             PMFaceVertex* vertex[3]; <span class="comment">// the 3 points that make this tri</span>
104<a name="l00144"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html#Ogre_1_1ProgressiveMesh_1_1PMTriangleo1">00144</a>             <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>   normal;    <span class="comment">// unit vector othogonal to this face</span>
105<a name="l00145"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html#Ogre_1_1ProgressiveMesh_1_1PMTriangleo2">00145</a>             <span class="keywordtype">bool</span>      removed;   <span class="comment">// true if this tri is now removed</span>
106<a name="l00146"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html#Ogre_1_1ProgressiveMesh_1_1PMTriangleo3">00146</a>             size_t index;
10700147         };
10800148
109<a name="l00155"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">00155</a>         <span class="keyword">class </span><a class="code" href="class__OgrePrivate.html">_OgrePrivate</a> PMVertex {
11000156         <span class="keyword">public</span>:
11100157             PMVertex();
11200158             <span class="keywordtype">void</span> setDetails(<span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>&amp; v, size_t index);
11300159             <span class="keywordtype">void</span> removeIfNonNeighbor(PMVertex *n);
11400160             <span class="keywordtype">bool</span> isBorder(<span class="keywordtype">void</span>);
11500161             <span class="keywordtype">bool</span> isManifoldEdgeWith(PMVertex* v); <span class="comment">// is edge this-&gt;src a manifold edge?</span>
11600162             <span class="keywordtype">void</span> notifyRemoved(<span class="keywordtype">void</span>);
11700163
118<a name="l00164"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexo0">00164</a>             <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>  position;  <span class="comment">// location of point in euclidean space</span>
119<a name="l00165"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexo1">00165</a>             size_t index;       <span class="comment">// place of vertex in original list</span>
120<a name="l00166"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexw0">00166</a>             <span class="keyword">typedef</span> std::set&lt;PMVertex *&gt; <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexw0">NeighborList</a>;
121<a name="l00167"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexw1">00167</a>             <span class="keyword">typedef</span> std::set&lt;PMVertex *&gt; <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexw1">DuplicateList</a>;
122<a name="l00168"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexo2">00168</a>             <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexw0">NeighborList</a> neighbor; <span class="comment">// adjacent vertices</span>
123<a name="l00169"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexw2">00169</a>             <span class="keyword">typedef</span> std::set&lt;PMTriangle *&gt; <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexw2">FaceList</a>;
124<a name="l00170"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexo3">00170</a>             <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexw2">FaceList</a> face;     <span class="comment">// adjacent triangles</span>
12500171
126<a name="l00172"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexo4">00172</a>             <a class="code" href="namespaceOgre.html#a420">Real</a> collapseCost;  <span class="comment">// cached cost of collapsing edge</span>
127<a name="l00173"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexo5">00173</a>             PMVertex * collapseTo; <span class="comment">// candidate vertex for collapse</span>
128<a name="l00174"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexo6">00174</a>             <span class="keywordtype">bool</span>      removed;   <span class="comment">// true if this vert is now removed</span>
129<a name="l00175"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexo7">00175</a>             <span class="keywordtype">bool</span>      toBeRemoved; <span class="comment">// denug</span>
13000176
131<a name="l00177"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexo8">00177</a>             <span class="keywordtype">bool</span> seam; 
13200178
13300179         };
13400180
135<a name="l00181"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx0">00181</a>         <span class="keyword">typedef</span> std::vector&lt;PMTriangle&gt; TriangleList;
136<a name="l00182"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx1">00182</a>         <span class="keyword">typedef</span> std::vector&lt;PMFaceVertex&gt; <a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx1">FaceVertexList</a>;
137<a name="l00183"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx2">00183</a>         <span class="keyword">typedef</span> std::vector&lt;PMVertex&gt; CommonVertexList;
138<a name="l00184"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx3">00184</a>         <span class="keyword">typedef</span> std::vector&lt;Real&gt; <a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx3">WorstCostList</a>;
13900185
140<a name="l00187"></a><a class="code" href="structOgre_1_1ProgressiveMesh_1_1PMWorkingData.html">00187</a>         <span class="keyword">struct </span><a class="code" href="structOgre_1_1ProgressiveMesh_1_1PMWorkingData.html">PMWorkingData</a>
14100188         {
142<a name="l00189"></a><a class="code" href="structOgre_1_1ProgressiveMesh_1_1PMWorkingData.html#Ogre_1_1ProgressiveMesh_1_1PMWorkingDatao0">00189</a>             TriangleList mTriList;
143<a name="l00190"></a><a class="code" href="structOgre_1_1ProgressiveMesh_1_1PMWorkingData.html#Ogre_1_1ProgressiveMesh_1_1PMWorkingDatao1">00190</a>             <a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx1">FaceVertexList</a> mFaceVertList; <span class="comment">// The vertex details referenced by the triangles</span>
144<a name="l00191"></a><a class="code" href="structOgre_1_1ProgressiveMesh_1_1PMWorkingData.html#Ogre_1_1ProgressiveMesh_1_1PMWorkingDatao2">00191</a>             CommonVertexList mVertList; <span class="comment">// The master list of common vertices</span>
14500192         };
14600193
147<a name="l00194"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx4">00194</a>         <span class="keyword">typedef</span> std::vector&lt;PMWorkingData&gt; <a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx4">WorkingDataList</a>;
148<a name="l00196"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshp4">00196</a>         <a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx4">WorkingDataList</a> mWorkingData;
14900197
150<a name="l00199"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshp5">00199</a>         <a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshx3">WorstCostList</a> mWorstCosts;
15100200
15200202         <span class="keywordtype">void</span> addWorkingData(<span class="keyword">const</span> <a class="code" href="classOgre_1_1VertexData.html">VertexData</a>* vertexData, <span class="keyword">const</span> <a class="code" href="classOgre_1_1IndexData.html">IndexData</a>* indexData);
15300203
15400205         <span class="keywordtype">void</span> initialiseEdgeCollapseCosts(<span class="keywordtype">void</span>);
15500207         <a class="code" href="namespaceOgre.html#a420">Real</a> computeEdgeCollapseCost(PMVertex *src, PMVertex *dest);
15600209         <a class="code" href="namespaceOgre.html#a420">Real</a> computeEdgeCostAtVertexForBuffer(WorkingDataList::iterator idata, size_t vertIndex);
15700211         <span class="keywordtype">void</span> computeEdgeCostAtVertex(size_t vertIndex);
15800213         <span class="keywordtype">void</span> computeAllCosts(<span class="keywordtype">void</span>);
15900215         size_t getNextCollapser(<span class="keywordtype">void</span>);
16000217         <span class="keywordtype">void</span> bakeNewLOD(<a class="code" href="classOgre_1_1IndexData.html">IndexData</a>* pData);
16100218
16200225         <span class="keywordtype">void</span> collapse(PMVertex *collapser);
16300226
16400228         <span class="keywordtype">void</span> dumpContents(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>&amp; log);
16500229
16600230
16700231
16800232
16900233
17000234
17100235
17200236
17300237
17400238     };
17500239
17600240
17700241
17800242 }
17900243
18000244 <span class="preprocessor">#endif </span>
181</pre></div><hr>
182<p>
183Copyright &copy; 2000-2005 by The OGRE Team<br />
184<!--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/>
185This 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/>
186                <!--/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#">
187                <Work rdf:about="">
188                        <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" />
189        <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
190                </Work>
191                <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> -->
192
193Last modified Sun Feb 12 12:59:50 2006
194</p>
195</body>
196</html>
Note: See TracBrowser for help on using the repository browser.