Sophie

Sophie

distrib > Mandriva > 10.2 > i586 > media > contrib > by-pkgid > 04e5d8c10ae76748689b4e7f48e0fa33 > files > 708

libogre5-devel-1.0.0-1mdk.i586.rpm

<html>
<head>
<title>OgreProgressiveMesh.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<link type="text/css" rel="stylesheet" href="style.css">
</head>

<body>
<!-- Generated by Doxygen 1.3.6 -->
<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>
<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>
00002 <span class="comment">-----------------------------------------------------------------------------</span>
00003 <span class="comment">This source file is part of OGRE</span>
00004 <span class="comment">    (Object-oriented Graphics Rendering Engine)</span>
00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span>
00006 <span class="comment"></span>
00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span>
00008 <span class="comment">Also see acknowledgements in Readme.html</span>
00009 <span class="comment"></span>
00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span>
00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span>
00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span>
00013 <span class="comment">version.</span>
00014 <span class="comment"></span>
00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span>
00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span>
00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span>
00018 <span class="comment"></span>
00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span>
00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span>
00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span>
00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span>
00023 <span class="comment">-----------------------------------------------------------------------------</span>
00024 <span class="comment">*/</span>
00025 <span class="comment">// The underlying algorithms in this class are based heavily on:</span>
00026 <span class="comment">/*</span>
00027 <span class="comment"> *  Progressive Mesh type Polygon Reduction Algorithm</span>
00028 <span class="comment"> *  by Stan Melax (c) 1998</span>
00029 <span class="comment"> */</span>
00030 
00031 <span class="preprocessor">#ifndef __ProgressiveMesh_H_</span>
00032 <span class="preprocessor"></span><span class="preprocessor">#define __ProgressiveMesh_H_</span>
00033 <span class="preprocessor"></span>
00034 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span>
00035 <span class="preprocessor">#include "<a class="code" href="OgreVector3_8h.html">OgreVector3.h</a>"</span>
00036 <span class="preprocessor">#include "<a class="code" href="OgreHardwareVertexBuffer_8h.html">OgreHardwareVertexBuffer.h</a>"</span>
00037 <span class="preprocessor">#include "<a class="code" href="OgreHardwareIndexBuffer_8h.html">OgreHardwareIndexBuffer.h</a>"</span>
00038 <span class="preprocessor">#include "<a class="code" href="OgreRenderOperation_8h.html">OgreRenderOperation.h</a>"</span>
00039 
00040 <span class="keyword">namespace </span>Ogre {
00041 
<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#a13">_OgreExport</a> ProgressiveMesh
00056     {
00057     <span class="keyword">public</span>:
00058 
<a name="l00060"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshw3">00060</a>         <span class="keyword">enum</span> VertexReductionQuota
00061         {
00063             VRQ_CONSTANT,
00065             VRQ_PROPORTIONAL
00066         };
00067 
<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>;
00069 
00077         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);
00078         <span class="keyword">virtual</span> ~ProgressiveMesh();
00079 
00095         <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);
00096 
00105         <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, 
00106             VertexReductionQuota quota = VRQ_PROPORTIONAL, <a class="code" href="namespaceOgre.html#a420">Real</a> reductionValue = 0.5f );
00107 
00108     <span class="keyword">protected</span>:
<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;
<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;
00111 
<a name="l00112"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshp2">00112</a>         size_t mCurrNumIndexes;
<a name="l00113"></a><a class="code" href="classOgre_1_1ProgressiveMesh.html#Ogre_1_1ProgressiveMeshp3">00113</a>         size_t mNumCommonVertices;
00114 
00115         <span class="comment">// Internal classes</span>
00116         <span class="keyword">class </span><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html">PMTriangle</a>;
00117         <span class="keyword">class </span><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a>;
00118 
00119         <span class="keyword">public</span>: <span class="comment">// VC6 hack</span>
00120 
<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="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html">PMFaceVertex</a> {
00124         <span class="keyword">public</span>:
<a name="l00125"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html#Ogre_1_1ProgressiveMesh_1_1PMFaceVertexo0">00125</a>             size_t realIndex;
<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;
00127         };
00128 
00129         <span class="keyword">protected</span>:
00130 
<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="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html">PMTriangle</a> {
00133         <span class="keyword">public</span>:
00134             <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html">PMTriangle</a>();
00135             <span class="keywordtype">void</span> setDetails(size_t index, <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html">PMFaceVertex</a> *v0, <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html">PMFaceVertex</a> *v1, <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html">PMFaceVertex</a> *v2);
00136             <span class="keywordtype">void</span> computeNormal(<span class="keywordtype">void</span>);
00137             <span class="keywordtype">void</span> replaceVertex(<a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html">PMFaceVertex</a> *vold, <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html">PMFaceVertex</a> *vnew);
00138             <span class="keywordtype">bool</span> hasCommonVertex(<a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a> *v) <span class="keyword">const</span>;
00139             <span class="keywordtype">bool</span> hasFaceVertex(<a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html">PMFaceVertex</a> *v) <span class="keyword">const</span>;
00140             <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html">PMFaceVertex</a>* getFaceVertexFromCommon(<a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a>* commonVert);
00141             <span class="keywordtype">void</span> notifyRemoved(<span class="keywordtype">void</span>);
00142 
<a name="l00143"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html#Ogre_1_1ProgressiveMesh_1_1PMTriangleo0">00143</a>             <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMFaceVertex.html">PMFaceVertex</a>* vertex[3]; <span class="comment">// the 3 points that make this tri</span>
<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>
<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>
<a name="l00146"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMTriangle.html#Ogre_1_1ProgressiveMesh_1_1PMTriangleo3">00146</a>             size_t index;
00147         };
00148 
<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="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a> {
00156         <span class="keyword">public</span>:
00157             <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a>();
00158             <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);
00159             <span class="keywordtype">void</span> removeIfNonNeighbor(<a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a> *n);
00160             <span class="keywordtype">bool</span> isBorder(<span class="keywordtype">void</span>);
00161             <span class="keywordtype">bool</span> isManifoldEdgeWith(<a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a>* v); <span class="comment">// is edge this-&gt;src a manifold edge?</span>
00162             <span class="keywordtype">void</span> notifyRemoved(<span class="keywordtype">void</span>);
00163 
<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>
<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>
<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>;
<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>;
<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>
<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>;
<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>
00171 
<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>
<a name="l00173"></a><a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html#Ogre_1_1ProgressiveMesh_1_1PMVertexo5">00173</a>             <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a> * collapseTo; <span class="comment">// candidate vertex for collapse</span>
<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>
<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>
00176 
<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;  
00178 
00179         };
00180 
<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;
<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>;
<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;
<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>;
00185 
<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>
00188         {
<a name="l00189"></a><a class="code" href="structOgre_1_1ProgressiveMesh_1_1PMWorkingData.html#Ogre_1_1ProgressiveMesh_1_1PMWorkingDatao0">00189</a>             TriangleList mTriList; 
<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>
<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>
00192         };
00193 
<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>;
<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;
00197 
<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;
00200 
00202         <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);
00203 
00205         <span class="keywordtype">void</span> initialiseEdgeCollapseCosts(<span class="keywordtype">void</span>);
00207         <a class="code" href="namespaceOgre.html#a420">Real</a> computeEdgeCollapseCost(<a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a> *src, <a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a> *dest);
00209         <a class="code" href="namespaceOgre.html#a420">Real</a> computeEdgeCostAtVertexForBuffer(WorkingDataList::iterator idata, size_t vertIndex);
00211         <span class="keywordtype">void</span> computeEdgeCostAtVertex(size_t vertIndex);
00213         <span class="keywordtype">void</span> computeAllCosts(<span class="keywordtype">void</span>);
00215         size_t getNextCollapser(<span class="keywordtype">void</span>);
00217         <span class="keywordtype">void</span> bakeNewLOD(<a class="code" href="classOgre_1_1IndexData.html">IndexData</a>* pData);
00218 
00225         <span class="keywordtype">void</span> collapse(<a class="code" href="classOgre_1_1ProgressiveMesh_1_1PMVertex.html">PMVertex</a> *collapser);
00226 
00228         <span class="keywordtype">void</span> dumpContents(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>&amp; log);
00229 
00230 
00231 
00232 
00233 
00234 
00235 
00236 
00237 
00238     };
00239 
00240 
00241 
00242 }
00243 
00244 <span class="preprocessor">#endif </span>
</pre></div><p>
Copyright &copy; 2000-2005 by The OGRE Team<br />
Last modified Wed Feb 23 00:19:11 2005
</p>
</body>
</html>