<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Crystal Space 1.2.1: csgeom/trimeshlod.h Source File (Crystal Space 1.2.1 Public API Reference)</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="head"> <tr height="59"> <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td> <td class="head"><h2>Public API Reference</h2></td> </tr> <tr height="11"> <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td> </tr> </table> <div class="content"> <!-- Generated by Doxygen 1.5.3 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> <h1>csgeom/trimeshlod.h</h1><a href="trimeshlod_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> Copyright (C) 1998,2001 by Jorrit Tyberghein</span> <a name="l00003"></a>00003 <span class="comment"></span> <a name="l00004"></a>00004 <span class="comment"> This library is free software; you can redistribute it and/or</span> <a name="l00005"></a>00005 <span class="comment"> modify it under the terms of the GNU Library General Public</span> <a name="l00006"></a>00006 <span class="comment"> License as published by the Free Software Foundation; either</span> <a name="l00007"></a>00007 <span class="comment"> version 2 of the License, or (at your option) any later version.</span> <a name="l00008"></a>00008 <span class="comment"></span> <a name="l00009"></a>00009 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00010"></a>00010 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00011"></a>00011 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00012"></a>00012 <span class="comment"> Library General Public License for more details.</span> <a name="l00013"></a>00013 <span class="comment"></span> <a name="l00014"></a>00014 <span class="comment"> You should have received a copy of the GNU Library General Public</span> <a name="l00015"></a>00015 <span class="comment"> License along with this library; if not, write to the Free</span> <a name="l00016"></a>00016 <span class="comment"> Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span> <a name="l00017"></a>00017 <span class="comment">*/</span> <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="preprocessor">#ifndef __CS_TRIMESHLOD_H__</span> <a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define __CS_TRIMESHLOD_H__</span> <a name="l00021"></a>00021 <span class="preprocessor"></span> <a name="l00022"></a>00022 <span class="preprocessor">#include "csextern.h"</span> <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="csgeom_2trimesh_8h.html" title="Triangle mesh.">csgeom/trimesh.h</a>"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="list_8h.html" title="Double-linked list.">csutil/list.h</a>"</span> <a name="l00026"></a>00026 <a name="l00033"></a>00033 <span class="keyword">class </span><a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a>; <a name="l00034"></a>00034 <a name="l00040"></a><a class="code" href="classcsTriangleVertexCost.html">00040</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsTriangleVertexCost.html" title="The representation of a vertex in a triangle mesh.">csTriangleVertexCost</a> : <span class="keyword">public</span> <a class="code" href="classcsTriangleVertex.html" title="The representation of a vertex in a triangle mesh.">csTriangleVertex</a> <a name="l00041"></a>00041 { <a name="l00042"></a>00042 <span class="keyword">public</span>: <a name="l00044"></a><a class="code" href="classcsTriangleVertexCost.html#935f3057b4e43faf96ec78a65d52c067">00044</a> <span class="keywordtype">bool</span> deleted; <a name="l00045"></a>00045 <a name="l00047"></a><a class="code" href="classcsTriangleVertexCost.html#d3d808e340f4a8d97de41e20646d0625">00047</a> <span class="keywordtype">float</span> cost; <a name="l00049"></a><a class="code" href="classcsTriangleVertexCost.html#0b9ea968612e35eb27d338a1c10d318c">00049</a> <span class="keywordtype">int</span> to_vertex; <a name="l00050"></a>00050 <a name="l00052"></a><a class="code" href="classcsTriangleVertexCost.html#e73e8a7c0b85a925b48ec18ab7c2766b">00052</a> <a class="code" href="classcsTriangleVertexCost.html" title="The representation of a vertex in a triangle mesh.">csTriangleVertexCost</a> () : deleted (false) { } <a name="l00054"></a><a class="code" href="classcsTriangleVertexCost.html#9fa32db84bcae9630abc01a54f5fa455">00054</a> ~<a class="code" href="classcsTriangleVertexCost.html" title="The representation of a vertex in a triangle mesh.">csTriangleVertexCost</a> () { } <a name="l00056"></a>00056 <span class="keywordtype">bool</span> DelVertex (<span class="keywordtype">int</span> idx); <a name="l00058"></a>00058 <span class="keywordtype">void</span> ReplaceVertex (<span class="keywordtype">int</span> old, <span class="keywordtype">int</span> replace); <a name="l00059"></a>00059 }; <a name="l00060"></a>00060 <a name="l00064"></a><a class="code" href="classcsTriangleLODAlgo.html">00064</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsTriangleLODAlgo.html" title="Algorithm class that calculates the cost of a vertex.">csTriangleLODAlgo</a> <a name="l00065"></a>00065 { <a name="l00066"></a>00066 <span class="keyword">public</span>: <a name="l00067"></a><a class="code" href="classcsTriangleLODAlgo.html#ec48ec4db7eecd028c688d0450778d25">00067</a> <span class="keyword">virtual</span> ~<a class="code" href="classcsTriangleLODAlgo.html" title="Algorithm class that calculates the cost of a vertex.">csTriangleLODAlgo</a> () { } <a name="l00068"></a>00068 <a name="l00073"></a>00073 <span class="keyword">virtual</span> <span class="keywordtype">void</span> CalculateCost (<a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a>* vertices, <a name="l00074"></a>00074 <a class="code" href="classcsTriangleVertexCost.html" title="The representation of a vertex in a triangle mesh.">csTriangleVertexCost</a>* vertex) = 0; <a name="l00075"></a>00075 }; <a name="l00076"></a>00076 <a name="l00082"></a><a class="code" href="classcsTriangleLODAlgoEdge.html">00082</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsTriangleLODAlgoEdge.html" title="This subclass of csTriangleLODAlgo uses a very simple cost metric to calculate the...">csTriangleLODAlgoEdge</a> : <span class="keyword">public</span> <a class="code" href="classcsTriangleLODAlgo.html" title="Algorithm class that calculates the cost of a vertex.">csTriangleLODAlgo</a> <a name="l00083"></a>00083 { <a name="l00084"></a>00084 <span class="keyword">public</span>: <a name="l00085"></a><a class="code" href="classcsTriangleLODAlgoEdge.html#23aba3f30ebd1771f5d2eda96b12e84a">00085</a> <span class="keyword">virtual</span> ~<a class="code" href="classcsTriangleLODAlgoEdge.html" title="This subclass of csTriangleLODAlgo uses a very simple cost metric to calculate the...">csTriangleLODAlgoEdge</a> () { } <a name="l00086"></a>00086 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classcsTriangleLODAlgo.html#d6a0f97c8544c975cefa8185b778b03e" title="Calculate the minimal cost of collapsing this vertex to some other.">CalculateCost</a> (<a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a>* vertices, <a name="l00087"></a>00087 <a class="code" href="classcsTriangleVertexCost.html" title="The representation of a vertex in a triangle mesh.">csTriangleVertexCost</a>* vertex); <a name="l00088"></a>00088 }; <a name="l00089"></a>00089 <a name="l00094"></a><a class="code" href="classcsTriangleVerticesSorted.html">00094</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsTriangleVerticesSorted.html" title="This class works closely with csTriangleVerticesCost and maintains a sorted (on cost)...">csTriangleVerticesSorted</a> <a name="l00095"></a>00095 { <a name="l00096"></a>00096 <span class="keyword">private</span>: <a name="l00097"></a>00097 <span class="keywordtype">int</span> num_vertices; <a name="l00098"></a>00098 <a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a>* vertices; <a name="l00099"></a>00099 <a class="code" href="classcsTriangleVertexCost.html" title="The representation of a vertex in a triangle mesh.">csTriangleVertexCost</a>* verts; <a name="l00100"></a>00100 <a name="l00101"></a>00101 <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList<int></a> sorted_list; <a name="l00102"></a>00102 <a class="code" href="classcsList.html" title="A lightweight double-linked list template.">csList<int>::Iterator</a>* entry_per_vertex; <a name="l00103"></a>00103 <a name="l00104"></a>00104 <span class="keyword">public</span>: <a name="l00105"></a>00105 <a class="code" href="classcsTriangleVerticesSorted.html" title="This class works closely with csTriangleVerticesCost and maintains a sorted (on cost)...">csTriangleVerticesSorted</a> (<a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a>* vertices); <a name="l00106"></a>00106 ~<a class="code" href="classcsTriangleVerticesSorted.html" title="This class works closely with csTriangleVerticesCost and maintains a sorted (on cost)...">csTriangleVerticesSorted</a> (); <a name="l00107"></a>00107 <a name="l00114"></a>00114 <span class="keywordtype">int</span> GetLowestCostVertex (); <a name="l00115"></a>00115 <a name="l00120"></a>00120 <span class="keywordtype">void</span> ChangeCostVertex (<span class="keywordtype">int</span> vtidx); <a name="l00121"></a>00121 }; <a name="l00122"></a>00122 <a name="l00129"></a><a class="code" href="classcsTriangleVerticesCost.html">00129</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a> <a name="l00130"></a>00130 { <a name="l00131"></a>00131 <span class="keyword">private</span>: <a name="l00132"></a>00132 <a class="code" href="classcsTriangleVertexCost.html" title="The representation of a vertex in a triangle mesh.">csTriangleVertexCost</a>* vertices; <a name="l00133"></a>00133 <span class="keywordtype">int</span> num_vertices; <a name="l00134"></a>00134 <a name="l00135"></a>00135 <span class="keyword">public</span>: <a name="l00144"></a>00144 <a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a> (<a class="code" href="classcsTriangleMesh.html" title="A mesh of triangles.">csTriangleMesh</a>* mesh, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>* verts, <a name="l00145"></a>00145 <span class="keywordtype">int</span> num_verts); <a name="l00147"></a>00147 ~<a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a> (); <a name="l00152"></a>00152 <span class="keywordtype">void</span> UpdateVertices (<a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>* verts); <a name="l00153"></a>00153 <a name="l00155"></a><a class="code" href="classcsTriangleVerticesCost.html#b5b017818f96336072e145125fa76949">00155</a> <span class="keywordtype">int</span> GetVertexCount ()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> num_vertices; } <a name="l00157"></a><a class="code" href="classcsTriangleVerticesCost.html#7609ffd04d482ab2c040bbc2df5fb2be">00157</a> <a class="code" href="classcsTriangleVertexCost.html" title="The representation of a vertex in a triangle mesh.">csTriangleVertexCost</a>* GetVertices ()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> vertices; } <a name="l00159"></a><a class="code" href="classcsTriangleVerticesCost.html#babc45298b2ba69339d5efe66cc781a3">00159</a> <a class="code" href="classcsTriangleVertexCost.html" title="The representation of a vertex in a triangle mesh.">csTriangleVertexCost</a>& GetVertex (<span class="keywordtype">int</span> idx) { <span class="keywordflow">return</span> vertices[idx]; } <a name="l00160"></a>00160 <a name="l00162"></a>00162 <span class="keywordtype">void</span> CalculateCost (<a class="code" href="classcsTriangleLODAlgo.html" title="Algorithm class that calculates the cost of a vertex.">csTriangleLODAlgo</a>* lodalgo); <a name="l00163"></a>00163 <a name="l00165"></a>00165 <span class="keywordtype">int</span> GetMinimalCostVertex (<span class="keywordtype">float</span>& min_cost); <a name="l00166"></a>00166 <a name="l00170"></a>00170 <a class="code" href="classcsTriangleVerticesSorted.html" title="This class works closely with csTriangleVerticesCost and maintains a sorted (on cost)...">csTriangleVerticesSorted</a>* SortVertices (); <a name="l00171"></a>00171 <a name="l00173"></a>00173 <span class="keywordtype">void</span> Dump (); <a name="l00174"></a>00174 }; <a name="l00175"></a>00175 <a name="l00180"></a><a class="code" href="classcsTriangleMeshLOD.html">00180</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsTriangleMeshLOD.html" title="A static class which performs the calculation of the best order to do the collapsing...">csTriangleMeshLOD</a> <a name="l00181"></a>00181 { <a name="l00182"></a>00182 <span class="keyword">public</span>: <a name="l00203"></a>00203 <span class="keyword">static</span> <span class="keywordtype">void</span> CalculateLOD (<a class="code" href="classcsTriangleMesh.html" title="A mesh of triangles.">csTriangleMesh</a>* mesh, <a name="l00204"></a>00204 <a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a>* verts, <a name="l00205"></a>00205 <span class="keywordtype">int</span>* translate, <span class="keywordtype">int</span>* emerge_from, <a class="code" href="classcsTriangleLODAlgo.html" title="Algorithm class that calculates the cost of a vertex.">csTriangleLODAlgo</a>* lodalgo); <a name="l00206"></a>00206 <a name="l00222"></a>00222 <span class="keyword">static</span> <a class="code" href="structcsTriangle.html" title="A triangle.">csTriangle</a>* CalculateLOD (<a class="code" href="classcsTriangleMesh.html" title="A mesh of triangles.">csTriangleMesh</a>* mesh, <a name="l00223"></a>00223 <a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a>* verts, <span class="keywordtype">float</span> max_cost, <span class="keywordtype">int</span>& num_triangles, <a name="l00224"></a>00224 <a class="code" href="classcsTriangleLODAlgo.html" title="Algorithm class that calculates the cost of a vertex.">csTriangleLODAlgo</a>* lodalgo); <a name="l00225"></a>00225 <a name="l00241"></a>00241 <span class="keyword">static</span> <a class="code" href="structcsTriangle.html" title="A triangle.">csTriangle</a>* CalculateLODFast (<a class="code" href="classcsTriangleMesh.html" title="A mesh of triangles.">csTriangleMesh</a>* mesh, <a name="l00242"></a>00242 <a class="code" href="classcsTriangleVerticesCost.html" title="A class which holds vertices and connectivity information for a triangle mesh.">csTriangleVerticesCost</a>* verts, <span class="keywordtype">float</span> max_cost, <span class="keywordtype">int</span>& num_triangles, <a name="l00243"></a>00243 <a class="code" href="classcsTriangleLODAlgo.html" title="Algorithm class that calculates the cost of a vertex.">csTriangleLODAlgo</a>* lodalgo); <a name="l00244"></a>00244 }; <a name="l00245"></a>00245 <a name="l00248"></a>00248 <span class="preprocessor">#endif // __CS_TRIMESHLOD_H__</span> </pre></div><hr size="1"><address><small>Generated for Crystal Space 1.2.1 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 </small></address> </div></body> </html>