diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a03762.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/a03762.html')
-rw-r--r-- | docs/doxygen/nel/a03762.html | 1670 |
1 files changed, 1670 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03762.html b/docs/doxygen/nel/a03762.html new file mode 100644 index 00000000..b8dbeff7 --- /dev/null +++ b/docs/doxygen/nel/a03762.html @@ -0,0 +1,1670 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NL3D::CZoneSymmetrisation class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NL3D::CZoneSymmetrisation Class Reference</h1><code>#include <<a class="el" href="a06779.html">zone_symmetrisation.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Environnement used to symmetrise zones<p> +This class build symmetry specific informations needed to know how transform tiles when a zone is symmetrise.<p> +There is two states for a tile : Regular or Goofy. If the tile is regular, it doesn't need specific transformation when the zone is symmetrise. If the tile is goofy, the tile must be rotate by 180deg more to be correct.<p> +<dl compact><dt><b>Author:</b></dt><dd>Cyril 'Hulud' Corvazier <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2002 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a06779.html#l00054">54</a> of file <a class="el" href="a06779.html">zone_symmetrisation.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> { <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a> = 0, +<a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a> = 1, +<a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0">Goofy</a> = 2 + }</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Symmetrie state. <a href="#NL3D_1_1CZoneSymmetrisationw3">More...</a><br><br></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationa0">build</a> (const std::vector< <a class="el" href="a03066.html">CPatchInfo</a> > &patchInfo, float snapCell, float weldThreshold, const <a class="el" href="a03517.html">CTileBank</a> &bank, <a class="el" href="a03763.html">CError</a> &errorDesc, const <a class="el" href="a02851.html">NLMISC::CMatrix</a> &toOriginalSpace)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationa1">CZoneSymmetrisation</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NL3D_1_1CZoneSymmetrisationa1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationa2">getOrientedTileBorderState</a> (<a class="el" href="a04558.html#a15">uint</a> patch, <a class="el" href="a04558.html#a15">uint</a> tile) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationa3">getOrientedTileCorner</a> (<a class="el" href="a04558.html#a15">uint</a> patch, <a class="el" href="a04558.html#a15">uint</a> tile)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationa4">getTileBorderState</a> (<a class="el" href="a04558.html#a15">uint</a> patch, <a class="el" href="a04558.html#a15">uint</a> tile) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationa5">getTileState</a> (<a class="el" href="a04558.html#a15">uint</a> patch, <a class="el" href="a04558.html#a15">uint</a> tile, <a class="el" href="a04558.html#a15">uint</a> layer) const </td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationd0">propagateTileState</a> (<a class="el" href="a04558.html#a15">uint</a> i, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a626">s</a>, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a627">t</a>, const std::vector< <a class="el" href="a03066.html">CPatchInfo</a> > &patchInfo, const <a class="el" href="a03517.html">CTileBank</a> &bank, bool forceRegular)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationd1">setOrientedTileBorderState</a> (<a class="el" href="a04558.html#a15">uint</a> patch, <a class="el" href="a04558.html#a15">uint</a> tile, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> state)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationd2">setOrientedTileCorner</a> (<a class="el" href="a04558.html#a15">uint</a> patch, <a class="el" href="a04558.html#a15">uint</a> tile, bool corner)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationd3">setOrientedTileState</a> (const <a class="el" href="a03066.html">NL3D::CPatchInfo</a> &patch, <a class="el" href="a04558.html#a15">uint</a> patchId, float snapCell, float weldThreshold, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> &state, const <a class="el" href="a02851.html">NLMISC::CMatrix</a> &toOriginalSpace, const <a class="el" href="a03517.html">CTileBank</a> &bank)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationd4">setTileBorderState</a> (<a class="el" href="a04558.html#a15">uint</a> patch, <a class="el" href="a04558.html#a15">uint</a> tile, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> state)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationd5">setTileState</a> (const <a class="el" href="a03066.html">NL3D::CPatchInfo</a> &patch, <a class="el" href="a04558.html#a15">uint</a> patchId, float snapCell, float weldThreshold, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> &state, const <a class="el" href="a02851.html">NLMISC::CMatrix</a> &toOriginalSpace, const <a class="el" href="a03517.html">CTileBank</a> &bank)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationd6">setTileState</a> (<a class="el" href="a04558.html#a15">uint</a> patch, <a class="el" href="a04558.html#a15">uint</a> tile, <a class="el" href="a04558.html#a15">uint</a> layer, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> state)</td></tr> + +<tr><td colspan=2><br><h2>Static Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationh0">snapOnGrid</a> (float &<a class="el" href="a04223.html#a658">value</a>, float resolution, float snap)</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< std::vector<<br> + <a class="el" href="a04558.html#a9">uint16</a> > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationr0">_TilesLayerStates</a></td></tr> + +</table> +<hr><h2>Member Enumeration Documentation</h2> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationw3" doxytag="NL3D::CZoneSymmetrisation::TState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> enum <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">NL3D::CZoneSymmetrisation::TState</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Symmetrie state. +<p> +<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1" doxytag="Nothing" ></a>Nothing</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2" doxytag="Regular" ></a>Regular</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0" doxytag="Goofy" ></a>Goofy</em> </td><td> +</td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a06779.html#l00059">59</a> of file <a class="el" href="a06779.html">zone_symmetrisation.h</a>. +<p> +<div class="fragment"><pre>00060 { +00061 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a> =0, +00062 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a> =1, +00063 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0">Goofy</a> =2, +00064 }; +</pre></div> </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationa1" doxytag="NL3D::CZoneSymmetrisation::CZoneSymmetrisation" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NL3D::CZoneSymmetrisation::CZoneSymmetrisation </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Constructor. +<p> + +<p> +Definition at line <a class="el" href="a06778.html#l00039">39</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +<div class="fragment"><pre>00040 { +00041 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationa0" doxytag="NL3D::CZoneSymmetrisation::build" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CZoneSymmetrisation::build </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::vector< <a class="el" href="a03066.html">CPatchInfo</a> > & </td> + <td class="mdname" nowrap> <em>patchInfo</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>snapCell</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>weldThreshold</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03517.html">CTileBank</a> & </td> + <td class="mdname" nowrap> <em>bank</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03763.html">CError</a> & </td> + <td class="mdname" nowrap> <em>errorDesc</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02851.html">NLMISC::CMatrix</a> & </td> + <td class="mdname" nowrap> <em>toOriginalSpace</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Build symmetry informations<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>zone</em> </td><td>is the zone to build symmetry informations </td></tr> + <tr><td valign=top><em>snapCell</em> </td><td>is the unit size of the zones </td></tr> + <tr><td valign=top><em>weldThreshold</em> </td><td>is the threshold used to check vertex over snaped positions </td></tr> + <tr><td valign=top><em>errorDesc</em> </td><td>is a structure used to return errors </td></tr> + <tr><td valign=top><em>toOriginalSpace</em> </td><td>is the matrix used to transform back a vertex in its original position before symmetry / rotation </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>false if the patch topology is invalid for this operations</dd></dl> + +<p> +Definition at line <a class="el" href="a06778.html#l00186">186</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06779.html#l00158">_TilesLayerStates</a>, <a class="el" href="a06779.html#l00070">NL3D::CZoneSymmetrisation::CError::Errors</a>, <a class="el" href="a06760.html#l00122">NL3D::CPatchInfo::OrderS</a>, <a class="el" href="a06760.html#l00122">NL3D::CPatchInfo::OrderT</a>, <a class="el" href="a06778.html#l00670">propagateTileState()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a06778.html#l00472">setOrientedTileState()</a>, <a class="el" href="a06778.html#l00086">setTileState()</a>, <a class="el" href="a05646.html#l00985">t</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06758.html#l01825">NL3D::CPatchInfo::transform()</a>. +<p> +<div class="fragment"><pre>00187 { +00188 <span class="comment">// * Clear errors</span> +00189 errorDesc.Errors.clear (); +00190 +00191 <span class="comment">// * Build the patches state</span> +00192 +00193 <span class="comment">// A) Resize arrays</span> +00194 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationr0">_TilesLayerStates</a>.resize (patchInfo.size ()); +00195 +00196 <span class="comment">// D) Resize the tile array</span> +00197 <a class="code" href="a04558.html#a15">uint</a> i; +00198 <span class="keywordflow">for</span> (i=0; i<patchInfo.size (); i++) +00199 { +00200 <span class="comment">// Ref on the patch</span> +00201 <span class="keyword">const</span> CPatchInfo &patch = patchInfo[i]; +00202 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationr0">_TilesLayerStates</a>[i].resize (0); +00203 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationr0">_TilesLayerStates</a>[i].resize (patch.OrderS * patch.OrderT, 0); +00204 } +00205 +00206 <span class="comment">// B), C) and E) We need to select patches having an open edge on the zone border. To do so, we use the snapCell and weldThreshold parameters</span> +00207 <span class="keywordflow">for</span> (i=0; i<patchInfo.size (); i++) +00208 { +00209 <span class="comment">// Ref on the patch</span> +00210 <span class="keyword">const</span> CPatchInfo &patch = patchInfo[i]; +00211 +00212 <span class="comment">// Does this patch is over a border ?</span> +00213 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> patchState; +00214 <span class="keywordflow">if</span> (!<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd6">setTileState</a> (patch, i, snapCell, weldThreshold, patchState, toOriginalSpace, bank)) +00215 { +00216 <span class="comment">// Push an error</span> +00217 errorDesc.Errors.push_back (<span class="stringliteral">"Patch nb "</span>+toString (i)+<span class="stringliteral">" is invalid"</span>); +00218 } +00219 +00220 <span class="comment">// Set the oriented patch state</span> +00221 <span class="keywordflow">if</span> (!<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd3">setOrientedTileState</a> (patch, i, snapCell, weldThreshold, patchState, toOriginalSpace, bank)) +00222 { +00223 <span class="comment">// Push an error</span> +00224 errorDesc.Errors.push_back (<span class="stringliteral">"Patch nb "</span>+toString (i)+<span class="stringliteral">" is invalid"</span>); +00225 } +00226 } +00227 +00228 <span class="comment">// F) We flag each tile on an opened edge using this formula</span> +00229 <span class="comment">// - If the patch is not Nothing do</span> +00230 <span class="comment">// - tileIsGoofy = (patchIsGoofy) XOR ((tileRotation&1) != 0)</span> +00231 <span class="keywordflow">for</span> (i=0; i<patchInfo.size (); i++) +00232 { +00233 <span class="comment">// Ref on the patch</span> +00234 <span class="keyword">const</span> CPatchInfo &patch = patchInfo[i]; +00235 +00236 <span class="comment">// For each tile</span> +00237 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a626">s</a>,<a class="code" href="a04223.html#a627">t</a>; +00238 <span class="keywordflow">for</span> (<a class="code" href="a04223.html#a627">t</a>=0; <a class="code" href="a04223.html#a627">t</a><patch.OrderT; <a class="code" href="a04223.html#a627">t</a>++) +00239 { +00240 <span class="keywordflow">for</span> (<a class="code" href="a04223.html#a626">s</a>=0; <a class="code" href="a04223.html#a626">s</a><patch.OrderS; <a class="code" href="a04223.html#a626">s</a>++) +00241 { +00242 <span class="keywordflow">if</span> (!<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd0">propagateTileState</a> (i, s, t, patchInfo, bank, <span class="keyword">false</span>)) +00243 { +00244 <span class="comment">// Push an error</span> +00245 errorDesc.Errors.push_back (<span class="stringliteral">"Error during propagation. Topology invalid."</span>); +00246 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00247 } +00248 } +00249 } +00250 } +00251 +00252 <span class="comment">// G) Force all remaining Nothing tiles to Regular</span> +00253 <span class="keywordflow">for</span> (i=0; i<patchInfo.size (); i++) +00254 { +00255 <span class="comment">// Ref on the patch</span> +00256 <span class="keyword">const</span> CPatchInfo &patch = patchInfo[i]; +00257 +00258 <span class="comment">// For each tile</span> +00259 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a626">s</a>,<a class="code" href="a04223.html#a627">t</a>; +00260 <span class="keywordflow">for</span> (<a class="code" href="a04223.html#a627">t</a>=0; <a class="code" href="a04223.html#a627">t</a><patch.OrderT; <a class="code" href="a04223.html#a627">t</a>++) +00261 { +00262 <span class="keywordflow">for</span> (<a class="code" href="a04223.html#a626">s</a>=0; <a class="code" href="a04223.html#a626">s</a><patch.OrderS; <a class="code" href="a04223.html#a626">s</a>++) +00263 { +00264 <span class="keywordflow">if</span> (!<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd0">propagateTileState</a> (i, s, t, patchInfo, bank, <span class="keyword">true</span>)) +00265 { +00266 <span class="comment">// Push an error</span> +00267 errorDesc.Errors.push_back (<span class="stringliteral">"Error during propagation. Topology invalid."</span>); +00268 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00269 } +00270 } +00271 } +00272 } +00273 +00274 <span class="comment">// Returns true if no error</span> +00275 <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// errorDesc.Errors.size () == 0;</span> +00276 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationa2" doxytag="NL3D::CZoneSymmetrisation::getOrientedTileBorderState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">CZoneSymmetrisation::TState</a> NL3D::CZoneSymmetrisation::getOrientedTileBorderState </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>tile</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Get tile symmetry state for oriented tiles Can return Regular, Goofy or Nothing. +<p> +Definition at line <a class="el" href="a06778.html#l00072">72</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06778.html#l00057">getTileState()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00073 { +00074 <span class="keywordflow">return</span> <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationa5">getTileState</a> (patch, tile, 4); +00075 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationa3" doxytag="NL3D::CZoneSymmetrisation::getOrientedTileCorner" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CZoneSymmetrisation::getOrientedTileCorner </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>tile</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Set oriented tile corner state +<p> +Definition at line <a class="el" href="a06778.html#l00079">79</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06779.html#l00158">_TilesLayerStates</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06778.html#l00670">propagateTileState()</a>. +<p> +<div class="fragment"><pre>00080 { +00081 <span class="keywordflow">return</span> ( ( <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationr0">_TilesLayerStates</a>[patch][tile] >> 10 ) & 1 ) != 0; +00082 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationa4" doxytag="NL3D::CZoneSymmetrisation::getTileBorderState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">CZoneSymmetrisation::TState</a> NL3D::CZoneSymmetrisation::getTileBorderState </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>tile</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Get tile symmetry state Can return Regular, Goofy or Nothing. +<p> +Definition at line <a class="el" href="a06778.html#l00065">65</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06778.html#l00057">getTileState()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00066 { +00067 <span class="keywordflow">return</span> <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationa5">getTileState</a> (patch, tile, 3); +00068 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationa5" doxytag="NL3D::CZoneSymmetrisation::getTileState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">CZoneSymmetrisation::TState</a> NL3D::CZoneSymmetrisation::getTileState </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>tile</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>layer</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Get tile symmetry state Can return Regular, Goofy or Nothing. +<p> +Definition at line <a class="el" href="a06778.html#l00057">57</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06779.html#l00158">_TilesLayerStates</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06778.html#l00072">getOrientedTileBorderState()</a>, <a class="el" href="a06778.html#l00065">getTileBorderState()</a>, <a class="el" href="a06778.html#l00670">propagateTileState()</a>, and <a class="el" href="a06758.html#l01825">NL3D::CPatchInfo::transform()</a>. +<p> +<div class="fragment"><pre>00058 { +00059 <a class="code" href="a04199.html#a6">nlassert</a> (layer<5); +00060 <span class="keywordflow">return</span> (<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a>)((<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationr0">_TilesLayerStates</a>[patch][tile]>>(layer*2))&0x3); +00061 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationd0" doxytag="NL3D::CZoneSymmetrisation::propagateTileState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CZoneSymmetrisation::propagateTileState </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>i</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>s</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>t</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a03066.html">CPatchInfo</a> > & </td> + <td class="mdname" nowrap> <em>patchInfo</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03517.html">CTileBank</a> & </td> + <td class="mdname" nowrap> <em>bank</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>forceRegular</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Propagate tile state information for a given tile.<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>i</em> </td><td>is the patch number in the zone that contain the tile to propagate </td></tr> + <tr><td valign=top><em>u</em> </td><td>is the tile u coordinate in the patch </td></tr> + <tr><td valign=top><em>v</em> </td><td>is the tile v coordinate in the patch </td></tr> + <tr><td valign=top><em>patchInfo</em> </td><td>is a vector of patch information </td></tr> + <tr><td valign=top><em>bank</em> </td><td>is the tile bank used by the landscape </td></tr> + <tr><td valign=top><em>forceRegular</em> </td><td>must be true to force the first propagated tile to Regular if Nothing </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>false if the patch topology is invalid for this operations true if succesful</dd></dl> + +<p> +Definition at line <a class="el" href="a06778.html#l00670">670</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06760.html#l00108">NL3D::CPatchInfo::CBindInfo::Edge</a>, <a class="el" href="a06778.html#l00663">NL3D::CFillStackNode::Edge</a>, <a class="el" href="a06537.html#l00333">NL3D::CTileSet::getOriented()</a>, <a class="el" href="a06778.html#l00079">getOrientedTileCorner()</a>, <a class="el" href="a06537.html#l00528">NL3D::CTileBank::getTileCount()</a>, <a class="el" href="a06537.html#l00520">NL3D::CTileBank::getTileSet()</a>, <a class="el" href="a06537.html#l00516">NL3D::CTileBank::getTileSetCount()</a>, <a class="el" href="a06778.html#l00057">getTileState()</a>, <a class="el" href="a06537.html#l00560">NL3D::CTileBank::getTileXRef()</a>, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0">Goofy</a>, <a class="el" href="a06760.html#l00106">NL3D::CPatchInfo::CBindInfo::Next</a>, <a class="el" href="a06541.html#l00053">NL_TILE_ELM_LAYER_EMPTY</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a>, <a class="el" href="a06760.html#l00101">NL3D::CPatchInfo::CBindInfo::NPatchs</a>, <a class="el" href="a06760.html#l00122">NL3D::CPatchInfo::OrderS</a>, <a class="el" href="a06778.html#l00662">NL3D::CFillStackNode::Patch</a>, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>, <a class="el" href="a06778.html#l00664">NL3D::CFillStackNode::Rotate</a>, <a class="el" href="a06778.html#l00660">NL3D::CFillStackNode::S</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a06778.html#l00086">setTileState()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06778.html#l00665">NL3D::CFillStackNode::State</a>, <a class="el" href="a06778.html#l00661">NL3D::CFillStackNode::T</a>, <a class="el" href="a05646.html#l00985">t</a>, <a class="el" href="a06760.html#l00149">NL3D::CPatchInfo::Tiles</a>, <a class="el" href="a05646.html#l00244">type</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06778.html#l00186">build()</a>. +<p> +<div class="fragment"><pre>00671 { +00672 <span class="comment">// For each layer</span> +00673 <a class="code" href="a04558.html#a15">uint</a> layer; +00674 <span class="keywordflow">for</span> (layer=0; layer<3; layer++) +00675 { +00676 <span class="comment">// Get the patch ptr</span> +00677 <span class="keyword">const</span> CPatchInfo *currentPatchPtr = &(patchInfo[patch]); +00678 +00679 <span class="comment">// Get the tile index</span> +00680 <a class="code" href="a04558.html#a15">uint</a> tile = <a class="code" href="a04223.html#a626">s</a>+<a class="code" href="a04223.html#a627">t</a>*currentPatchPtr->OrderS; +00681 +00682 <span class="comment">// Get the tiles set used here</span> +00683 <a class="code" href="a04558.html#a15">uint</a> tileIndex = currentPatchPtr->Tiles[tile].Tile[layer]; +00684 <span class="keywordflow">if</span> (tileIndex != <a class="code" href="a05118.html#a12">NL_TILE_ELM_LAYER_EMPTY</a>) +00685 { +00686 <span class="comment">// Valid tile number ?</span> +00687 <span class="keywordflow">if</span> (tileIndex >= (<a class="code" href="a04558.html#a15">uint</a>)bank.getTileCount ()) +00688 { +00689 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"CZoneSymmetrisation::propagateTileState: Invalid tile index"</span>); +00690 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00691 } +00692 +00693 <span class="comment">// Get the tile set used by this layer</span> +00694 <span class="keywordtype">int</span> tileSetToPropagate; +00695 <span class="keywordtype">int</span> number; +00696 CTileBank::TTileType <a class="code" href="a04223.html#a581">type</a>; +00697 bank.getTileXRef (tileIndex, tileSetToPropagate, number, type); +00698 +00699 <span class="keywordflow">if</span> ((tileSetToPropagate < 0) || (tileSetToPropagate >= bank.getTileSetCount())) +00700 { +00701 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"CZoneSymmetrisation::propagateTileState: tile %d has an unknown tileSet (%d)"</span>, tileIndex, tileSetToPropagate); +00702 } +00703 <span class="keywordflow">else</span> +00704 { +00705 <span class="comment">// Oriented ?</span> +00706 <span class="keywordtype">bool</span> oriented = bank.getTileSet (tileSetToPropagate)->getOriented (); +00707 +00708 <span class="comment">// If oriented, must not be a corner</span> +00709 <span class="keywordflow">if</span> (!(oriented && <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationa3">getOrientedTileCorner</a> (patch, tile))) +00710 { +00711 <span class="comment">// Current node</span> +00712 CFillStackNode currentNode (patch, s, t, currentPatchPtr->Tiles[tile].getTileOrient(layer), <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationa5">getTileState</a> (patch, tile, layer)); +00713 +00714 <span class="comment">// Propagate non-Nothing tiles</span> +00715 <span class="keywordflow">if</span> ( (!forceRegular && (currentNode.State != <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a>)) || (forceRegular && (currentNode.State == <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a>)) ) +00716 { +00717 <span class="comment">// Force to Regular ?</span> +00718 <span class="keywordflow">if</span> (forceRegular) +00719 { +00720 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd6">setTileState</a> (patch, tile, layer, Regular); +00721 currentNode.State = <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>; +00722 } +00723 +00724 <span class="comment">// Fill stack</span> +00725 vector<CFillStackNode> stack; +00726 stack.push_back (currentNode); +00727 +00728 <span class="comment">// While people in the stack</span> +00729 <span class="keywordflow">while</span> (!stack.empty ()) +00730 { +00731 <span class="comment">// Pop last element</span> +00732 currentNode = stack.back (); +00733 stack.pop_back (); +00734 +00735 <span class="keywordflow">do</span> +00736 { +00737 <span class="comment">// Set current patch pointer</span> +00738 currentPatchPtr = &(patchInfo[currentNode.Patch]); +00739 +00740 <span class="comment">// Get neighbor</span> +00741 CFillStackNode neighborNode (currentNode.Patch, currentNode.S, currentNode.T, currentNode.Rotate, currentNode.State); +00742 <span class="keywordflow">switch</span> (currentNode.Edge) +00743 { +00744 <span class="keywordflow">case</span> 0: +00745 neighborNode.S--; +00746 <span class="keywordflow">break</span>; +00747 <span class="keywordflow">case</span> 1: +00748 neighborNode.T++; +00749 <span class="keywordflow">break</span>; +00750 <span class="keywordflow">case</span> 2: +00751 neighborNode.S++; +00752 <span class="keywordflow">break</span>; +00753 <span class="keywordflow">case</span> 3: +00754 neighborNode.T--; +00755 <span class="keywordflow">break</span>; +00756 } +00757 +00758 <span class="comment">// Is still in patch ?</span> +00759 <span class="keywordflow">if</span> ( (neighborNode.S>=patchInfo[currentNode.Patch].OrderS) || (neighborNode.T>=patchInfo[currentNode.Patch].OrderT) ) +00760 { +00761 <span class="comment">// No, found new patch</span> +00762 <a class="code" href="a04558.html#a15">uint</a> position; +00763 <span class="keywordflow">switch</span> (currentNode.Edge) +00764 { +00765 <span class="keywordflow">case</span> 0: +00766 position = neighborNode.T; +00767 <span class="keywordflow">break</span>; +00768 <span class="keywordflow">case</span> 1: +00769 position = neighborNode.S; +00770 <span class="keywordflow">break</span>; +00771 <span class="keywordflow">case</span> 2: +00772 position = patchInfo[currentNode.Patch].OrderT - neighborNode.T - 1; +00773 <span class="keywordflow">break</span>; +00774 <span class="keywordflow">case</span> 3: +00775 position = patchInfo[currentNode.Patch].OrderS - neighborNode.S - 1; +00776 <span class="keywordflow">break</span>; +00777 } +00778 +00779 <span class="comment">// Get next patch</span> +00780 <a class="code" href="a04558.html#a15">uint</a> patchOut; +00781 <a class="code" href="a04558.html#a14">sint</a> sOut; +00782 <a class="code" href="a04558.html#a14">sint</a> tOut; +00783 <span class="keywordflow">if</span> (patchInfo[currentNode.Patch].getNeighborTile (currentNode.Patch, currentNode.Edge, position, +00784 patchOut, sOut, tOut, patchInfo)) +00785 { +00786 <span class="comment">// Should be another patch</span> +00787 <a class="code" href="a04199.html#a6">nlassert</a> (patchOut != currentNode.Patch); +00788 +00789 <span class="comment">// Get patch id</span> +00790 neighborNode.Patch = patchOut; +00791 +00792 <span class="comment">// Coordinate must be IN the patch</span> +00793 <a class="code" href="a04199.html#a6">nlassert</a> (sOut >= 0); +00794 <a class="code" href="a04199.html#a6">nlassert</a> (tOut >= 0); +00795 <a class="code" href="a04199.html#a6">nlassert</a> (sOut < patchInfo[neighborNode.Patch].OrderS); +00796 <a class="code" href="a04199.html#a6">nlassert</a> (tOut < patchInfo[neighborNode.Patch].OrderT); +00797 +00798 <span class="comment">// Copy it</span> +00799 neighborNode.S = sOut; +00800 neighborNode.T = tOut; +00801 +00802 <span class="comment">// Find neighbor</span> +00803 <span class="keyword">const</span> CPatchInfo::CBindInfo &neighborBindInfo = patchInfo[currentNode.Patch].BindEdges[currentNode.Edge]; +00804 <a class="code" href="a04558.html#a15">uint</a> edgePatch; +00805 <span class="keywordflow">for</span> (edgePatch=0; edgePatch<(<a class="code" href="a04558.html#a15">uint</a>)neighborBindInfo.NPatchs; edgePatch++) +00806 { +00807 <span class="keywordflow">if</span> (neighborBindInfo.Next[edgePatch] == neighborNode.Patch) +00808 <span class="keywordflow">break</span>; +00809 } +00810 +00811 <span class="comment">// Must find one patch</span> +00812 <a class="code" href="a04199.html#a6">nlassert</a> (edgePatch<(<a class="code" href="a04558.html#a15">uint</a>)neighborBindInfo.NPatchs); +00813 +00814 <span class="comment">// Rotation</span> +00815 neighborNode.Rotate = (currentNode.Rotate + 2 + neighborBindInfo.Edge[edgePatch] - currentNode.Edge) & 3; +00816 +00817 <span class="comment">// Toggle the state ?</span> +00818 <span class="keywordflow">if</span> ((neighborNode.Rotate ^ currentNode.Rotate) & 1) +00819 { +00820 <span class="comment">// Yes</span> +00821 neighborNode.State = (neighborNode.State == <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>) ? <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0">Goofy</a> : <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>; +00822 } +00823 } +00824 <span class="keywordflow">else</span> +00825 { +00826 <span class="comment">// No propagation, continue</span> +00827 currentNode.Edge++; +00828 <span class="keywordflow">continue</span>; +00829 } +00830 } +00831 +00832 <span class="comment">// Neighbor patch</span> +00833 <span class="keyword">const</span> CPatchInfo *neighborPatchPtr = &(patchInfo[neighborNode.Patch]); +00834 +00835 <span class="comment">// Get the tile index</span> +00836 <a class="code" href="a04558.html#a15">uint</a> neighborTile = neighborNode.S+neighborNode.T*neighborPatchPtr->OrderS; +00837 +00838 <span class="comment">// Look for the same tile set in the new tile</span> +00839 <a class="code" href="a04558.html#a15">uint</a> neighborLayer; +00840 <span class="keywordflow">for</span> (neighborLayer=0; neighborLayer<3; neighborLayer++) +00841 { +00842 <span class="comment">// Get the tile index</span> +00843 <a class="code" href="a04558.html#a15">uint</a> neighborTileIndex = neighborPatchPtr->Tiles[neighborTile].Tile[neighborLayer]; +00844 +00845 <span class="keywordflow">if</span> (neighborTileIndex != <a class="code" href="a05118.html#a12">NL_TILE_ELM_LAYER_EMPTY</a>) +00846 { +00847 <span class="comment">// Valid tile number ?</span> +00848 <span class="keywordflow">if</span> (neighborTileIndex >= (<a class="code" href="a04558.html#a15">uint</a>)bank.getTileCount ()) +00849 { +00850 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"CZoneSymmetrisation::propagateTileState: Invalid tile index"</span>); +00851 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00852 } +00853 +00854 <span class="comment">// Get tileset</span> +00855 <span class="keywordtype">int</span> neighborTileSet; +00856 <span class="keywordtype">int</span> neighborNumber; +00857 CTileBank::TTileType neighborType; +00858 bank.getTileXRef (neighborTileIndex, neighborTileSet, neighborNumber, neighborType); +00859 +00860 <span class="comment">// Same tileset ? Stop!</span> +00861 <span class="keywordflow">if</span> ( (neighborTileSet == tileSetToPropagate) && +00862 (neighborNode.Rotate == neighborPatchPtr->Tiles[neighborTile].getTileOrient(neighborLayer)) ) +00863 <span class="keywordflow">break</span>; +00864 } +00865 } +00866 +00867 <span class="comment">// Found ?</span> +00868 <span class="keywordflow">if</span> (neighborLayer<3) +00869 { +00870 <span class="comment">// If oriented, must not be a corner</span> +00871 <span class="keywordflow">if</span> (!(oriented && <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationa3">getOrientedTileCorner</a> (neighborNode.Patch, neighborTile))) +00872 { +00873 <span class="comment">// Propagate in the new node ?</span> +00874 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> neighborState = <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationa5">getTileState</a> (neighborNode.Patch, neighborTile, neighborLayer); +00875 <span class="keywordflow">if</span> (neighborState == <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a>) +00876 { +00877 <span class="comment">// Set the state</span> +00878 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd6">setTileState</a> (neighborNode.Patch, neighborTile, neighborLayer, neighborNode.State); +00879 +00880 <span class="comment">// Stack current node if some neighbor left to visit</span> +00881 <span class="keywordflow">if</span> (currentNode.Edge < 3) +00882 { +00883 currentNode.Edge++; +00884 stack.push_back (currentNode); +00885 } +00886 +00887 <span class="comment">// Continue with the new node</span> +00888 currentNode = neighborNode; +00889 } +00890 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (neighborState != neighborNode.State) +00891 { +00892 <span class="comment">// Error, same tile but not same state</span> +00893 <span class="comment">// nlwarning ("CZoneSymmetrisation::propagateTileState: error, find same iso surfaces with different state.");</span> +00894 +00895 <span class="comment">// No propagation, continue</span> +00896 currentNode.Edge++; +00897 } +00898 <span class="keywordflow">else</span> +00899 { +00900 <span class="comment">// No propagation, continue</span> +00901 currentNode.Edge++; +00902 } +00903 } +00904 <span class="keywordflow">else</span> +00905 { +00906 <span class="comment">// No propagation, continue</span> +00907 currentNode.Edge++; +00908 } +00909 } +00910 <span class="keywordflow">else</span> +00911 <span class="comment">// No propagation, continue</span> +00912 currentNode.Edge++; +00913 } +00914 <span class="keywordflow">while</span> (currentNode.Edge<4); +00915 } +00916 } +00917 } +00918 } +00919 } +00920 } +00921 +00922 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00923 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationd1" doxytag="NL3D::CZoneSymmetrisation::setOrientedTileBorderState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CZoneSymmetrisation::setOrientedTileBorderState </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>tile</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> </td> + <td class="mdname" nowrap> <em>state</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Set border oriented tile symmetry state +<p> +Definition at line <a class="el" href="a06778.html#l00102">102</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06778.html#l00086">setTileState()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06778.html#l00472">setOrientedTileState()</a>. +<p> +<div class="fragment"><pre>00103 { +00104 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd6">setTileState</a> (patch, tile, 4, state); +00105 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationd2" doxytag="NL3D::CZoneSymmetrisation::setOrientedTileCorner" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CZoneSymmetrisation::setOrientedTileCorner </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>tile</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>corner</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Set oriented tile corner state +<p> +Definition at line <a class="el" href="a06778.html#l00109">109</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06779.html#l00158">_TilesLayerStates</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06778.html#l00472">setOrientedTileState()</a>. +<p> +<div class="fragment"><pre>00110 { +00111 <a class="code" href="a04558.html#a9">uint16</a> &ref = <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationr0">_TilesLayerStates</a>[patch][tile]; +00112 ref &= ~(1<<10); +00113 ref |= ((<a class="code" href="a04558.html#a9">uint16</a>)corner)<<(10); +00114 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationd3" doxytag="NL3D::CZoneSymmetrisation::setOrientedTileState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CZoneSymmetrisation::setOrientedTileState </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03066.html">NL3D::CPatchInfo</a> & </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patchId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>snapCell</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>weldThreshold</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> & </td> + <td class="mdname" nowrap> <em>state</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02851.html">NLMISC::CMatrix</a> & </td> + <td class="mdname" nowrap> <em>toOriginalSpace</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03517.html">CTileBank</a> & </td> + <td class="mdname" nowrap> <em>bank</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06778.html#l00472">472</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06537.html#l00333">NL3D::CTileSet::getOriented()</a>, <a class="el" href="a06537.html#l00520">NL3D::CTileBank::getTileSet()</a>, <a class="el" href="a06537.html#l00516">NL3D::CTileBank::getTileSetCount()</a>, <a class="el" href="a06537.html#l00560">NL3D::CTileBank::getTileXRef()</a>, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0">Goofy</a>, <a class="el" href="a06541.html#l00053">NL_TILE_ELM_LAYER_EMPTY</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a>, <a class="el" href="a06760.html#l00122">NL3D::CPatchInfo::OrderS</a>, <a class="el" href="a06760.html#l00122">NL3D::CPatchInfo::OrderT</a>, <a class="el" href="a06760.html#l00120">NL3D::CPatchInfo::Patch</a>, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>, <a class="el" href="a06778.html#l00102">setOrientedTileBorderState()</a>, <a class="el" href="a06778.html#l00109">setOrientedTileCorner()</a>, <a class="el" href="a06778.html#l00086">setTileState()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a06778.html#l00280">snapOnGrid()</a>, <a class="el" href="a06760.html#l00149">NL3D::CPatchInfo::Tiles</a>, <a class="el" href="a05646.html#l00244">type</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05479.html#l00077">NL3D::CBezierPatch::Vertices</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>. +<p> +Referenced by <a class="el" href="a06778.html#l00186">build()</a>. +<p> +<div class="fragment"><pre>00473 { +00474 <span class="comment">// Edges state</span> +00475 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> edgesState[4] = { <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a>, <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a>, Nothing, Nothing }; +00476 +00477 <span class="comment">// Vertices position</span> +00478 <a class="code" href="a04558.html#a10">sint32</a> vertPosU[4]; +00479 <a class="code" href="a04558.html#a10">sint32</a> vertPosV[4]; +00480 +00481 <span class="comment">// For each vertices</span> +00482 <a class="code" href="a04558.html#a15">uint</a> i; +00483 <span class="keywordflow">for</span> (i=0; i<4; i++) +00484 { +00485 <span class="comment">// Snap the vertex</span> +00486 CVector original = toOriginalSpace * patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_8">Patch</a>.Vertices[i]; +00487 <span class="keywordtype">float</span> valueU = original.x; +00488 <span class="keywordtype">float</span> valueV = original.y; +00489 +00490 <span class="comment">// Snap on U</span> +00491 <span class="keywordflow">if</span> (<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationh0">snapOnGrid</a> (valueU, snapCell, weldThreshold)) +00492 vertPosU[i] = (<a class="code" href="a04558.html#a10">sint32</a>)((valueU+0.5f) / snapCell); +00493 <span class="keywordflow">else</span> +00494 vertPosU[i] = 0x80000000; +00495 +00496 <span class="comment">// Snap on V</span> +00497 <span class="keywordflow">if</span> (<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationh0">snapOnGrid</a> (valueV, snapCell, weldThreshold)) +00498 vertPosV[i] = (<a class="code" href="a04558.html#a10">sint32</a>)((valueV+0.5f) / snapCell); +00499 <span class="keywordflow">else</span> +00500 vertPosV[i] = 0x80000000; +00501 } +00502 +00503 <span class="comment">// Patch flags</span> +00504 <span class="keywordtype">bool</span> regular = <span class="keyword">false</span>; +00505 <span class="keywordtype">bool</span> goofy = <span class="keyword">false</span>; +00506 <span class="keywordtype">bool</span> EdgeSnaped[4] = { <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">false</span> }; +00507 +00508 <span class="comment">// For each edges</span> +00509 <span class="keywordflow">for</span> (i=0; i<4; i++) +00510 { +00511 <span class="comment">// Vertex snapped and align on a common axis ?</span> +00512 <span class="keywordflow">if</span> ( (vertPosU[i] != 0x80000000) || (vertPosV[i] != 0x80000000) ) +00513 { +00514 <span class="comment">// Snapped on U or V ?</span> +00515 <span class="keywordtype">bool</span> snapU = (vertPosU[i] == vertPosU[(i+1)&3]) && (vertPosU[i] != 0x80000000); +00516 <span class="keywordtype">bool</span> snapV = (vertPosV[i] == vertPosV[(i+1)&3]) && (vertPosV[i] != 0x80000000); +00517 +00518 <span class="comment">// If snapped on one, continue</span> +00519 <span class="keywordflow">if</span> (snapU || snapV) +00520 { +00521 <span class="comment">// If snap on the both, error</span> +00522 <span class="keywordflow">if</span> (snapU && snapV) +00523 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00524 +00525 <span class="comment">// Is this edge Regular or Goofy ?</span> +00526 edgesState[i] = (i&1)?<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0">Goofy</a>:<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>; +00527 +00528 <span class="comment">// Flag the patch</span> +00529 <span class="keywordflow">if</span> (edgesState[i] == <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>) +00530 regular = <span class="keyword">true</span>; +00531 <span class="keywordflow">else</span> +00532 goofy = <span class="keyword">true</span>; +00533 +00534 <span class="comment">// Edge snaped</span> +00535 EdgeSnaped[i] = <span class="keyword">true</span>; +00536 } +00537 } +00538 } +00539 +00540 <span class="comment">// * Set the tiles</span> +00541 +00542 <span class="comment">// For each edges</span> +00543 <span class="keywordflow">for</span> (i=0; i<4; i++) +00544 { +00545 <span class="comment">// Edge snapped ?</span> +00546 <span class="keywordflow">if</span> (EdgeSnaped[i]) +00547 { +00548 <span class="comment">// For each tiles</span> +00549 <a class="code" href="a04558.html#a15">uint</a> tileCount = ((i&1)!=0)?patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>:patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_7">OrderT</a>; +00550 <a class="code" href="a04558.html#a14">sint</a> currentTile; +00551 <a class="code" href="a04558.html#a14">sint</a> delta; +00552 <span class="keywordflow">switch</span> (i) +00553 { +00554 <span class="keywordflow">case</span> 0: +00555 currentTile = 0; +00556 delta = patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>; +00557 <span class="keywordflow">break</span>; +00558 <span class="keywordflow">case</span> 1: +00559 currentTile = patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>*(patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_7">OrderT</a>-1); +00560 delta = 1; +00561 <span class="keywordflow">break</span>; +00562 <span class="keywordflow">case</span> 2: +00563 currentTile = patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>-1; +00564 delta = patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>; +00565 <span class="keywordflow">break</span>; +00566 <span class="keywordflow">case</span> 3: +00567 currentTile = 0; +00568 delta = 1; +00569 <span class="keywordflow">break</span>; +00570 } +00571 <a class="code" href="a04558.html#a15">uint</a> j; +00572 <span class="keywordflow">for</span> (j=0; j<tileCount; j++) +00573 { +00574 <span class="comment">// Set the border state</span> +00575 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd1">setOrientedTileBorderState</a> (patchId, currentTile, edgesState[i]); +00576 +00577 <span class="comment">// For each layer</span> +00578 <a class="code" href="a04558.html#a15">uint</a> layer; +00579 <span class="keywordflow">for</span> (layer=0; layer<3; layer++) +00580 { +00581 <span class="comment">// Get the tiles set used here</span> +00582 <a class="code" href="a04558.html#a15">uint</a> tile = patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1196_3">Tiles</a>[currentTile].Tile[layer]; +00583 <span class="keywordflow">if</span> (tile != <a class="code" href="a05118.html#a12">NL_TILE_ELM_LAYER_EMPTY</a>) +00584 { +00585 <span class="keywordtype">int</span> tileSet; +00586 <span class="keywordtype">int</span> number; +00587 CTileBank::TTileType <a class="code" href="a04223.html#a581">type</a>; +00588 +00589 bank.getTileXRef (tile, tileSet, number, type); +00590 <span class="keywordflow">if</span> ((tileSet < 0) || (tileSet >= bank.getTileSetCount())) +00591 { +00592 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"CZoneSymmetrisation::setOrientedTileState : tile %d has an unknown tileSet (%d)"</span>, tile, tileSet); +00593 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00594 } +00595 +00596 <span class="comment">// Set it only if oriented</span> +00597 <span class="keywordflow">if</span> (bank.getTileSet (tileSet)->getOriented ()) +00598 { +00599 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd6">setTileState</a> (patchId, currentTile, layer, edgesState[i]); +00600 } +00601 } +00602 } +00603 +00604 <span class="comment">// Next tile</span> +00605 currentTile += delta; +00606 } +00607 } +00608 } +00609 +00610 <span class="comment">// For each corners</span> +00611 <span class="keywordflow">for</span> (i=0; i<4; i++) +00612 { +00613 <span class="comment">// Corner snapped ?</span> +00614 <a class="code" href="a04558.html#a15">uint</a> next = (i+1)&3; +00615 <span class="keywordflow">if</span> (EdgeSnaped[i] && EdgeSnaped[next]) +00616 { +00617 <span class="comment">// Flag tile as corner</span> +00618 <span class="keywordflow">switch</span> (i) +00619 { +00620 <span class="keywordflow">case</span> 0: +00621 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd2">setOrientedTileCorner</a> (patchId, patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>*(patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_7">OrderT</a>-1), <span class="keyword">true</span>); +00622 <span class="keywordflow">break</span>; +00623 <span class="keywordflow">case</span> 1: +00624 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd2">setOrientedTileCorner</a> (patchId, patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>*patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_7">OrderT</a>-1, <span class="keyword">true</span>); +00625 <span class="keywordflow">break</span>; +00626 <span class="keywordflow">case</span> 2: +00627 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd2">setOrientedTileCorner</a> (patchId, patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>-1, <span class="keyword">true</span>); +00628 <span class="keywordflow">break</span>; +00629 <span class="keywordflow">case</span> 3: +00630 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd2">setOrientedTileCorner</a> (patchId, 0, <span class="keyword">true</span>); +00631 <span class="keywordflow">break</span>; +00632 } +00633 } +00634 } +00635 +00636 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00637 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationd4" doxytag="NL3D::CZoneSymmetrisation::setTileBorderState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CZoneSymmetrisation::setTileBorderState </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>tile</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> </td> + <td class="mdname" nowrap> <em>state</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Set border tile symmetry state +<p> +Definition at line <a class="el" href="a06778.html#l00095">95</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06778.html#l00086">setTileState()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06778.html#l00312">setTileState()</a>. +<p> +<div class="fragment"><pre>00096 { +00097 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd6">setTileState</a> (patch, tile, 3, state); +00098 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationd5" doxytag="NL3D::CZoneSymmetrisation::setTileState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CZoneSymmetrisation::setTileState </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03066.html">NL3D::CPatchInfo</a> & </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patchId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>snapCell</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>weldThreshold</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> & </td> + <td class="mdname" nowrap> <em>state</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02851.html">NLMISC::CMatrix</a> & </td> + <td class="mdname" nowrap> <em>toOriginalSpace</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03517.html">CTileBank</a> & </td> + <td class="mdname" nowrap> <em>bank</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Set tile state of a patch +<p> +Definition at line <a class="el" href="a06778.html#l00312">312</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06537.html#l00333">NL3D::CTileSet::getOriented()</a>, <a class="el" href="a06537.html#l00520">NL3D::CTileBank::getTileSet()</a>, <a class="el" href="a06537.html#l00516">NL3D::CTileBank::getTileSetCount()</a>, <a class="el" href="a06537.html#l00560">NL3D::CTileBank::getTileXRef()</a>, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0">Goofy</a>, <a class="el" href="a06541.html#l00053">NL_TILE_ELM_LAYER_EMPTY</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a>, <a class="el" href="a06760.html#l00122">NL3D::CPatchInfo::OrderS</a>, <a class="el" href="a06760.html#l00122">NL3D::CPatchInfo::OrderT</a>, <a class="el" href="a06760.html#l00120">NL3D::CPatchInfo::Patch</a>, <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>, <a class="el" href="a06778.html#l00095">setTileBorderState()</a>, <a class="el" href="a06778.html#l00086">setTileState()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a06778.html#l00280">snapOnGrid()</a>, <a class="el" href="a06760.html#l00149">NL3D::CPatchInfo::Tiles</a>, <a class="el" href="a05646.html#l00244">type</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05479.html#l00077">NL3D::CBezierPatch::Vertices</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>. +<p> +<div class="fragment"><pre>00313 { +00314 <span class="comment">// Edges state</span> +00315 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> edgesState[4] = { <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a>, <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw1">Nothing</a>, Nothing, Nothing }; +00316 +00317 <span class="comment">// Vertices position</span> +00318 <a class="code" href="a04558.html#a10">sint32</a> vertPosU[4]; +00319 <a class="code" href="a04558.html#a10">sint32</a> vertPosV[4]; +00320 +00321 <span class="comment">// For each vertices</span> +00322 <a class="code" href="a04558.html#a15">uint</a> i; +00323 <span class="keywordflow">for</span> (i=0; i<4; i++) +00324 { +00325 <span class="comment">// Snap the vertex</span> +00326 CVector original = toOriginalSpace * patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_8">Patch</a>.Vertices[i]; +00327 <span class="keywordtype">float</span> valueU = original.x; +00328 <span class="keywordtype">float</span> valueV = original.y; +00329 +00330 <span class="comment">// Snap on U</span> +00331 <span class="keywordflow">if</span> (<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationh0">snapOnGrid</a> (valueU, snapCell, weldThreshold)) +00332 vertPosU[i] = (<a class="code" href="a04558.html#a10">sint32</a>)((valueU+0.5f) / snapCell); +00333 <span class="keywordflow">else</span> +00334 vertPosU[i] = 0x80000000; +00335 +00336 <span class="comment">// Snap on V</span> +00337 <span class="keywordflow">if</span> (<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationh0">snapOnGrid</a> (valueV, snapCell, weldThreshold)) +00338 vertPosV[i] = (<a class="code" href="a04558.html#a10">sint32</a>)((valueV+0.5f) / snapCell); +00339 <span class="keywordflow">else</span> +00340 vertPosV[i] = 0x80000000; +00341 } +00342 +00343 <span class="comment">// Patch flags</span> +00344 <span class="keywordtype">bool</span> regular = <span class="keyword">false</span>; +00345 <span class="keywordtype">bool</span> goofy = <span class="keyword">false</span>; +00346 <span class="keywordtype">bool</span> EdgeSnaped[4] = { <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">false</span> }; +00347 +00348 <span class="comment">// For each edges</span> +00349 <span class="keywordflow">for</span> (i=0; i<4; i++) +00350 { +00351 <span class="comment">// Vertex snapped and align on a common axis ?</span> +00352 <span class="keywordflow">if</span> ( (vertPosU[i] != 0x80000000) || (vertPosV[i] != 0x80000000) ) +00353 { +00354 <span class="comment">// Snapped on U or V ?</span> +00355 <span class="keywordtype">bool</span> snapU = (vertPosU[i] == vertPosU[(i+1)&3]) && (vertPosU[i] != 0x80000000); +00356 <span class="keywordtype">bool</span> snapV = (vertPosV[i] == vertPosV[(i+1)&3]) && (vertPosV[i] != 0x80000000); +00357 +00358 <span class="comment">// If snapped on one, continue</span> +00359 <span class="keywordflow">if</span> (snapU || snapV) +00360 { +00361 <span class="comment">// If snap on the both, error</span> +00362 <span class="keywordflow">if</span> (snapU && snapV) +00363 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00364 +00365 <span class="comment">// Is this edge Regular or Goofy ?</span> +00366 <span class="keywordflow">if</span> (snapU) +00367 edgesState[i] = (i&1)?<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0">Goofy</a>:<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>; +00368 <span class="keywordflow">else</span> <span class="comment">// (snapV)</span> +00369 edgesState[i] = (i&1)?<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>:<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0">Goofy</a>; +00370 +00371 <span class="comment">// Flag the patch</span> +00372 <span class="keywordflow">if</span> (edgesState[i] == <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>) +00373 regular = <span class="keyword">true</span>; +00374 <span class="keywordflow">else</span> +00375 goofy = <span class="keyword">true</span>; +00376 +00377 <span class="comment">// Edge snaped</span> +00378 EdgeSnaped[i] = <span class="keyword">true</span>; +00379 } +00380 } +00381 } +00382 +00383 <span class="comment">// Goofy and regular ? Error</span> +00384 <span class="keywordflow">if</span> (goofy && regular) +00385 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00386 +00387 <span class="comment">// Nothing ?</span> +00388 <span class="keywordflow">if</span> ((!goofy) && (!regular)) +00389 state = Nothing; +00390 <span class="keywordflow">else</span> +00391 { +00392 <span class="comment">// Not nothing ?</span> +00393 state = regular?<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw2">Regular</a>:<a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3NL3D_1_1CZoneSymmetrisationw0">Goofy</a>; +00394 +00395 <span class="comment">// * Set the tiles</span> +00396 +00397 <span class="comment">// For each edges</span> +00398 <span class="keywordflow">for</span> (i=0; i<4; i++) +00399 { +00400 <span class="comment">// Edge snapped ?</span> +00401 <span class="keywordflow">if</span> (EdgeSnaped[i]) +00402 { +00403 <span class="comment">// For each tiles</span> +00404 <a class="code" href="a04558.html#a15">uint</a> tileCount = ((i&1)!=0)?patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>:patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_7">OrderT</a>; +00405 <a class="code" href="a04558.html#a14">sint</a> currentTile; +00406 <a class="code" href="a04558.html#a14">sint</a> delta; +00407 <span class="keywordflow">switch</span> (i) +00408 { +00409 <span class="keywordflow">case</span> 0: +00410 currentTile = 0; +00411 delta = patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>; +00412 <span class="keywordflow">break</span>; +00413 <span class="keywordflow">case</span> 1: +00414 currentTile = patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>*(patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_7">OrderT</a>-1); +00415 delta = 1; +00416 <span class="keywordflow">break</span>; +00417 <span class="keywordflow">case</span> 2: +00418 currentTile = patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>-1; +00419 delta = patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1194_6">OrderS</a>; +00420 <span class="keywordflow">break</span>; +00421 <span class="keywordflow">case</span> 3: +00422 currentTile = 0; +00423 delta = 1; +00424 <span class="keywordflow">break</span>; +00425 } +00426 <a class="code" href="a04558.html#a15">uint</a> j; +00427 <span class="keywordflow">for</span> (j=0; j<tileCount; j++) +00428 { +00429 <span class="comment">// Set the border state</span> +00430 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd4">setTileBorderState</a> (patchId, currentTile, state); +00431 +00432 <span class="comment">// For each layer</span> +00433 <a class="code" href="a04558.html#a15">uint</a> layer; +00434 <span class="keywordflow">for</span> (layer=0; layer<3; layer++) +00435 { +00436 <span class="comment">// Get the tiles set used here</span> +00437 <a class="code" href="a04558.html#a15">uint</a> tile = patch.<a class="code" href="a03066.html#NL3D_1_1CPatchInfoz1196_3">Tiles</a>[currentTile].Tile[layer]; +00438 <span class="keywordflow">if</span> (tile != <a class="code" href="a05118.html#a12">NL_TILE_ELM_LAYER_EMPTY</a>) +00439 { +00440 <span class="keywordtype">int</span> tileSet; +00441 <span class="keywordtype">int</span> number; +00442 CTileBank::TTileType <a class="code" href="a04223.html#a581">type</a>; +00443 bank.getTileXRef (tile, tileSet, number, type); +00444 +00445 <span class="keywordflow">if</span> ((tileSet < 0) || (tileSet >= bank.getTileSetCount())) +00446 { +00447 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"CZoneSymmetrisation::setTileState : tile %d has an unknown tileSet (%d)"</span>, tile, tileSet); +00448 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00449 } +00450 +00451 <span class="comment">// Set it only if not oriented</span> +00452 <span class="keywordflow">if</span> (!bank.getTileSet (tileSet)->getOriented ()) +00453 { +00454 <span class="comment">// Set the tile state</span> +00455 <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationd6">setTileState</a> (patchId, currentTile, layer, state); +00456 } +00457 } +00458 } +00459 +00460 <span class="comment">// Next tile</span> +00461 currentTile += delta; +00462 } +00463 } +00464 } +00465 } +00466 +00467 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00468 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationd6" doxytag="NL3D::CZoneSymmetrisation::setTileState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CZoneSymmetrisation::setTileState </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>tile</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>layer</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationw3">TState</a> </td> + <td class="mdname" nowrap> <em>state</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Set orientedtile symmetry state +<p> +Definition at line <a class="el" href="a06778.html#l00086">86</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a06779.html#l00158">_TilesLayerStates</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06778.html#l00186">build()</a>, <a class="el" href="a06778.html#l00670">propagateTileState()</a>, <a class="el" href="a06778.html#l00102">setOrientedTileBorderState()</a>, <a class="el" href="a06778.html#l00472">setOrientedTileState()</a>, <a class="el" href="a06778.html#l00095">setTileBorderState()</a>, and <a class="el" href="a06778.html#l00312">setTileState()</a>. +<p> +<div class="fragment"><pre>00087 { +00088 <a class="code" href="a04558.html#a9">uint16</a> &ref = <a class="code" href="a03762.html#NL3D_1_1CZoneSymmetrisationr0">_TilesLayerStates</a>[patch][tile]; +00089 ref &= ~(3<<(layer*2)); +00090 ref |= ((<a class="code" href="a04558.html#a9">uint16</a>)state)<<(layer*2); +00091 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationh0" doxytag="NL3D::CZoneSymmetrisation::snapOnGrid" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CZoneSymmetrisation::snapOnGrid </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">float & </td> + <td class="mdname" nowrap> <em>value</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>resolution</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>snap</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06778.html#l00280">280</a> of file <a class="el" href="a06778.html">zone_symmetrisation.cpp</a>. +<p> +References <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05646.html#l01132">value</a>. +<p> +Referenced by <a class="el" href="a06778.html#l00472">setOrientedTileState()</a>, and <a class="el" href="a06778.html#l00312">setTileState()</a>. +<p> +<div class="fragment"><pre>00281 { +00282 <span class="comment">// Calc the floor</span> +00283 <span class="keywordtype">float</span> _floor = (<span class="keywordtype">float</span>) ( resolution * floor (value / resolution) ); +00284 <a class="code" href="a04199.html#a6">nlassert</a> (_floor<=value); +00285 +00286 <span class="comment">// Calc the remainder</span> +00287 <span class="keywordtype">float</span> remainder = <a class="code" href="a04223.html#a658">value</a> - _floor; +00288 <span class="comment">//nlassert ( (remainder>=0) && (remainder<resolution) );</span> +00289 +00290 <span class="comment">// Check the snape</span> +00291 <span class="keywordflow">if</span> ( remainder <= snap ) +00292 { +00293 <span class="comment">// Flag it</span> +00294 <a class="code" href="a04223.html#a658">value</a> = _floor; +00295 +00296 <span class="comment">// Floor is good</span> +00297 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00298 } +00299 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( (resolution - remainder) <= snap ) +00300 { +00301 <span class="comment">// Flag it</span> +00302 <a class="code" href="a04223.html#a658">value</a> = _floor + resolution; +00303 +00304 <span class="comment">// Floor + resolution is good</span> +00305 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00306 } +00307 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00308 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NL3D_1_1CZoneSymmetrisationr0" doxytag="NL3D::CZoneSymmetrisation::_TilesLayerStates" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<std::vector<<a class="el" href="a04558.html#a9">uint16</a>> > <a class="el" href="a03762.html#NL3D_1_1CZoneSymmetrisationr0">NL3D::CZoneSymmetrisation::_TilesLayerStates</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06779.html#l00158">158</a> of file <a class="el" href="a06779.html">zone_symmetrisation.h</a>. +<p> +Referenced by <a class="el" href="a06778.html#l00186">build()</a>, <a class="el" href="a06778.html#l00079">getOrientedTileCorner()</a>, <a class="el" href="a06778.html#l00057">getTileState()</a>, <a class="el" href="a06778.html#l00109">setOrientedTileCorner()</a>, and <a class="el" href="a06778.html#l00086">setTileState()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06779.html">zone_symmetrisation.h</a><li><a class="el" href="a06778.html">zone_symmetrisation.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 08:36:36 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |