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/tile__bank_8cpp-source.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/tile__bank_8cpp-source.html | 1949 |
1 files changed, 1949 insertions, 0 deletions
diff --git a/docs/doxygen/nel/tile__bank_8cpp-source.html b/docs/doxygen/nel/tile__bank_8cpp-source.html new file mode 100644 index 00000000..50473bdc --- /dev/null +++ b/docs/doxygen/nel/tile__bank_8cpp-source.html @@ -0,0 +1,1949 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : docs</TITLE> + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> + <link href="doxygen.css" rel="stylesheet" type="text/css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Documentation</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.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">Compound List</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">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center> +<hr><h1>tile_bank.cpp</h1><a href="tile__bank_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font> +00008 <font class="comment"> *</font> +00009 <font class="comment"> * This file is part of NEVRAX NEL.</font> +00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font> +00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00013 <font class="comment"> * any later version.</font> +00014 <font class="comment"></font> +00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font> +00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00018 <font class="comment"> * General Public License for more details.</font> +00019 <font class="comment"></font> +00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font> +00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00023 <font class="comment"> * MA 02111-1307, USA.</font> +00024 <font class="comment"> */</font> +00025 +00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font> +00027 +00028 <font class="preprocessor">#include "<a class="code" href="tile__bank_8h.html">3d/tile_bank.h</a>"</font> +00029 <font class="preprocessor">#include "<a class="code" href="texture__file_8h.html">3d/texture_file.h</a>"</font> +00030 <font class="preprocessor">#include "<a class="code" href="tile__noise__map_8h.html">3d/tile_noise_map.h</a>"</font> +00031 +00032 <font class="preprocessor">#include "<a class="code" href="stream_8h.html">nel/misc/stream.h</a>"</font> +00033 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font> +00034 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font> +00035 <font class="preprocessor">#include "<a class="code" href="file_8h.html">nel/misc/file.h</a>"</font> +00036 <font class="preprocessor">#include <string></font> +00037 +00038 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC; +00039 <font class="keyword">using</font> <font class="keyword">namespace </font>std; +00040 +00041 <font class="keyword">namespace </font>NL3D +00042 { +00043 +00044 +00045 <font class="comment">// ***************************************************************************</font> +00046 <font class="comment">// ***************************************************************************</font> +00047 <font class="comment">// TileBankLand.</font> +00048 <font class="comment">// ***************************************************************************</font> +00049 <font class="comment">// ***************************************************************************</font> +00050 +00051 +00052 <font class="comment">// ***************************************************************************</font> +<a name="l00053"></a><a class="code" href="classNL3D_1_1CTileLand.html#r0">00053</a> <font class="keyword">const</font> sint CTileLand::_Version=0; +00054 <font class="comment">// ***************************************************************************</font> +<a name="l00055"></a><a class="code" href="classNL3D_1_1CTileLand.html#a5">00055</a> <font class="keywordtype">void</font> CTileLand::serial(IStream &f) <font class="keywordflow">throw</font>(EStream) +00056 { +00057 (void)f.serialVersion(_Version); +00058 +00059 f.serial (_Name); +00060 f.serialCont (_TileSet); +00061 } +00062 <font class="comment">// ***************************************************************************</font> +<a name="l00063"></a><a class="code" href="classNL3D_1_1CTileLand.html#a2">00063</a> <font class="keywordtype">void</font> CTileLand::addTileSet (<font class="keyword">const</font> std::string& name) +00064 { +00065 <a class="code" href="classNL3D_1_1CTileLand.html#o1">_TileSet</a>.insert (name); +00066 } +00067 <font class="comment">// ***************************************************************************</font> +<a name="l00068"></a><a class="code" href="classNL3D_1_1CTileLand.html#a3">00068</a> <font class="keywordtype">void</font> CTileLand::removeTileSet (<font class="keyword">const</font> std::string& name) +00069 { +00070 <a class="code" href="classNL3D_1_1CTileLand.html#o1">_TileSet</a>.erase (name); +00071 } +00072 <font class="comment">// ***************************************************************************</font> +<a name="l00073"></a><a class="code" href="classNL3D_1_1CTileLand.html#a1">00073</a> <font class="keywordtype">void</font> CTileLand::setName (<font class="keyword">const</font> std::string& name) +00074 { +00075 <a class="code" href="classNL3D_1_1CTileLand.html#o0">_Name</a>=name; +00076 }; +00077 <font class="comment">// ***************************************************************************</font> +00078 +00079 +00080 <font class="comment">// ***************************************************************************</font> +00081 <font class="comment">// ***************************************************************************</font> +00082 <font class="comment">// CTileBank.</font> +00083 <font class="comment">// ***************************************************************************</font> +00084 <font class="comment">// ***************************************************************************</font> +00085 +00086 +00087 <font class="comment">// ***************************************************************************</font> +<a name="l00088"></a><a class="code" href="classNL3D_1_1CTileBank.html#r0">00088</a> <font class="keyword">const</font> sint CTileBank::_Version=4; +00089 <font class="comment">// ***************************************************************************</font> +<a name="l00090"></a><a class="code" href="classNL3D_1_1CTileBank.html#a0">00090</a> CTileBank::CTileBank () +00091 { +00092 <font class="comment">// Default _DisplacementMap</font> +00093 <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.resize (1); +00094 +00095 <font class="comment">// Fill it with 0</font> +00096 <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[0].setEmpty (); +00097 } +00098 <font class="comment">// ***************************************************************************</font> +<a name="l00099"></a><a class="code" href="classNL3D_1_1CTileBank.html#a29">00099</a> <font class="keywordtype">void</font> CTileBank::serial(IStream &f) <font class="keywordflow">throw</font>(EStream) +00100 { +00101 f.serialCheck (std::string (<font class="stringliteral">"BANK"</font>)); +00102 +00103 sint streamver = f.serialVersion(_Version); +00104 +00105 <font class="comment">// Version 1 not compatible</font> +00106 <font class="keywordflow">if</font> (f.isReading()) +00107 { +00108 <font class="keywordflow">if</font> (streamver<2) +00109 <font class="keywordflow">throw</font> EOlderStream(f); +00110 } +00111 +00112 <font class="keywordflow">switch</font> (streamver) +00113 { +00114 <font class="keywordflow">case</font> 4: +00115 <font class="comment">// Displacement map array</font> +00116 f.serialCont (_DisplacementMap); +00117 <font class="keywordflow">if</font> (f.isReading()) +00118 { +00119 <font class="comment">// Checks</font> +00120 <a class="code" href="debug_8h.html#a6">nlassert</a> (_DisplacementMap.size()>0); +00121 +00122 <font class="comment">// Set first empty</font> +00123 _DisplacementMap[0].setEmpty (); +00124 } +00125 <font class="keywordflow">case</font> 3: +00126 <font class="comment">// Absolute path</font> +00127 f.serial (_AbsPath); +00128 <font class="keywordflow">case</font> 2: +00129 <font class="comment">// Serial all containers</font> +00130 f.serialCont (_LandVector); +00131 f.serialCont (_TileSetVector); +00132 f.serialCont (_TileVector); +00133 } +00134 +00135 <font class="comment">// Compute XRef in read mode</font> +00136 <font class="keywordflow">if</font> (f.isReading()) +00137 computeXRef (); +00138 +00139 <font class="comment">// If Version<=2, remove diffuse and alpha tiles in transitions</font> +00140 <font class="keywordflow">if</font> (streamver<=2) +00141 { +00142 <font class="comment">// Must be reading</font> +00143 <a class="code" href="debug_8h.html#a6">nlassert</a> (f.isReading()); +00144 +00145 <font class="comment">// Reset _AbsPath</font> +00146 _AbsPath=<font class="stringliteral">""</font>; +00147 +00148 <font class="comment">// Remove diffuse and additive in transition</font> +00149 uint tileCount=(uint)getTileCount (); +00150 <font class="keywordflow">for</font> (uint i=0; i<tileCount; i++) +00151 { +00152 <font class="keywordtype">int</font> tileSet; +00153 <font class="keywordtype">int</font> number; +00154 TTileType <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>; +00155 +00156 <font class="comment">// Get xref</font> +00157 getTileXRef (i, tileSet, number, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +00158 +00159 <font class="comment">// Transition ?</font> +00160 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>==transition) +00161 { +00162 <font class="comment">// Remove diffuse bitmap</font> +00163 getTileSet(tileSet)->clearTransition ((CTileSet::TTransition)number, CTile::diffuse, *<font class="keyword">this</font>); +00164 +00165 <font class="comment">// Remove alpha bitmap</font> +00166 getTileSet(tileSet)->clearTransition ((CTileSet::TTransition)number, CTile::alpha, *<font class="keyword">this</font>); +00167 } +00168 } +00169 } +00170 } +00171 <font class="comment">// ***************************************************************************</font> +<a name="l00172"></a><a class="code" href="classNL3D_1_1CTileBank.html#a10">00172</a> sint CTileBank::addLand (<font class="keyword">const</font> std::string& name) +00173 { +00174 sint last=<a class="code" href="classNL3D_1_1CTileBank.html#o0">_LandVector</a>.size(); +00175 <a class="code" href="classNL3D_1_1CTileBank.html#o0">_LandVector</a>.push_back(CTileLand()); +00176 <a class="code" href="classNL3D_1_1CTileBank.html#o0">_LandVector</a>[last].setName (name); +00177 <font class="keywordflow">return</font> last; +00178 } +00179 <font class="comment">// ***************************************************************************</font> +<a name="l00180"></a><a class="code" href="classNL3D_1_1CTileBank.html#a11">00180</a> <font class="keywordtype">void</font> CTileBank::removeLand (sint landIndex) +00181 { +00182 <font class="comment">// Check args</font> +00183 <a class="code" href="debug_8h.html#a6">nlassert</a> (landIndex>=0); +00184 <a class="code" href="debug_8h.html#a6">nlassert</a> (landIndex<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o0">_LandVector</a>.size()); +00185 +00186 <a class="code" href="classNL3D_1_1CTileBank.html#o0">_LandVector</a>.erase (<a class="code" href="classNL3D_1_1CTileBank.html#o0">_LandVector</a>.begin ()+landIndex); +00187 } +00188 <font class="comment">// ***************************************************************************</font> +<a name="l00189"></a><a class="code" href="classNL3D_1_1CTileBank.html#a12">00189</a> sint CTileBank::addTileSet (<font class="keyword">const</font> std::string& name) +00190 { +00191 sint last=<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size(); +00192 <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.push_back(<a class="code" href="classNL3D_1_1CTileBank.html#l0">CTileSet</a>()); +00193 <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[last].setName (name); +00194 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i<CTileSet::count; i++) +00195 { +00196 <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[last]._TileTransition[i]._Tile=<a class="code" href="classNL3D_1_1CTileBank.html#c0">createTile</a> (); +00197 } +00198 <font class="keywordflow">return</font> last; +00199 } +00200 <font class="comment">// ***************************************************************************</font> +<a name="l00201"></a><a class="code" href="classNL3D_1_1CTileBank.html#a13">00201</a> <font class="keywordtype">void</font> CTileBank::removeTileSet (sint setIndex) +00202 { +00203 <font class="comment">// Check args</font> +00204 <a class="code" href="debug_8h.html#a6">nlassert</a> (setIndex>=0); +00205 <a class="code" href="debug_8h.html#a6">nlassert</a> (setIndex<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size()); +00206 +00207 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i<CTileSet::count; i++) +00208 { +00209 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[setIndex]._TileTransition[i]._Tile; +00210 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>!=-1) +00211 <a class="code" href="classNL3D_1_1CTileBank.html#c1">freeTile</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>); +00212 } +00213 <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.erase (<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.begin ()+setIndex); +00214 } +00215 <font class="comment">// ***************************************************************************</font> +<a name="l00216"></a><a class="code" href="classNL3D_1_1CTileBank.html#a15">00216</a> <font class="keywordtype">void</font> CTileBank::clear () +00217 { +00218 <a class="code" href="classNL3D_1_1CTileBank.html#o0">_LandVector</a>.clear (); +00219 <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.clear (); +00220 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.clear (); +00221 } +00222 <font class="comment">// ***************************************************************************</font> +<a name="l00223"></a><a class="code" href="classNL3D_1_1CTileBank.html#c0">00223</a> sint CTileBank::createTile () +00224 { +00225 <font class="comment">// Look for a free tile</font> +00226 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size(); i++) +00227 { +00228 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[i].isFree()) +00229 { +00230 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[i].setFileName (CTile::diffuse, <font class="stringliteral">""</font>); +00231 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[i].setFileName (CTile::additive, <font class="stringliteral">""</font>); +00232 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[i].setFileName (CTile::alpha, <font class="stringliteral">""</font>); +00233 <font class="keywordflow">return</font> i; +00234 } +00235 } +00236 +00237 <font class="comment">// Nothing free, add a tile at the end</font> +00238 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.push_back (CTile()); +00239 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size()-1].setFileName (CTile::diffuse, <font class="stringliteral">""</font>); +00240 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size()-1].setFileName (CTile::additive, <font class="stringliteral">""</font>); +00241 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size()-1].setFileName (CTile::alpha, <font class="stringliteral">""</font>); +00242 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size()-1; +00243 } +00244 <font class="comment">// ***************************************************************************</font> +<a name="l00245"></a><a class="code" href="classNL3D_1_1CTileBank.html#c1">00245</a> <font class="keywordtype">void</font> CTileBank::freeTile (<font class="keywordtype">int</font> tileIndex) +00246 { +00247 <font class="comment">// Check args</font> +00248 <a class="code" href="debug_8h.html#a6">nlassert</a> (tileIndex>=0); +00249 <a class="code" href="debug_8h.html#a6">nlassert</a> (tileIndex<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size()); +00250 +00251 <font class="comment">// Free</font> +00252 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[tileIndex].free(); +00253 +00254 <font class="comment">// Resize tile table</font> +00255 <font class="keywordtype">int</font> i; +00256 <font class="keywordflow">for</font> (i=(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size()-1; i>=0; i--) +00257 { +00258 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[i].isFree ()) +00259 <font class="keywordflow">break</font>; +00260 } +00261 <font class="keywordflow">if</font> (i<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size()-1) +00262 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.resize (i+1); +00263 } +00264 <font class="comment">// ***************************************************************************</font> +<a name="l00265"></a><a class="code" href="classNL3D_1_1CTileBank.html#a16">00265</a> sint CTileBank::getNumBitmap (CTile::TBitmap bitmap)<font class="keyword"> const</font> +00266 <font class="keyword"></font>{ +00267 std::set<std::string> setString; +00268 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size(); i++) +00269 { +00270 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[i].isFree()) +00271 { +00272 <font class="keyword">const</font> std::string &str=<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[i].getRelativeFileName (bitmap); +00273 <font class="keywordflow">if</font> (str!=<font class="stringliteral">""</font>) +00274 { +00275 std::vector<char> vect (str.length()+1); +00276 memcpy (&*vect.begin(), str.c_str(), str.length()+1); +00277 <a class="code" href="namespaceNLMISC.html#a229">NLMISC::strlwr</a> (&*vect.begin()); +00278 setString.insert (std::string (&*vect.begin())); +00279 } +00280 } +00281 } +00282 <font class="keywordflow">return</font> setString.size(); +00283 } +00284 <font class="comment">// ***************************************************************************</font> +<a name="l00285"></a><a class="code" href="classNL3D_1_1CTileBank.html#a17">00285</a> <font class="keywordtype">void</font> CTileBank::computeXRef () +00286 { +00287 <font class="comment">// Resize</font> +00288 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>.resize (<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size()); +00289 +00290 <font class="comment">// Erase number of the tileset in xref</font> +00291 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> tile=0; tile<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size(); tile++) +00292 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[tile]._XRefTileSet=-1; +00293 +00294 <font class="comment">// Erase number of the tileset in xref</font> +00295 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a><(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size(); <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>++) +00296 { +00297 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>; +00298 <a class="code" href="classNL3D_1_1CTileBank.html#l0">CTileSet</a> *tileSet=<a class="code" href="classNL3D_1_1CTileBank.html#a5">getTileSet</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>); +00299 <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a><tileSet->getNumTile128(); <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>++) +00300 { +00301 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=tileSet->getTile128 (<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>); +00302 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]._XRefTileSet=<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>; +00303 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]._XRefTileNumber=<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>; +00304 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]._XRefTileType=<a class="code" href="classNL3D_1_1CTileBank.html#s4s0">_128x128</a>; +00305 } +00306 <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a><tileSet->getNumTile256(); <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>++) +00307 { +00308 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=tileSet->getTile256 (<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>); +00309 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]._XRefTileSet=<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>; +00310 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]._XRefTileNumber=<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>; +00311 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]._XRefTileType=<a class="code" href="classNL3D_1_1CTileBank.html#s4s1">_256x256</a>; +00312 } +00313 <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a><CTileSet::count; <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>++) +00314 { +00315 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=tileSet->getTransition (t)->getTile(); +00316 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]._XRefTileSet=<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>; +00317 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]._XRefTileNumber=<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>; +00318 <a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]._XRefTileType=<a class="code" href="classNL3D_1_1CTileBank.html#s4s2">transition</a>; +00319 } +00320 } +00321 } +00322 <font class="comment">// ***************************************************************************</font> +<a name="l00323"></a><a class="code" href="classNL3D_1_1CTileBank.html#a14">00323</a> <font class="keywordtype">void</font> CTileBank::xchgTileset (sint firstTileSet, sint secondTileSet) +00324 { +00325 <font class="comment">// Some check</font> +00326 <a class="code" href="debug_8h.html#a6">nlassert</a> ((firstTileSet>=0)&&(firstTileSet<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size())); +00327 <a class="code" href="debug_8h.html#a6">nlassert</a> ((secondTileSet>=0)&&(secondTileSet<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size())); +00328 +00329 <font class="comment">// Xchange the sets</font> +00330 <a class="code" href="classNL3D_1_1CTileBank.html#l0">CTileSet</a> tmp=<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[firstTileSet]; +00331 <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[firstTileSet]=<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[secondTileSet]; +00332 <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[secondTileSet]=tmp; +00333 } +00334 <font class="comment">// ***************************************************************************</font> +00335 <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a468">TroncFileName</a> (<font class="keywordtype">char</font>* sDest, <font class="keyword">const</font> <font class="keywordtype">char</font>* sSrc) +00336 { +00337 <font class="keywordtype">char</font>* ptr=strrchr (sSrc, <font class="charliteral">'\\'</font>); +00338 <font class="keywordflow">if</font> (ptr==NULL) +00339 ptr=strrchr (sSrc, <font class="charliteral">'/'</font>); +00340 <font class="keywordflow">if</font> (ptr) +00341 { +00342 ptr++; +00343 strcpy (sDest, ptr); +00344 } +00345 <font class="keywordflow">else</font> +00346 { +00347 strcpy (sDest, sSrc); +00348 } +00349 } +00350 <font class="comment">// ***************************************************************************</font> +00351 <font class="comment">// Je parie que ce patch reste jusqu'à la fin du jeu. (Hulud)</font> +<a name="l00352"></a><a class="code" href="classNL3D_1_1CTileBank.html#a25">00352</a> <font class="keywordtype">void</font> CTileBank::makeAllPathRelative () +00353 { +00354 <font class="comment">// For all tiles</font> +00355 <font class="keywordflow">for</font> (sint nTile=0; nTile<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size(); nTile++) +00356 { +00357 <font class="comment">// Tronc filename</font> +00358 <font class="keywordtype">char</font> sTmpFileName[512]; +00359 +00360 <font class="comment">// Diffuse</font> +00361 <a class="code" href="namespaceNL3D.html#a468">TroncFileName</a> (sTmpFileName, <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].getRelativeFileName (CTile::diffuse).c_str()); +00362 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].setFileName (CTile::diffuse, sTmpFileName); +00363 +00364 <font class="comment">// Additive</font> +00365 <a class="code" href="namespaceNL3D.html#a468">TroncFileName</a> (sTmpFileName, <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].getRelativeFileName (CTile::additive).c_str()); +00366 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].setFileName (CTile::additive, sTmpFileName); +00367 +00368 <font class="comment">// Alpha</font> +00369 <a class="code" href="namespaceNL3D.html#a468">TroncFileName</a> (sTmpFileName, <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].getRelativeFileName (CTile::alpha).c_str()); +00370 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].setFileName (CTile::alpha, sTmpFileName); +00371 } +00372 +00373 <font class="comment">// For all displaces</font> +00374 <font class="keywordflow">for</font> (uint i=0; i<<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.size(); i++) +00375 { +00376 <font class="comment">// Tronc filename</font> +00377 <font class="keywordtype">char</font> sTmpFileName[512]; +00378 +00379 <a class="code" href="namespaceNL3D.html#a468">TroncFileName</a> (sTmpFileName, <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[i]._FileName.c_str()); +00380 <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[i]._FileName = sTmpFileName; +00381 } +00382 } +00383 +00384 +00385 <font class="comment">// ***************************************************************************</font> +00386 <font class="comment">// Moi aussi je le parie (Yoyo).</font> +<a name="l00387"></a><a class="code" href="classNL3D_1_1CTileBank.html#a26">00387</a> <font class="keywordtype">void</font> CTileBank::makeAllExtensionDDS () +00388 { +00389 <font class="comment">// For all tiles</font> +00390 <font class="keywordflow">for</font> (sint nTile=0; nTile<(sint)<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size(); nTile++) +00391 { +00392 string tmp; +00393 uint32 pos; +00394 +00395 <font class="comment">// Diffuse</font> +00396 tmp= <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].getRelativeFileName (CTile::diffuse); +00397 pos= tmp.rfind(<font class="stringliteral">".tga"</font>); +00398 <font class="keywordflow">if</font>(pos!= string::npos) +00399 { +00400 tmp.replace(pos, 4, <font class="stringliteral">".dds"</font>); +00401 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].setFileName (CTile::diffuse, tmp); +00402 } +00403 +00404 <font class="comment">// Additive.</font> +00405 tmp= <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].getRelativeFileName (CTile::additive); +00406 pos= tmp.rfind(<font class="stringliteral">".tga"</font>); +00407 <font class="keywordflow">if</font>(pos!= string::npos) +00408 { +00409 tmp.replace(pos, 4, <font class="stringliteral">".dds"</font>); +00410 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].setFileName (CTile::additive, tmp); +00411 } +00412 +00413 <font class="comment">// Alpha.</font> +00414 tmp= <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].getRelativeFileName (CTile::alpha); +00415 pos= tmp.rfind(<font class="stringliteral">".tga"</font>); +00416 <font class="keywordflow">if</font>(pos!= string::npos) +00417 { +00418 tmp.replace(pos, 4, <font class="stringliteral">".dds"</font>); +00419 <a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>[nTile].setFileName (CTile::alpha, tmp); +00420 } +00421 +00422 } +00423 +00424 } +00425 <font class="comment">// ***************************************************************************</font> +<a name="l00426"></a><a class="code" href="classNL3D_1_1CTileBank.html#a18">00426</a> <font class="keywordtype">void</font> CTileBank::cleanUnusedData () +00427 { +00428 <font class="comment">// Clean each tileset</font> +00429 <font class="keywordflow">for</font> (uint i=0; i<<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size(); i++) +00430 { +00431 <font class="comment">// Clean the tileset</font> +00432 <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[i].cleanUnusedData (); +00433 } +00434 +00435 <font class="comment">// Clear the land vector</font> +00436 <a class="code" href="classNL3D_1_1CTileBank.html#o0">_LandVector</a>.clear(); +00437 } +00438 <font class="comment">// ***************************************************************************</font> +<a name="l00439"></a><a class="code" href="classNL3D_1_1CTileBank.html#z833_0">00439</a> CTileNoiseMap *CTileBank::getTileNoiseMap (uint tileNumber, uint tileSubNoise) +00440 { +00441 <font class="comment">// Check tile number..</font> +00442 <font class="keywordflow">if</font> (tileNumber<<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size()) +00443 { +00444 <font class="comment">// Get tileset number</font> +00445 uint tileSet=<a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[tileNumber]._XRefTileSet; +00446 +00447 <font class="comment">// Checks</font> +00448 <font class="keywordflow">if</font> (tileSet<<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size()) +00449 { +00450 <a class="code" href="debug_8h.html#a6">nlassert</a> (tileSubNoise<CTileSet::CountDisplace); +00451 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[tileSet]._DisplacementBitmap[tileSubNoise]<<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.size()); +00452 +00453 <font class="comment">// Return the tile noise map</font> +00454 CTileNoise &tileNoise=<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[tileSet]._DisplacementBitmap[tileSubNoise]]; +00455 +00456 <font class="comment">// Not loaded ?</font> +00457 <font class="keywordflow">if</font> (tileNoise._TileNoiseMap==NULL) +00458 { +00459 <font class="comment">// Load a bitmap</font> +00460 CTextureFile texture (<a class="code" href="classNL3D_1_1CTileBank.html#a28">getAbsPath</a>()+tileNoise._FileName); +00461 texture.loadGrayscaleAsAlpha (<font class="keyword">false</font>); +00462 texture.generate (); +00463 texture.convertToType (CBitmap::Luminance); +00464 +00465 <font class="comment">// Alloc</font> +00466 tileNoise._TileNoiseMap=<font class="keyword">new</font> CTileNoiseMap; +00467 +00468 <font class="comment">// Good size ?</font> +00469 <font class="keywordflow">if</font> ((texture.getWidth ()==<a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>)&&(texture.getHeight()==<a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>)) +00470 { +00471 <font class="comment">// Copy</font> +00472 memcpy (tileNoise._TileNoiseMap->Pixels, &texture.getPixels()[0], <a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>*<a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>); +00473 +00474 <font class="comment">// Remap lumels</font> +00475 <font class="keywordflow">for</font> (uint i=0; i<<a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>*<a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>; i++) +00476 { +00477 tileNoise._TileNoiseMap->Pixels[i]=(sint8)((uint8)tileNoise._TileNoiseMap->Pixels[i]-128); +00478 <font class="keywordflow">if</font> (tileNoise._TileNoiseMap->Pixels[i]==-128) +00479 tileNoise._TileNoiseMap->Pixels[i]=-127; +00480 } +00481 } +00482 <font class="keywordflow">else</font> +00483 { +00484 <font class="comment">// This is not a normal behaviour.</font> +00485 string pathname= <a class="code" href="classNL3D_1_1CTileBank.html#a28">getAbsPath</a>()+tileNoise._FileName; +00486 <font class="keywordflow">if</font>( texture.getWidth ()==0 || texture.getHeight ()==0 ) +00487 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"TileNoiseMap not found: %s."</font>, pathname.c_str()); +00488 <font class="keywordflow">else</font> +00489 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Bad TileNoiseMap size: %s."</font>, pathname.c_str()); +00490 +00491 <font class="comment">// Not good size, copy a static map</font> +00492 sint8 notGoodSizeForm[<a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>*<a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>]= +00493 { +00494 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00495 00, 99, 99, 99, 99, 99, 99, 99, 99, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00496 00, 99, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00497 00, 99, 00, 99, 99, 99, 99, 99, 99, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00498 00, 99, 00, 99, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00499 00, 99, 00, 99, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00500 00, 99, 00, 99, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00501 00, 99, 00, 99, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00502 00, 99, 00, 99, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00503 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00504 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00505 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00506 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00507 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00508 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00509 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00510 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00511 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00512 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00513 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00514 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00515 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00516 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +00517 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 99, 00, 99, 00, +00518 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 99, 00, 99, 00, +00519 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 99, 00, 99, 00, +00520 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 99, 00, 99, 00, +00521 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 99, 00, 99, 00, +00522 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 99, 99, 99, 99, 99, 99, 00, 99, 00, +00523 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 99, 00, +00524 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 99, 99, 99, 99, 99, 99, 99, 99, 00, +00525 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 +00526 }; +00527 +00528 <font class="comment">// Copy</font> +00529 memcpy (tileNoise._TileNoiseMap->Pixels, notGoodSizeForm, <a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>*<a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>); +00530 } +00531 } +00532 +00533 <font class="comment">// Return the noise map</font> +00534 <font class="keywordflow">return</font> tileNoise._TileNoiseMap; +00535 } +00536 } +00537 +00538 <font class="comment">// Checks</font> +00539 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[0]._TileNoiseMap); +00540 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[0]._TileNoiseMap; +00541 } +00542 <font class="comment">// ***************************************************************************</font> +<a name="l00543"></a><a class="code" href="classNL3D_1_1CTileBank.html#a24">00543</a> <font class="keywordtype">void</font> CTileBank::removeDisplacementMap (uint mapId) +00544 { +00545 <font class="comment">// Checks</font> +00546 <a class="code" href="debug_8h.html#a6">nlassert</a> (mapId<<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.size()); +00547 +00548 <font class="keywordflow">if</font> (mapId!=0) +00549 { +00550 <font class="comment">// Check if another tileSet uses it</font> +00551 uint tileSet; +00552 <font class="keywordflow">for</font> (tileSet=0; tileSet<<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size(); tileSet++) +00553 { +00554 <font class="comment">// It uses it ?</font> +00555 uint tile; +00556 <font class="keywordflow">for</font> (tile=0; tile<CTileSet::CountDisplace; tile++) +00557 { +00558 <font class="comment">// The same ?</font> +00559 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[tileSet]._DisplacementBitmap[tile]==mapId) +00560 <font class="comment">// Stop</font> +00561 <font class="keywordflow">break</font>; +00562 } +00563 <font class="keywordflow">if</font> (tile!=CTileSet::CountDisplace) +00564 <font class="keywordflow">break</font>; +00565 } +00566 <font class="keywordflow">if</font> (tileSet==<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size()) +00567 { +00568 <font class="comment">// Remove it</font> +00569 <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[mapId].reset(); +00570 +00571 <font class="comment">// Last element ?</font> +00572 <font class="keywordflow">if</font> (mapId==<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.size()-1) +00573 { +00574 <font class="comment">// Resize the array ?</font> +00575 <font class="keywordflow">while</font> ((mapId>0)&&(<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[mapId]._FileName==<font class="stringliteral">""</font>)) +00576 <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.resize (mapId--); +00577 } +00578 } +00579 } +00580 } +00581 <font class="comment">// ***************************************************************************</font> +00582 uint CTileBank::getDisplacementMap (<font class="keyword">const</font> string &fileName) +00583 { +00584 <font class="comment">// Lower string</font> +00585 string lower=fileName; +00586 lower=strlwr (lower); +00587 +00588 <font class="comment">// Look for this texture filename</font> +00589 uint noiseTile; +00590 <font class="keywordflow">for</font> (noiseTile=0; noiseTile<<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.size(); noiseTile++) +00591 { +00592 <font class="comment">// Same name ?</font> +00593 <font class="keywordflow">if</font> (lower==<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[noiseTile]._FileName) +00594 <font class="keywordflow">return</font> noiseTile; +00595 } +00596 +00597 <font class="comment">// Look for a free space</font> +00598 <font class="keywordflow">for</font> (noiseTile=0; noiseTile<<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.size(); noiseTile++) +00599 { +00600 <font class="comment">// Same name ?</font> +00601 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[noiseTile]._FileName==<font class="stringliteral">""</font>) +00602 <font class="keywordflow">break</font>; +00603 } +00604 <font class="keywordflow">if</font> (noiseTile==<a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.size()) +00605 { +00606 <font class="comment">// Add a tile</font> +00607 <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.resize (noiseTile+1); +00608 } +00609 +00610 <font class="comment">// Set the file name</font> +00611 <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[noiseTile]._FileName=lower; +00612 +00613 <font class="keywordflow">return</font> noiseTile; +00614 } +00615 <font class="comment">// ***************************************************************************</font> +<a name="l00616"></a><a class="code" href="classNL3D_1_1CTileBank.html#a21">00616</a> <font class="keyword">const</font> <font class="keywordtype">char</font>* CTileBank::getDisplacementMap (uint noiseMap) +00617 { +00618 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[noiseMap]._FileName.c_str(); +00619 } +00620 <font class="comment">// ***************************************************************************</font> +<a name="l00621"></a><a class="code" href="classNL3D_1_1CTileBank.html#a22">00621</a> <font class="keywordtype">void</font> CTileBank::setDisplacementMap (uint noiseMap, <font class="keyword">const</font> <font class="keywordtype">char</font> *newName) +00622 { +00623 <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>[noiseMap]._FileName=newName; +00624 } +00625 <font class="comment">// ***************************************************************************</font> +<a name="l00626"></a><a class="code" href="classNL3D_1_1CTileBank.html#a20">00626</a> uint CTileBank::getDisplacementMapCount ()<font class="keyword"> const</font> +00627 <font class="keyword"></font>{ +00628 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileBank.html#o4">_DisplacementMap</a>.size(); +00629 } +00630 +00631 +00632 <font class="comment">// ***************************************************************************</font> +<a name="l00633"></a><a class="code" href="classNL3D_1_1CTileBank.html#z833_1">00633</a> <font class="keyword">const</font> CTileVegetableDesc &CTileBank::getTileVegetableDesc(uint tileNumber)<font class="keyword"> const</font> +00634 <font class="keyword"></font>{ +00635 <font class="comment">// Check tile number..</font> +00636 <font class="keywordflow">if</font> (tileNumber<<a class="code" href="classNL3D_1_1CTileBank.html#o2">_TileVector</a>.size()) +00637 { +00638 <font class="comment">// Get tileset number</font> +00639 uint tileSet=<a class="code" href="classNL3D_1_1CTileBank.html#o3">_TileXRef</a>[tileNumber]._XRefTileSet; +00640 +00641 <font class="comment">// Checks</font> +00642 <font class="keywordflow">if</font> (tileSet<<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size()) +00643 { +00644 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[tileSet].getTileVegetableDesc(); +00645 } +00646 +00647 } +00648 +00649 <font class="comment">// if fails for any reason, return an empty tileVegetableDesc;</font> +00650 <font class="keyword">static</font> CTileVegetableDesc emptyTvd; +00651 <font class="keywordflow">return</font> emptyTvd; +00652 } +00653 +00654 +00655 <font class="comment">// ***************************************************************************</font> +<a name="l00656"></a><a class="code" href="classNL3D_1_1CTileBank.html#z833_2">00656</a> <font class="keywordtype">void</font> CTileBank::loadTileVegetableDescs() +00657 { +00658 <font class="comment">// For all tileSets.</font> +00659 uint tileSet; +00660 +00661 <font class="keywordflow">for</font>(tileSet=0; tileSet<<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size(); tileSet++) +00662 { +00663 <font class="comment">// load their fileName</font> +00664 <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[tileSet].loadTileVegetableDesc(); +00665 } +00666 } +00667 +00668 +00669 <font class="comment">// ***************************************************************************</font> +<a name="l00670"></a><a class="code" href="classNL3D_1_1CTileBank.html#z833_3">00670</a> <font class="keywordtype">void</font> CTileBank::initTileVegetableDescs(CVegetableManager *vegetableManager) +00671 { +00672 <font class="comment">// For all tileSets.</font> +00673 uint tileSet; +00674 +00675 <font class="keywordflow">for</font>(tileSet=0; tileSet<<a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>.size(); tileSet++) +00676 { +00677 CTileVegetableDesc &tvd= <a class="code" href="classNL3D_1_1CTileBank.html#o1">_TileSetVector</a>[tileSet].getTileVegetableDesc(); +00678 tvd.registerToManager(vegetableManager); +00679 } +00680 } +00681 +00682 +00683 <font class="comment">// ***************************************************************************</font> +00684 <font class="comment">// ***************************************************************************</font> +00685 <font class="comment">// CTile.</font> +00686 <font class="comment">// ***************************************************************************</font> +00687 <font class="comment">// ***************************************************************************</font> +00688 +00689 +00690 <font class="comment">// ***************************************************************************</font> +<a name="l00691"></a><a class="code" href="classNL3D_1_1CTile.html#r0">00691</a> <font class="keyword">const</font> sint CTile::_Version=4; +00692 <font class="comment">// ***************************************************************************</font> +<a name="l00693"></a><a class="code" href="classNL3D_1_1CTile.html#a3">00693</a> <font class="keywordtype">void</font> CTile::serial(IStream &f) <font class="keywordflow">throw</font>(EStream) +00694 { +00695 sint streamver = f.serialVersion(_Version); +00696 +00697 <font class="comment">// Tmp value</font> +00698 <font class="keywordtype">bool</font> tmp; +00699 string tmpStr; +00700 +00701 <font class="keywordflow">switch</font> (streamver) +00702 { +00703 <font class="keywordflow">case</font> 4: +00704 <font class="keywordflow">case</font> 3: +00705 <font class="keywordflow">case</font> 2: +00706 f.serial (_Flags); +00707 +00708 <font class="comment">// Version 2, flags are not the same</font> +00709 <font class="keywordflow">if</font> (streamver==2) +00710 _Flags=(_Flags&<a class="code" href="tile__bank_8h.html#a0">NL3D_CTILE_ROT_MASK</a>)|(_Flags&<a class="code" href="tile__bank_8h.html#a3">NL3D_CTILE_GROUP_MASK_V2</a>)|(((_Flags&<a class="code" href="tile__bank_8h.html#a7">NL3D_CTILE_FREE_FLAG_V2</a>)!=0)?<a class="code" href="tile__bank_8h.html#a6">NL3D_CTILE_FREE_FLAG</a>:0); +00711 <font class="keywordflow">if</font> (streamver==3) +00712 _Flags=(_Flags&<a class="code" href="tile__bank_8h.html#a0">NL3D_CTILE_ROT_MASK</a>)|(_Flags&<a class="code" href="tile__bank_8h.html#a4">NL3D_CTILE_GROUP_MASK_V3</a>)|(((_Flags&<a class="code" href="tile__bank_8h.html#a8">NL3D_CTILE_FREE_FLAG_V3</a>)!=0)?<a class="code" href="tile__bank_8h.html#a6">NL3D_CTILE_FREE_FLAG</a>:0); +00713 +00714 f.serial (_BitmapName[diffuse]); +00715 f.serial (_BitmapName[additive]); +00716 f.serial (_BitmapName[<a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>]); +00717 <font class="keywordflow">break</font>; +00718 <font class="keywordflow">case</font> 1: +00719 <font class="comment">// Don't need invert many more</font> +00720 f.serial (tmp); +00721 <font class="keywordflow">case</font> 0: +00722 <font class="comment">// Initialize flags</font> +00723 _Flags=0; +00724 +00725 <font class="comment">// Initialize alpha name</font> +00726 _BitmapName[<a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>]=<font class="stringliteral">""</font>; +00727 +00728 <font class="comment">// Read free flag</font> +00729 f.serial (tmp); +00730 +00731 <font class="comment">// If free, set the flag</font> +00732 <font class="keywordflow">if</font> (tmp) +00733 _Flags|=<a class="code" href="tile__bank_8h.html#a6">NL3D_CTILE_FREE_FLAG</a>; +00734 +00735 <font class="comment">// Read diffuse bitmap and additive</font> +00736 f.serial (_BitmapName[diffuse]); +00737 f.serial (_BitmapName[additive]); +00738 +00739 <font class="comment">// Don't need bump name</font> +00740 f.serial (tmpStr); +00741 +00742 <font class="keywordflow">break</font>; +00743 } +00744 } +00745 <font class="comment">// ***************************************************************************</font> +<a name="l00746"></a><a class="code" href="classNL3D_1_1CTile.html#c0">00746</a> <font class="keywordtype">void</font> CTile::clearTile (CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>) +00747 { +00748 <a class="code" href="classNL3D_1_1CTile.html#o1">_BitmapName</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>]=<font class="stringliteral">""</font>; +00749 } +00750 +00751 +00752 <font class="comment">// ***************************************************************************</font> +00753 <font class="comment">// ***************************************************************************</font> +00754 <font class="comment">// CTileSet.</font> +00755 <font class="comment">// ***************************************************************************</font> +00756 <font class="comment">// ***************************************************************************</font> +00757 +00758 +00759 <font class="comment">// ***************************************************************************</font> +<a name="l00760"></a><a class="code" href="classNL3D_1_1CTileSet.html#r0">00760</a> <font class="keyword">const</font> sint CTileSet::_Version=5; +00761 <font class="comment">// ***************************************************************************</font> +<a name="l00762"></a><a class="code" href="classNL3D_1_1CTileSet.html#r1">00762</a> <font class="keyword">const</font> <font class="keywordtype">char</font>* CTileSet::_ErrorMessage[CTileSet::errorCount]= +00763 { +00764 <font class="stringliteral">"No error."</font>, <font class="comment">// ok</font> +00765 <font class="stringliteral">"Top interface is incompatible."</font>, <font class="comment">// topInterfaceProblem</font> +00766 <font class="stringliteral">"Bottom interface is incompatible."</font>, <font class="comment">// bottomInterfaceProblem</font> +00767 <font class="stringliteral">"Left interface is incompatible."</font>, <font class="comment">// leftInterfaceProblem</font> +00768 <font class="stringliteral">"Right interface is incompatible."</font>, <font class="comment">// rightInterfaceProblem</font> +00769 <font class="stringliteral">"Add first a 128x128 tile."</font>, <font class="comment">// addFirstA128128</font> +00770 <font class="stringliteral">"Top and bottom interface not the same."</font>, <font class="comment">// topBottomNotTheSame, </font> +00771 <font class="stringliteral">"Right and left interface not the same."</font>, <font class="comment">// rightLeftNotTheSame</font> +00772 <font class="stringliteral">"Invalide bitmap size."</font>, <font class="comment">// sizeInvalide</font> +00773 }; +00774 <font class="comment">// ***************************************************************************</font> +<a name="l00775"></a><a class="code" href="classNL3D_1_1CTileSet.html#r2">00775</a> <font class="keyword">const</font> CTileSet::TFlagBorder CTileSet::_TransitionFlags[CTileSet::count][4]= +00776 { +00777 {_0000,_1111,_0111,_0111}, <font class="comment">// tile 0</font> +00778 {_0111,_1111,_0111,_1111}, <font class="comment">// tile 1</font> +00779 {_0000,_0111,_0000,_0111}, <font class="comment">// tile 2</font> +00780 {_1110,_1110,_1111,_0000}, <font class="comment">// tile 3</font> +00781 {_1110,_1111,_1111,_0111}, <font class="comment">// tile 4</font> +00782 {_0000,_1110,_0111,_0000}, <font class="comment">// tile 5</font> +00783 +00784 {_0000,_1111,_0001,_0001}, <font class="comment">// tile 6</font> +00785 {_0000,_1000,_0001,_0000}, <font class="comment">// tile 7</font> +00786 {_1111,_1000,_1111,_1000}, <font class="comment">// tile 8</font> +00787 {_1000,_1000,_1111,_0000}, <font class="comment">// tile 9</font> +00788 {_1000,_0000,_1000,_0000}, <font class="comment">// tile 10</font> +00789 {_1111,_0001,_1000,_1111}, <font class="comment">// tile 11</font> +00790 +00791 {_0000,_1111,_0111,_0001}, <font class="comment">// tile 12</font> +00792 {_0000,_1111,_0001,_0111}, <font class="comment">// tile 13</font> +00793 {_0111,_1111,_0001,_1111}, <font class="comment">// tile 14</font> +00794 {_1110,_1000,_1111,_0000}, <font class="comment">// tile 15</font> +00795 {_1000,_1110,_1111,_0000}, <font class="comment">// tile 16</font> +00796 {_1111,_0001,_1110,_1111}, <font class="comment">// tile 17</font> +00797 +00798 {_1000,_0000,_1110,_0000}, <font class="comment">// tile 18</font> +00799 {_0000,_0111,_0000,_0001}, <font class="comment">// tile 19</font> +00800 {_1111,_1000,_1111,_1110}, <font class="comment">// tile 21</font> +00801 {_0111,_0000,_0000,_1000}, <font class="comment">// tile 21</font> +00802 {_0000,_1000,_0111,_0000}, <font class="comment">// tile 22</font> +00803 {_1111,_0111,_1000,_1111}, <font class="comment">// tile 23</font> +00804 +00805 {_1111,_0000,_1110,_1110}, <font class="comment">// tile 24</font> +00806 {_1111,_1110,_1111,_1110}, <font class="comment">// tile 25</font> +00807 {_1110,_0000,_1110,_0000}, <font class="comment">// tile 26</font> +00808 {_0111,_0111,_0000,_1111}, <font class="comment">// tile 27</font> +00809 {_1111,_0111,_1110,_1111}, <font class="comment">// tile 28</font> +00810 {_0111,_0000,_0000,_1110}, <font class="comment">// tile 29</font> +00811 +00812 {_1111,_0000,_1000,_1000}, <font class="comment">// tile 30</font> +00813 {_0001,_0000,_0000,_1000}, <font class="comment">// tile 31</font> +00814 {_0001,_1111,_0001,_1111}, <font class="comment">// tile 32</font> +00815 {_0001,_0001,_0000,_1111}, <font class="comment">// tile 33</font> +00816 {_0000,_0001,_0000,_0001}, <font class="comment">// tile 34</font> +00817 {_1000,_1111,_1111,_0001}, <font class="comment">// tile 35</font> +00818 +00819 {_1111,_0000,_1000,_1110}, <font class="comment">// tile 36</font> +00820 {_1111,_0000,_1110,_1000}, <font class="comment">// tile 37</font> +00821 {_1000,_1111,_1111,_0111}, <font class="comment">// tile 38</font> +00822 {_0001,_0111,_0000,_1111}, <font class="comment">// tile 39</font> +00823 {_0111,_0001,_0000,_1111}, <font class="comment">// tile 40</font> +00824 {_1111,_1110,_1111,_1000}, <font class="comment">// tile 41</font> +00825 +00826 {_0000,_0001,_0000,_0111}, <font class="comment">// tile 42</font> +00827 {_1110,_0000,_1000,_0000}, <font class="comment">// tile 43</font> +00828 {_0001,_1111,_0111,_1111}, <font class="comment">// tile 44</font> +00829 {_0000,_1110,_0001,_0000}, <font class="comment">// tile 45</font> +00830 {_0001,_0000,_0000,_1110}, <font class="comment">// tile 46</font> +00831 {_1110,_1111,_1111,_0001} <font class="comment">// tile 47</font> +00832 }; +00833 <font class="comment">// ***************************************************************************</font> +<a name="l00834"></a><a class="code" href="classNL3D_1_1CTileSet.html#a0">00834</a> CTileSet::CTileSet () +00835 { +00836 <font class="comment">// Default, tileset 0</font> +00837 <a class="code" href="classNL3D_1_1CTileSet.html#o1">_Oriented</a> = <font class="keyword">false</font>; +00838 uint displace; +00839 <font class="keywordflow">for</font> (displace=<a class="code" href="classNL3D_1_1CTileSet.html#s31s14">FirstDisplace</a>; displace<<a class="code" href="classNL3D_1_1CTileSet.html#s31s16">CountDisplace</a>; displace++) +00840 <a class="code" href="classNL3D_1_1CTileSet.html#o9">_DisplacementBitmap</a>[displace]=0; +00841 +00842 <font class="comment">// Default user surface data</font> +00843 <a class="code" href="classNL3D_1_1CTileSet.html#m0">SurfaceData</a> = 0; +00844 } +00845 <font class="comment">// ***************************************************************************</font> +<a name="l00846"></a><a class="code" href="classNL3D_1_1CTileSet.html#a9">00846</a> <font class="keywordtype">void</font> CTileSet::setName (<font class="keyword">const</font> std::string& name) +00847 { +00848 <a class="code" href="classNL3D_1_1CTileSet.html#o0">_Name</a>=name; +00849 } +00850 <font class="comment">// ***************************************************************************</font> +<a name="l00851"></a><a class="code" href="classNL3D_1_1CTileSet.html#a23">00851</a> <font class="keyword">const</font> std::string& <a class="code" href="zone__lighter_8cpp.html#a11">CTileSet::getName</a> ()<font class="keyword"> const</font> +00852 <font class="keyword"></font>{ +00853 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#o0">_Name</a>; +00854 } +00855 <font class="comment">// ***************************************************************************</font> +<a name="l00856"></a><a class="code" href="classNL3D_1_1CTileSet.html#a42">00856</a> <font class="keywordtype">void</font> CTileSet::serial(IStream &f) <font class="keywordflow">throw</font>(EStream) +00857 { +00858 sint streamver = f.serialVersion(_Version); +00859 +00860 CTileBorder tmp; +00861 +00862 <font class="comment">// serial the user surface data</font> +00863 <font class="keywordflow">if</font> (streamver>=5) +00864 { +00865 f.serial (SurfaceData); +00866 } +00867 +00868 <font class="comment">// serial the oriented info which tell if the tile has a special orientation</font> +00869 <font class="keywordflow">if</font> (streamver>=4) +00870 { +00871 f.serial (_Oriented); +00872 } +00873 +00874 <font class="comment">// serial vegetable info.</font> +00875 <font class="keywordflow">if</font> (streamver>=3) +00876 { +00877 <font class="comment">// serialisze only the FileName, not the descrpitor</font> +00878 f.serial(_TileVegetableDescFileName); +00879 } +00880 +00881 <font class="comment">// New version</font> +00882 <font class="keywordflow">if</font> (streamver>=2) +00883 { +00884 uint displace; +00885 <font class="keywordflow">for</font> (displace=FirstDisplace; displace<CountDisplace; displace++) +00886 f.serial (_DisplacementBitmap[displace]); +00887 } +00888 +00889 <font class="comment">// Serial displacement map filename, obsolete</font> +00890 <font class="keywordflow">if</font> (streamver==1) +00891 { +00892 <font class="comment">// Remove obsolete data</font> +00893 string tmp; +00894 <font class="keywordflow">for</font> (uint displace=FirstDisplace; displace<CountDisplace; displace++) +00895 f.serial (tmp); +00896 } +00897 +00898 <font class="keywordtype">int</font> i; +00899 f.serial (_Name); +00900 f.serialCont (_Tile128); +00901 f.serialCont (_Tile256); +00902 <font class="keywordflow">for</font> (i=0; i<count; i++) +00903 f.serial (_TileTransition[i]); +00904 f.serialCont (_ChildName); +00905 f.serial (_Border128[CTile::diffuse]); +00906 f.serial (_Border128[CTile::additive]); +00907 +00908 <font class="comment">// old field, border bump 128</font> +00909 <font class="keywordflow">if</font> (streamver==0) +00910 f.serial (tmp); +00911 +00912 f.serial (_Border256[CTile::diffuse]); +00913 f.serial (_Border256[CTile::additive]); +00914 +00915 <font class="comment">// old field, border bump 256</font> +00916 <font class="keywordflow">if</font> (streamver==0) +00917 f.serial (tmp); +00918 +00919 <font class="keywordflow">for</font> (i=0; i<count; i++) +00920 { +00921 f.serial (_BorderTransition[i][CTile::diffuse]); +00922 f.serial (_BorderTransition[i][CTile::additive]); +00923 f.serial (_BorderTransition[i][CTile::alpha]); +00924 +00925 <font class="comment">// Reset the diffuse and alpha border if old version</font> +00926 <font class="keywordflow">if</font> (streamver==0) +00927 { +00928 _BorderTransition[i][CTile::diffuse].reset(); +00929 _BorderTransition[i][CTile::alpha].reset(); +00930 } +00931 } +00932 } +00933 <font class="comment">// ***************************************************************************</font> +<a name="l00934"></a><a class="code" href="classNL3D_1_1CTileSet.html#a1">00934</a> <font class="keywordtype">void</font> CTileSet::addTile128 (<font class="keywordtype">int</font>& indexInTileSet, CTileBank& bank) +00935 { +00936 <font class="comment">// Create a tile</font> +00937 sint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=bank.createTile (); +00938 +00939 <font class="comment">// Index of the new tile</font> +00940 indexInTileSet=<a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>.size(); +00941 +00942 <font class="comment">// Add to the end of the list</font> +00943 <a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>.push_back (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>); +00944 } +00945 <font class="comment">// ***************************************************************************</font> +<a name="l00946"></a><a class="code" href="classNL3D_1_1CTileSet.html#a15">00946</a> <font class="keywordtype">void</font> CTileSet::setBorder (CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, <font class="keyword">const</font> CTileBorder& <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>) +00947 { +00948 <font class="comment">// This is our new border desc</font> +00949 <a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>]=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>; +00950 <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>]=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>; +00951 <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>].doubleSize (); +00952 } +00953 <font class="comment">// ***************************************************************************</font> +<a name="l00954"></a><a class="code" href="classNL3D_1_1CTileSet.html#a11">00954</a> <font class="keywordtype">void</font> CTileSet::setTile128 (<font class="keywordtype">int</font> indexInTileSet, <font class="keyword">const</font> std::string& name, CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, CTileBank& bank) +00955 { +00956 <font class="comment">// Edit a tile</font> +00957 CTile *tile=bank.getTile (<a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>[indexInTileSet]); +00958 tile->setFileName (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, name); +00959 tile->setRotAlpha (0); +00960 } +00961 <font class="comment">// ***************************************************************************</font> +<a name="l00962"></a><a class="code" href="classNL3D_1_1CTileSet.html#a20">00962</a> CTileSet::TError CTileSet::checkTile128 (CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, <font class="keyword">const</font> CTileBorder& <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <font class="keywordtype">int</font>& pixel, <font class="keywordtype">int</font>& composante) +00963 { +00964 <font class="comment">// Self check</font> +00965 <font class="keywordflow">if</font> ((<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>.getWidth()!=128)||(<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>.getHeight()!=128)) +00966 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s8">sizeInvalide</a>; +00967 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, CTileBorder::top, CTileBorder::bottom, pixel, composante)) +00968 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s6">topBottomNotTheSame</a>; +00969 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, CTileBorder::left, CTileBorder::right, pixel, composante)) +00970 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s7">rightLeftNotTheSame</a>; +00971 +00972 <font class="comment">// Check</font> +00973 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>].isSet()) +00974 { +00975 <font class="comment">// Other check</font> +00976 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::top, CTileBorder::top, pixel, composante)) +00977 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s1">topInterfaceProblem</a>; +00978 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::bottom, CTileBorder::bottom, pixel, composante)) +00979 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s2">bottomInterfaceProblem</a>; +00980 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::left, CTileBorder::left, pixel, composante)) +00981 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s3">leftInterfaceProblem</a>; +00982 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::right, CTileBorder::right, pixel, composante)) +00983 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s4">rightInterfaceProblem</a>; +00984 } +00985 <font class="keywordflow">else</font> +00986 { +00987 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s5">addFirstA128128</a>; +00988 } +00989 +00990 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s0">ok</a>; +00991 } +00992 <font class="comment">// ***************************************************************************</font> +<a name="l00993"></a><a class="code" href="classNL3D_1_1CTileSet.html#a2">00993</a> <font class="keywordtype">void</font> CTileSet::addTile256 (<font class="keywordtype">int</font>& indexInTileSet, CTileBank& bank) +00994 { +00995 <font class="comment">// Create a tile</font> +00996 sint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=bank.createTile (); +00997 +00998 <font class="comment">// Index of the new tile</font> +00999 indexInTileSet=<a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>.size(); +01000 +01001 <font class="comment">// Add to the end of the list</font> +01002 <a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>.push_back (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>); +01003 } +01004 <font class="comment">// ***************************************************************************</font> +<a name="l01005"></a><a class="code" href="classNL3D_1_1CTileSet.html#a21">01005</a> CTileSet::TError CTileSet::checkTile256 (CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, <font class="keyword">const</font> CTileBorder& <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <font class="keywordtype">int</font>& pixel, <font class="keywordtype">int</font>& composante) +01006 { +01007 <font class="comment">// Self check</font> +01008 <font class="keywordflow">if</font> ((<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>.getWidth()!=256)||(<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>.getHeight()!=256)) +01009 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s8">sizeInvalide</a>; +01010 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, CTileBorder::top, CTileBorder::bottom, pixel, composante)) +01011 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s6">topBottomNotTheSame</a>; +01012 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, CTileBorder::left, CTileBorder::right, pixel, composante)) +01013 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s7">rightLeftNotTheSame</a>; +01014 +01015 <font class="comment">// Check if prb</font> +01016 <font class="keywordflow">if</font> ((!<a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>].isSet())&&(<a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>].isSet())) +01017 { +01018 <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>]=<a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>]; +01019 <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>].doubleSize (); +01020 } +01021 +01022 <font class="comment">// Check</font> +01023 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>].isSet()) +01024 { +01025 +01026 <font class="comment">// Other check</font> +01027 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::top, CTileBorder::top, pixel, composante)) +01028 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s1">topInterfaceProblem</a>; +01029 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::bottom, CTileBorder::bottom, pixel, composante)) +01030 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s2">bottomInterfaceProblem</a>; +01031 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::left, CTileBorder::left, pixel, composante)) +01032 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s3">leftInterfaceProblem</a>; +01033 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::right, CTileBorder::right, pixel, composante)) +01034 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s4">rightInterfaceProblem</a>; +01035 } +01036 <font class="keywordflow">else</font> +01037 { +01038 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s5">addFirstA128128</a>; +01039 } +01040 +01041 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s0">ok</a>; +01042 } +01043 <font class="comment">// ***************************************************************************</font> +<a name="l01044"></a><a class="code" href="classNL3D_1_1CTileSet.html#a12">01044</a> <font class="keywordtype">void</font> CTileSet::setTile256 (<font class="keywordtype">int</font> indexInTileSet, <font class="keyword">const</font> std::string& name, CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, CTileBank& bank) +01045 { +01046 <font class="comment">// Edit a tile</font> +01047 CTile *tile=bank.getTile (<a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>[indexInTileSet]); +01048 tile->setFileName (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, name); +01049 tile->setRotAlpha (0); +01050 } +01051 <font class="comment">// ***************************************************************************</font> +<a name="l01052"></a><a class="code" href="classNL3D_1_1CTileSet.html#a13">01052</a> <font class="keywordtype">void</font> CTileSet::setTileTransition (TTransition transition, <font class="keyword">const</font> std::string& name, CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, CTileBank& bank, +01053 <font class="keyword">const</font> CTileBorder& <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>) +01054 { +01055 <font class="comment">// Check is not an alpha channel</font> +01056 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>!=CTile::alpha); <font class="comment">// use setTileTransitionAlpha</font> +01057 +01058 <font class="comment">// Create a tile</font> +01059 <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[transition][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>]=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>; +01060 +01061 <font class="comment">// Set the tile file name</font> +01062 CTile *tile=bank.getTile (<a class="code" href="classNL3D_1_1CTileSet.html#o4">_TileTransition</a>[transition]._Tile); +01063 tile->setFileName (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, name); +01064 } +01065 <font class="comment">// ***************************************************************************</font> +<a name="l01066"></a><a class="code" href="classNL3D_1_1CTileSet.html#a14">01066</a> <font class="keywordtype">void</font> CTileSet::setTileTransitionAlpha (TTransition transition, <font class="keyword">const</font> std::string& name, CTileBank& bank, +01067 <font class="keyword">const</font> CTileBorder& <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, uint8 rot) +01068 { +01069 <font class="comment">// Check some args</font> +01070 <a class="code" href="debug_8h.html#a6">nlassert</a> (rot<4); +01071 +01072 <font class="comment">// Create a tile</font> +01073 <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[transition][CTile::alpha]=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>; +01074 +01075 <font class="comment">// Set the tile file name</font> +01076 CTile *tile=bank.getTile (<a class="code" href="classNL3D_1_1CTileSet.html#o4">_TileTransition</a>[transition]._Tile); +01077 tile->setFileName (CTile::alpha, name); +01078 tile->setRotAlpha (rot); +01079 } +01080 <font class="comment">// ***************************************************************************</font> +<a name="l01081"></a><a class="code" href="classNL3D_1_1CTileSet.html#a22">01081</a> CTileSet::TError CTileSet::checkTileTransition (TTransition transition, CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, <font class="keyword">const</font> CTileBorder& <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <font class="keywordtype">int</font>& indexError, +01082 <font class="keywordtype">int</font>& pixel, <font class="keywordtype">int</font>& composante) +01083 { +01084 <a class="code" href="debug_8h.html#a6">nlassert</a> (transition>=0); +01085 <a class="code" href="debug_8h.html#a6">nlassert</a> (transition<<a class="code" href="classNL3D_1_1CTileSet.html#s30s12">count</a>); +01086 +01087 <font class="comment">// Check</font> +01088 indexError=-1; +01089 +01090 <font class="comment">// Top</font> +01091 indexError=<a class="code" href="classNL3D_1_1CTileSet.html#a37">getExistingTransitionTile</a> ((<a class="code" href="classNL3D_1_1CTileSet.html#s33">TFlagBorder</a>)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s17">top</a>], <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, transition, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01092 <font class="keywordflow">if</font> (indexError!=-1) +01093 { +01094 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[indexError][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::top, CTileBorder::top, pixel, composante)) +01095 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s1">topInterfaceProblem</a>; +01096 } +01097 indexError=<a class="code" href="classNL3D_1_1CTileSet.html#a37">getExistingTransitionTile</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, (<a class="code" href="classNL3D_1_1CTileSet.html#s33">TFlagBorder</a>)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s17">top</a>], <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, transition, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01098 <font class="keywordflow">if</font> (indexError!=-1) +01099 { +01100 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[indexError][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::top, CTileBorder::bottom, pixel, composante)) +01101 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s1">topInterfaceProblem</a>; +01102 } +01103 indexError=-1; +01104 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s17">top</a>]==<a class="code" href="classNL3D_1_1CTileSet.html#s33s22">_1111</a>) +01105 { +01106 <font class="keywordflow">if</font> (!CTileBorder::allAlphaSet (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, CTileBorder::top, pixel, composante)) +01107 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s1">topInterfaceProblem</a>; +01108 } +01109 +01110 <font class="comment">// Bottom</font> +01111 indexError=<a class="code" href="classNL3D_1_1CTileSet.html#a37">getExistingTransitionTile</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, (<a class="code" href="classNL3D_1_1CTileSet.html#s33">TFlagBorder</a>)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s18">bottom</a>], <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, transition, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01112 <font class="keywordflow">if</font> (indexError!=-1) +01113 { +01114 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[indexError][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::bottom, CTileBorder::bottom, pixel, composante)) +01115 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s2">bottomInterfaceProblem</a>; +01116 } +01117 indexError=<a class="code" href="classNL3D_1_1CTileSet.html#a37">getExistingTransitionTile</a> ((<a class="code" href="classNL3D_1_1CTileSet.html#s33">TFlagBorder</a>)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s18">bottom</a>], <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, transition, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01118 <font class="keywordflow">if</font> (indexError!=-1) +01119 { +01120 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[indexError][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::bottom, CTileBorder::top, pixel, composante)) +01121 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s2">bottomInterfaceProblem</a>; +01122 } +01123 indexError=-1; +01124 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s18">bottom</a>]==<a class="code" href="classNL3D_1_1CTileSet.html#s33s22">_1111</a>) +01125 { +01126 <font class="keywordflow">if</font> (!CTileBorder::allAlphaSet (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, CTileBorder::bottom, pixel, composante)) +01127 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s2">bottomInterfaceProblem</a>; +01128 } +01129 +01130 <font class="comment">// Left</font> +01131 indexError=<a class="code" href="classNL3D_1_1CTileSet.html#a37">getExistingTransitionTile</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, (<a class="code" href="classNL3D_1_1CTileSet.html#s33">TFlagBorder</a>)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s19">left</a>], <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, transition, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01132 <font class="keywordflow">if</font> (indexError!=-1) +01133 { +01134 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[indexError][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::left, CTileBorder::left, pixel, composante)) +01135 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s3">leftInterfaceProblem</a>; +01136 } +01137 indexError=<a class="code" href="classNL3D_1_1CTileSet.html#a37">getExistingTransitionTile</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, (<a class="code" href="classNL3D_1_1CTileSet.html#s33">TFlagBorder</a>)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s19">left</a>], transition, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01138 <font class="keywordflow">if</font> (indexError!=-1) +01139 { +01140 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[indexError][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::left, CTileBorder::right, pixel, composante)) +01141 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s3">leftInterfaceProblem</a>; +01142 } +01143 indexError=-1; +01144 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s19">left</a>]==<a class="code" href="classNL3D_1_1CTileSet.html#s33s22">_1111</a>) +01145 { +01146 <font class="keywordflow">if</font> (!CTileBorder::allAlphaSet (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, CTileBorder::left, pixel, composante)) +01147 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s3">leftInterfaceProblem</a>; +01148 } +01149 +01150 <font class="comment">// Right</font> +01151 indexError=<a class="code" href="classNL3D_1_1CTileSet.html#a37">getExistingTransitionTile</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, (<a class="code" href="classNL3D_1_1CTileSet.html#s33">TFlagBorder</a>)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s20">right</a>], transition, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01152 <font class="keywordflow">if</font> (indexError!=-1) +01153 { +01154 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[indexError][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::right, CTileBorder::right, pixel, composante)) +01155 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s4">rightInterfaceProblem</a>; +01156 } +01157 indexError=<a class="code" href="classNL3D_1_1CTileSet.html#a37">getExistingTransitionTile</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, (<a class="code" href="classNL3D_1_1CTileSet.html#s33">TFlagBorder</a>)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s20">right</a>], <a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>, transition, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01158 <font class="keywordflow">if</font> (indexError!=-1) +01159 { +01160 <font class="keywordflow">if</font> (!CTileBorder::compare (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[indexError][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>], CTileBorder::right, CTileBorder::left, pixel, composante)) +01161 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s4">rightInterfaceProblem</a>; +01162 } +01163 indexError=-1; +01164 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s20">right</a>]==<a class="code" href="classNL3D_1_1CTileSet.html#s33s22">_1111</a>) +01165 { +01166 <font class="keywordflow">if</font> (!CTileBorder::allAlphaSet (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, CTileBorder::right, pixel, composante)) +01167 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s4">rightInterfaceProblem</a>; +01168 } +01169 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s29s0">ok</a>; +01170 } +01171 <font class="comment">// ***************************************************************************</font> +<a name="l01172"></a><a class="code" href="classNL3D_1_1CTileSet.html#a3">01172</a> <font class="keywordtype">void</font> CTileSet::removeTile128 (<font class="keywordtype">int</font> indexInTileSet, CTileBank& bank) +01173 { +01174 <font class="comment">// Check args</font> +01175 <a class="code" href="debug_8h.html#a6">nlassert</a> (indexInTileSet>=0); +01176 <a class="code" href="debug_8h.html#a6">nlassert</a> (indexInTileSet<(sint)<a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>.size()); +01177 +01178 <font class="comment">// Old index</font> +01179 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=<a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>[indexInTileSet]; +01180 +01181 <font class="comment">// Erase</font> +01182 <a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>.erase (<a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>.begin()+indexInTileSet); +01183 bank.freeTile (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>); +01184 +01185 <font class="comment">// Erase border if it is the last texture</font> +01186 <a class="code" href="classNL3D_1_1CTileSet.html#c0">deleteBordersIfLast</a> (bank, CTile::diffuse); +01187 <a class="code" href="classNL3D_1_1CTileSet.html#c0">deleteBordersIfLast</a> (bank, CTile::additive); +01188 <a class="code" href="classNL3D_1_1CTileSet.html#c0">deleteBordersIfLast</a> (bank, CTile::alpha); +01189 } +01190 <font class="comment">// ***************************************************************************</font> +<a name="l01191"></a><a class="code" href="classNL3D_1_1CTileSet.html#a4">01191</a> <font class="keywordtype">void</font> CTileSet::removeTile256 (<font class="keywordtype">int</font> indexInTileSet, CTileBank& bank) +01192 { +01193 <font class="comment">// Check args</font> +01194 <a class="code" href="debug_8h.html#a6">nlassert</a> (indexInTileSet>=0); +01195 <a class="code" href="debug_8h.html#a6">nlassert</a> (indexInTileSet<(sint)<a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>.size()); +01196 +01197 <font class="comment">// Old index</font> +01198 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=<a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>[indexInTileSet]; +01199 +01200 <font class="comment">// Erase</font> +01201 <a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>.erase (<a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>.begin()+indexInTileSet); +01202 bank.freeTile (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>); +01203 +01204 <font class="comment">// Erase border if it is the last texture</font> +01205 <a class="code" href="classNL3D_1_1CTileSet.html#c0">deleteBordersIfLast</a> (bank, CTile::diffuse); +01206 <a class="code" href="classNL3D_1_1CTileSet.html#c0">deleteBordersIfLast</a> (bank, CTile::additive); +01207 <a class="code" href="classNL3D_1_1CTileSet.html#c0">deleteBordersIfLast</a> (bank, CTile::alpha); +01208 } +01209 <font class="comment">// ***************************************************************************</font> +<a name="l01210"></a><a class="code" href="classNL3D_1_1CTileSet.html#d1">01210</a> CTileSet::TTransition CTileSet::getTransitionTile (TFlagBorder _top, TFlagBorder _bottom, TFlagBorder _left, TFlagBorder _right) +01211 { +01212 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> n=<a class="code" href="classNL3D_1_1CTileSet.html#s30s10">first</a>; n<<a class="code" href="classNL3D_1_1CTileSet.html#s30s12">count</a>; n++) +01213 { +01214 <font class="keywordflow">if</font> (((_top==<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>)||(_top==(TFlagBorder)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[n][<a class="code" href="classNL3D_1_1CTileSet.html#s32s17">top</a>]))&& +01215 ((_bottom==<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>)||(_bottom==(TFlagBorder)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[n][<a class="code" href="classNL3D_1_1CTileSet.html#s32s18">bottom</a>]))&& +01216 ((_left==<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>)||(_left==(TFlagBorder)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[n][<a class="code" href="classNL3D_1_1CTileSet.html#s32s19">left</a>]))&& +01217 ((_right==<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>)||(_right==(TFlagBorder)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[n][<a class="code" href="classNL3D_1_1CTileSet.html#s32s20">right</a>]))) +01218 { +01219 <font class="keywordflow">return</font> (TTransition)n; +01220 } +01221 } +01222 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s30s13">notfound</a>; +01223 } +01224 <font class="comment">// ***************************************************************************</font> +<a name="l01225"></a><a class="code" href="classNL3D_1_1CTileSet.html#a37">01225</a> CTileSet::TTransition CTileSet::getExistingTransitionTile (TFlagBorder _top, TFlagBorder _bottom, TFlagBorder _left, TFlagBorder _right, <font class="keywordtype">int</font> reject, CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>) +01226 { +01227 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> n=<a class="code" href="classNL3D_1_1CTileSet.html#s30s10">first</a>; n<<a class="code" href="classNL3D_1_1CTileSet.html#s30s12">count</a>; n++) +01228 { +01229 <font class="keywordflow">if</font> ((n!=reject)&& +01230 (<a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[n][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>].isSet ())&& +01231 ((_top==<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>)||(_top==(TFlagBorder)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[n][<a class="code" href="classNL3D_1_1CTileSet.html#s32s17">top</a>]))&& +01232 ((_bottom==<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>)||(_bottom==(TFlagBorder)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[n][<a class="code" href="classNL3D_1_1CTileSet.html#s32s18">bottom</a>]))&& +01233 ((_left==<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>)||(_left==(TFlagBorder)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[n][<a class="code" href="classNL3D_1_1CTileSet.html#s32s19">left</a>]))&& +01234 ((_right==<a class="code" href="classNL3D_1_1CTileSet.html#s33s28">dontcare</a>)||(_right==(TFlagBorder)<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[n][<a class="code" href="classNL3D_1_1CTileSet.html#s32s20">right</a>]))) +01235 { +01236 <font class="keywordflow">return</font> (TTransition)n; +01237 } +01238 } +01239 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s30s13">notfound</a>; +01240 } +01241 <font class="comment">// ***************************************************************************</font> +<a name="l01242"></a><a class="code" href="classNL3D_1_1CTileSet.html#a39">01242</a> <font class="keywordtype">void</font> CTileSet::addChild (<font class="keyword">const</font> std::string& name) +01243 { +01244 <a class="code" href="classNL3D_1_1CTileSet.html#o5">_ChildName</a>.insert (name); +01245 } +01246 <font class="comment">// ***************************************************************************</font> +<a name="l01247"></a><a class="code" href="classNL3D_1_1CTileSet.html#a40">01247</a> <font class="keywordtype">void</font> CTileSet::removeChild (<font class="keyword">const</font> std::string& name) +01248 { +01249 <a class="code" href="classNL3D_1_1CTileSet.html#o5">_ChildName</a>.erase (name); +01250 } +01251 <font class="comment">// ***************************************************************************</font> +<a name="l01252"></a><a class="code" href="classNL3D_1_1CTileSet.html#d2">01252</a> CTileSet::TTransition CTileSet::getComplementaryTransition (TTransition transition) +01253 { +01254 <a class="code" href="debug_8h.html#a6">nlassert</a> ((transition>=<a class="code" href="classNL3D_1_1CTileSet.html#s30s10">first</a>)&&(transition<=<a class="code" href="classNL3D_1_1CTileSet.html#s30s11">last</a>)); +01255 <a class="code" href="classNL3D_1_1CTileSet.html#s30">TTransition</a> trans=<a class="code" href="classNL3D_1_1CTileSet.html#d1">getTransitionTile</a> (<a class="code" href="classNL3D_1_1CTileSet.html#f0">getComplementaryBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s17">top</a>]), +01256 <a class="code" href="classNL3D_1_1CTileSet.html#f0">getComplementaryBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s18">bottom</a>]), +01257 <a class="code" href="classNL3D_1_1CTileSet.html#f0">getComplementaryBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s19">left</a>]), +01258 <a class="code" href="classNL3D_1_1CTileSet.html#f0">getComplementaryBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s20">right</a>])); +01259 +01260 <a class="code" href="debug_8h.html#a6">nlassert</a> (trans!=<a class="code" href="classNL3D_1_1CTileSet.html#s30s13">notfound</a>); +01261 +01262 <font class="keywordflow">return</font> trans; +01263 } +01264 <font class="comment">// ***************************************************************************</font> +<a name="l01265"></a><a class="code" href="classNL3D_1_1CTileSet.html#f0">01265</a> CTileSet::TFlagBorder CTileSet::getComplementaryBorder (TFlagBorder <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>) +01266 { +01267 <font class="keywordflow">switch</font> (border) +01268 { +01269 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s27">_0000</a>: +01270 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s22">_1111</a>; +01271 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s25">_0001</a>: +01272 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s24">_1110</a>; +01273 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s23">_0111</a>: +01274 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s26">_1000</a>; +01275 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s26">_1000</a>: +01276 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s23">_0111</a>; +01277 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s24">_1110</a>: +01278 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s25">_0001</a>; +01279 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s22">_1111</a>: +01280 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s27">_0000</a>; +01281 <font class="keywordflow">default</font>: +01282 <a class="code" href="debug_8h.html#a6">nlassert</a> (0); <font class="comment">// no</font> +01283 } +01284 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s27">_0000</a>; +01285 } +01286 <font class="comment">// ***************************************************************************</font> +<a name="l01287"></a><a class="code" href="classNL3D_1_1CTileSet.html#d3">01287</a> CTileSet::TFlagBorder CTileSet::getInvertBorder (TFlagBorder <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>) +01288 { +01289 <font class="keywordflow">switch</font> (border) +01290 { +01291 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s27">_0000</a>: +01292 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s27">_0000</a>; +01293 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s25">_0001</a>: +01294 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s26">_1000</a>; +01295 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s23">_0111</a>: +01296 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s24">_1110</a>; +01297 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s26">_1000</a>: +01298 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s25">_0001</a>; +01299 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s24">_1110</a>: +01300 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s23">_0111</a>; +01301 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s22">_1111</a>: +01302 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s22">_1111</a>; +01303 <font class="keywordflow">default</font>: +01304 <a class="code" href="debug_8h.html#a6">nlassert</a> (0); <font class="comment">// no</font> +01305 } +01306 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s27">_0000</a>; +01307 } +01308 <font class="comment">// ***************************************************************************</font> +<a name="l01309"></a><a class="code" href="classNL3D_1_1CTileSet.html#d4">01309</a> CTileSet::TFlagBorder CTileSet::getOrientedBorder (TBorder where, TFlagBorder <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>) +01310 { +01311 <font class="keywordflow">switch</font> (where) +01312 { +01313 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s32s19">left</a>: +01314 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s32s18">bottom</a>: +01315 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>; +01316 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s32s17">top</a>: +01317 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CTileSet.html#s32s20">right</a>: +01318 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#d3">getInvertBorder</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>); +01319 <font class="keywordflow">default</font>: +01320 <a class="code" href="debug_8h.html#a6">nlassert</a> (0); <font class="comment">// no</font> +01321 } +01322 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#s33s27">_0000</a>; +01323 } +01324 <font class="comment">// ***************************************************************************</font> +<a name="l01325"></a><a class="code" href="classNL3D_1_1CTileSet.html#d6">01325</a> CTileSet::TTransition CTileSet::rotateTransition (TTransition transition) +01326 { +01327 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#d1">getTransitionTile</a> ( +01328 <a class="code" href="classNL3D_1_1CTileSet.html#d4">getOrientedBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s32s17">top</a>, <a class="code" href="classNL3D_1_1CTileSet.html#d4">getOrientedBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s32s20">right</a>, <a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s20">right</a>])), <font class="comment">// top</font> +01329 <a class="code" href="classNL3D_1_1CTileSet.html#d4">getOrientedBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s32s18">bottom</a>, <a class="code" href="classNL3D_1_1CTileSet.html#d4">getOrientedBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s32s19">left</a>, <a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s19">left</a>])), <font class="comment">// bottom</font> +01330 <a class="code" href="classNL3D_1_1CTileSet.html#d4">getOrientedBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s32s19">left</a>, <a class="code" href="classNL3D_1_1CTileSet.html#d4">getOrientedBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s32s17">top</a>, <a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s17">top</a>])), <font class="comment">// left</font> +01331 <a class="code" href="classNL3D_1_1CTileSet.html#d4">getOrientedBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s32s20">right</a>, <a class="code" href="classNL3D_1_1CTileSet.html#d4">getOrientedBorder</a> (<a class="code" href="classNL3D_1_1CTileSet.html#s32s18">bottom</a>, <a class="code" href="classNL3D_1_1CTileSet.html#r2">_TransitionFlags</a>[transition][<a class="code" href="classNL3D_1_1CTileSet.html#s32s18">bottom</a>])) <font class="comment">// right</font> +01332 ); +01333 } +01334 <font class="comment">// ***************************************************************************</font> +<a name="l01335"></a><a class="code" href="classNL3D_1_1CTileSet.html#a5">01335</a> <font class="keywordtype">void</font> CTileSet::clearTile128 (<font class="keywordtype">int</font> indexInTileSet, CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, CTileBank& bank) +01336 { +01337 <font class="keywordtype">int</font> nTile=<a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>[indexInTileSet]; +01338 bank.getTile (nTile)->clearTile(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01339 +01340 <font class="comment">// Erase border if it is the last texture</font> +01341 <a class="code" href="classNL3D_1_1CTileSet.html#c0">deleteBordersIfLast</a> (bank, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01342 } +01343 <font class="comment">// ***************************************************************************</font> +<a name="l01344"></a><a class="code" href="classNL3D_1_1CTileSet.html#a6">01344</a> <font class="keywordtype">void</font> CTileSet::clearTile256 (<font class="keywordtype">int</font> indexInTileSet, CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, CTileBank& bank) +01345 { +01346 <font class="keywordtype">int</font> nTile=<a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>[indexInTileSet]; +01347 bank.getTile (nTile)->clearTile(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01348 +01349 <font class="comment">// Erase border if it is the last texture</font> +01350 <a class="code" href="classNL3D_1_1CTileSet.html#c0">deleteBordersIfLast</a> (bank, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01351 } +01352 <font class="comment">// ***************************************************************************</font> +<a name="l01353"></a><a class="code" href="classNL3D_1_1CTileSet.html#a7">01353</a> <font class="keywordtype">void</font> CTileSet::clearTransition (TTransition transition, CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, CTileBank& bank) +01354 { +01355 <font class="keywordtype">int</font> nTile=<a class="code" href="classNL3D_1_1CTileSet.html#o4">_TileTransition</a>[transition]._Tile; +01356 <font class="keywordflow">if</font> (nTile!=-1) +01357 bank.getTile (nTile)->clearTile(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01358 <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[transition][<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>].reset(); +01359 +01360 <font class="comment">// Erase border if it is the last texture</font> +01361 <a class="code" href="classNL3D_1_1CTileSet.html#c0">deleteBordersIfLast</a> (bank, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>); +01362 } +01363 <font class="comment">// ***************************************************************************</font> +01364 <font class="comment">// Delete 128 and 256 borders if no more valid texture file name for each bitmap type.</font> +<a name="l01365"></a><a class="code" href="classNL3D_1_1CTileSet.html#c0">01365</a> <font class="keywordtype">void</font> CTileSet::deleteBordersIfLast (<font class="keyword">const</font> CTileBank& bank, CTile::TBitmap <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>) +01366 { +01367 <font class="comment">// delete is true</font> +01368 <font class="keywordtype">bool</font> bDelete=<font class="keyword">true</font>; +01369 +01370 <font class="comment">// iterator..</font> +01371 std::vector<sint32>::iterator ite=<a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>.begin(); +01372 +01373 <font class="comment">// Check all the 128x128 tiles</font> +01374 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>.end()) +01375 { +01376 <font class="comment">// If the file name is valid</font> +01377 <font class="keywordflow">if</font> (bank.getTile (*ite)->getRelativeFileName(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)!=<font class="stringliteral">""</font>) +01378 { +01379 <font class="comment">// Don't delete, </font> +01380 bDelete=<font class="keyword">false</font>; +01381 <font class="keywordflow">break</font>; +01382 } +01383 ite++; +01384 } +01385 <font class="comment">// If break, not empty, return</font> +01386 <font class="keywordflow">if</font> (ite!=<a class="code" href="classNL3D_1_1CTileSet.html#o2">_Tile128</a>.end()) +01387 <font class="keywordflow">return</font>; +01388 +01389 <font class="comment">// Check all the 256x256 tiles</font> +01390 ite=<a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>.begin(); +01391 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>.end()) +01392 { +01393 <font class="comment">// If the file name is valid</font> +01394 <font class="keywordflow">if</font> (bank.getTile (*ite)->getRelativeFileName(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)!=<font class="stringliteral">""</font>) +01395 { +01396 <font class="comment">// Don't delete, </font> +01397 bDelete=<font class="keyword">false</font>; +01398 <font class="keywordflow">break</font>; +01399 } +01400 ite++; +01401 } +01402 <font class="comment">// If break, not empty, return</font> +01403 <font class="keywordflow">if</font> (ite!=<a class="code" href="classNL3D_1_1CTileSet.html#o3">_Tile256</a>.end()) +01404 <font class="keywordflow">return</font>; +01405 +01406 +01407 <font class="comment">// Check all the transitions tiles</font> +01408 sint trans; +01409 <font class="keywordflow">for</font> (trans=0; trans<<a class="code" href="classNL3D_1_1CTileSet.html#s30s12">count</a>; trans++) +01410 { +01411 <font class="comment">// Get the tile associed with the transition</font> +01412 <font class="keywordtype">int</font> nTile=<a class="code" href="classNL3D_1_1CTileSet.html#o4">_TileTransition</a>[trans]._Tile; +01413 +01414 <font class="comment">// If it is not NULL..</font> +01415 <font class="keywordflow">if</font> (nTile!=-1) +01416 { +01417 <font class="comment">// If the file name is valid</font> +01418 <font class="keywordflow">if</font> (bank.getTile (nTile)->getRelativeFileName(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)!=<font class="stringliteral">""</font>) +01419 { +01420 <font class="comment">// Don't delete, </font> +01421 bDelete=<font class="keyword">false</font>; +01422 <font class="keywordflow">break</font>; +01423 } +01424 } +01425 } +01426 <font class="keywordflow">if</font> (trans!=<a class="code" href="classNL3D_1_1CTileSet.html#s30s12">count</a>) +01427 <font class="keywordflow">return</font>; +01428 +01429 <font class="comment">// Ok, erase borders because no tile use it anymore</font> +01430 <a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>].reset(); +01431 <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>].reset(); +01432 } +01433 <font class="comment">// ***************************************************************************</font> +<a name="l01434"></a><a class="code" href="classNL3D_1_1CTileSet.html#a8">01434</a> <font class="keywordtype">void</font> CTileSet::clearDisplacement (TDisplacement displacement, CTileBank& bank) +01435 { +01436 <font class="comment">// checks</font> +01437 <a class="code" href="debug_8h.html#a6">nlassert</a> (displacement>=<a class="code" href="classNL3D_1_1CTileSet.html#s31s14">FirstDisplace</a>); +01438 <a class="code" href="debug_8h.html#a6">nlassert</a> (displacement<=<a class="code" href="classNL3D_1_1CTileSet.html#s31s15">LastDisplace</a>); +01439 +01440 <font class="comment">// Backup the id</font> +01441 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>=<a class="code" href="classNL3D_1_1CTileSet.html#o9">_DisplacementBitmap</a>[displacement]; +01442 +01443 <font class="comment">// Clear map id</font> +01444 <a class="code" href="classNL3D_1_1CTileSet.html#o9">_DisplacementBitmap</a>[displacement]=0; +01445 +01446 <font class="comment">// Tell the bank we remove it</font> +01447 bank.removeDisplacementMap (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>); +01448 } +01449 <font class="comment">// ***************************************************************************</font> +<a name="l01450"></a><a class="code" href="classNL3D_1_1CTileSet.html#a16">01450</a> <font class="keywordtype">void</font> CTileSet::setDisplacement (TDisplacement displacement, <font class="keyword">const</font> std::string& fileName, CTileBank& bank) +01451 { +01452 <font class="comment">// checks</font> +01453 <a class="code" href="debug_8h.html#a6">nlassert</a> (displacement>=<a class="code" href="classNL3D_1_1CTileSet.html#s31s14">FirstDisplace</a>); +01454 <a class="code" href="debug_8h.html#a6">nlassert</a> (displacement<=<a class="code" href="classNL3D_1_1CTileSet.html#s31s15">LastDisplace</a>); +01455 +01456 <font class="comment">// Clear it</font> +01457 bank.removeDisplacementMap (<a class="code" href="classNL3D_1_1CTileSet.html#o9">_DisplacementBitmap</a>[displacement]); +01458 +01459 <font class="comment">// Get displacement map</font> +01460 <a class="code" href="classNL3D_1_1CTileSet.html#o9">_DisplacementBitmap</a>[displacement]=bank.getDisplacementMap (fileName); +01461 } +01462 <font class="comment">// ***************************************************************************</font> +<a name="l01463"></a><a class="code" href="classNL3D_1_1CTileSet.html#a38">01463</a> <font class="keywordtype">void</font> CTileSet::cleanUnusedData () +01464 { +01465 <a class="code" href="classNL3D_1_1CTileSet.html#o0">_Name</a>=<font class="stringliteral">""</font>; +01466 <a class="code" href="classNL3D_1_1CTileSet.html#o5">_ChildName</a>.clear(); +01467 <a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[0].reset (); +01468 <a class="code" href="classNL3D_1_1CTileSet.html#o6">_Border128</a>[1].reset (); +01469 <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[0].reset (); +01470 <a class="code" href="classNL3D_1_1CTileSet.html#o7">_Border256</a>[1].reset (); +01471 <font class="keywordflow">for</font> (uint i=0; i<<a class="code" href="classNL3D_1_1CTileSet.html#s30s12">count</a>; i++) +01472 <font class="keywordflow">for</font> (uint j=0; j<CTile::bitmapCount; j++) +01473 <a class="code" href="classNL3D_1_1CTileSet.html#o8">_BorderTransition</a>[i][j].reset(); +01474 } +01475 +01476 +01477 <font class="comment">// ***************************************************************************</font> +<a name="l01478"></a><a class="code" href="classNL3D_1_1CTileSet.html#a17">01478</a> <font class="keywordtype">void</font> CTileSet::setTileVegetableDescFileName (<font class="keyword">const</font> std::string &fileName) +01479 { +01480 <a class="code" href="classNL3D_1_1CTileSet.html#o11">_TileVegetableDescFileName</a>= fileName; +01481 } +01482 <font class="comment">// ***************************************************************************</font> +<a name="l01483"></a><a class="code" href="classNL3D_1_1CTileSet.html#a33">01483</a> <font class="keyword">const</font> std::string& CTileSet::getTileVegetableDescFileName ()<font class="keyword"> const</font> +01484 <font class="keyword"></font>{ +01485 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#o11">_TileVegetableDescFileName</a>; +01486 } +01487 <font class="comment">// ***************************************************************************</font> +<a name="l01488"></a><a class="code" href="classNL3D_1_1CTileSet.html#a18">01488</a> <font class="keywordtype">void</font> CTileSet::setTileVegetableDesc (<font class="keyword">const</font> CTileVegetableDesc &tvd) +01489 { +01490 <a class="code" href="classNL3D_1_1CTileSet.html#o10">_TileVegetableDesc</a>= tvd; +01491 } +01492 +01493 <font class="comment">// ***************************************************************************</font> +<a name="l01494"></a><a class="code" href="classNL3D_1_1CTileSet.html#a35">01494</a> CTileVegetableDesc &CTileSet::getTileVegetableDesc() +01495 { +01496 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#o10">_TileVegetableDesc</a>; +01497 } +01498 +01499 <font class="comment">// ***************************************************************************</font> +<a name="l01500"></a><a class="code" href="classNL3D_1_1CTileSet.html#a36">01500</a> <font class="keyword">const</font> CTileVegetableDesc &CTileSet::getTileVegetableDesc()<font class="keyword"> const</font> +01501 <font class="keyword"></font>{ +01502 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTileSet.html#o10">_TileVegetableDesc</a>; +01503 } +01504 +01505 <font class="comment">// ***************************************************************************</font> +<a name="l01506"></a><a class="code" href="classNL3D_1_1CTileSet.html#a19">01506</a> <font class="keywordtype">void</font> CTileSet::loadTileVegetableDesc() +01507 { +01508 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTileSet.html#o11">_TileVegetableDescFileName</a>!=<font class="stringliteral">""</font>) +01509 { +01510 <font class="keywordflow">try</font> +01511 { +01512 string fname= CPath::lookup(<a class="code" href="classNL3D_1_1CTileSet.html#o11">_TileVegetableDescFileName</a>); +01513 CIFile f(fname); +01514 <font class="comment">// load the TileVegetableDesc</font> +01515 f.serial(<a class="code" href="classNL3D_1_1CTileSet.html#o10">_TileVegetableDesc</a>); +01516 } +01517 <font class="keywordflow">catch</font>(Exception &e) +01518 { +01519 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Error loading TileVegetableDesc: %s"</font>, e.what()); +01520 } +01521 } +01522 } +01523 +01524 +01525 <font class="comment">// ***************************************************************************</font> +01526 <font class="comment">// ***************************************************************************</font> +01527 <font class="comment">// CTileBorder.</font> +01528 <font class="comment">// ***************************************************************************</font> +01529 <font class="comment">// ***************************************************************************</font> +01530 +01531 +01532 <font class="comment">// ***************************************************************************</font> +<a name="l01533"></a><a class="code" href="classNL3D_1_1CTileBorder.html#r0">01533</a> <font class="keyword">const</font> sint CTileBorder::_Version=0; +01534 <font class="comment">// ***************************************************************************</font> +<a name="l01535"></a><a class="code" href="classNL3D_1_1CTileBorder.html#a6">01535</a> <font class="keywordtype">void</font> CTileBorder::serial(IStream &f) <font class="keywordflow">throw</font>(EStream) +01536 { +01537 (void)f.serialVersion(_Version); +01538 +01539 f.serial (_Set); +01540 f.serial (_Width); +01541 f.serial (_Height); +01542 f.serialCont (_Borders[top]); +01543 f.serialCont (_Borders[bottom]); +01544 f.serialCont (_Borders[left]); +01545 f.serialCont (_Borders[right]); +01546 } +01547 <font class="comment">// ***************************************************************************</font> +<a name="l01548"></a><a class="code" href="classNL3D_1_1CTileBorder.html#a1">01548</a> <font class="keywordtype">void</font> CTileBorder::set (<font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>, <font class="keyword">const</font> std::vector<CBGRA>& array) +01549 { +01550 <font class="comment">// Check array size</font> +01551 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>>0); +01552 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>>0); +01553 <a class="code" href="debug_8h.html#a6">nlassert</a> ((sint)array.size()==<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>*<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +01554 +01555 <font class="comment">// Copy size</font> +01556 <a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>=<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +01557 <a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>=<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +01558 +01559 <font class="comment">// Last line</font> +01560 <font class="keywordtype">int</font> lastLine=(<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>-1)*<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +01561 <font class="keywordtype">int</font> lastCol=(<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>-1); +01562 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>].resize (<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>); +01563 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>].resize (<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>); +01564 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>].resize (<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>); +01565 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>].resize (<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>); +01566 +01567 <font class="comment">// Copy top/bottom border</font> +01568 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a><<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>; <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>++) +01569 { +01570 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>][<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>]=array[<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>]; +01571 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>][<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>]=array[<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>+lastLine]; +01572 } +01573 +01574 <font class="comment">// Copy left/right border</font> +01575 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> h=0; h<<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>; h++) +01576 { +01577 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>][h]=array[h*<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>]; +01578 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>][h]=array[h*<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>+lastCol]; +01579 } +01580 +01581 <font class="comment">// Set</font> +01582 <a class="code" href="classNL3D_1_1CTileBorder.html#o0">_Set</a>=<font class="keyword">true</font>; +01583 } +01584 <font class="comment">// ***************************************************************************</font> +01585 <font class="keywordtype">void</font> CTileBorder::get (<font class="keywordtype">int</font> &<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <font class="keywordtype">int</font> &<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>, std::vector<CBGRA>& array)<font class="keyword"> const</font> +01586 <font class="keyword"></font>{ +01587 <font class="comment">// Go</font> +01588 <font class="keywordflow">if</font> (_Set) +01589 { +01590 <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>=<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>; +01591 <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>=<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>; +01592 array.resize (0); +01593 array.resize (<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>*<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>); +01594 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>].<a class="code" href="cf__lexical_8cpp.html#a94">size</a>()==(uint)<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>); +01595 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>].<a class="code" href="cf__lexical_8cpp.html#a94">size</a>()==(uint)<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>); +01596 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>].<a class="code" href="cf__lexical_8cpp.html#a94">size</a>()==(uint)<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>); +01597 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>].<a class="code" href="cf__lexical_8cpp.html#a94">size</a>()==(uint)<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>); +01598 +01599 <font class="comment">// Fill</font> +01600 CBGRA black(0,0,0); +01601 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> p=0; p<<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>*<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>; p++) +01602 { +01603 array[p]=black; +01604 } +01605 +01606 <font class="comment">// Last line</font> +01607 <font class="keywordtype">int</font> lastLine=(<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>-1)*<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>; +01608 <font class="keywordtype">int</font> lastCol=(<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>-1); +01609 +01610 <font class="comment">// Copy top/bottom border</font> +01611 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a><<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>; <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>++) +01612 { +01613 array[<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>][<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>]; +01614 array[<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>+lastLine]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>][<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>]; +01615 } +01616 +01617 <font class="comment">// Copy left/right border</font> +01618 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> h=0; h<<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>; h++) +01619 { +01620 array[h*<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>][h]; +01621 array[h*<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>+lastCol]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>][h]; +01622 } +01623 } +01624 <font class="keywordflow">else</font> +01625 { +01626 <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>=0; +01627 <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>=0; +01628 array.resize (0); +01629 } +01630 } +01631 <font class="comment">// ***************************************************************************</font> +<a name="l01632"></a><a class="code" href="classNL3D_1_1CTileBorder.html#d1">01632</a> <font class="keywordtype">bool</font> CTileBorder::compare (<font class="keyword">const</font> CTileBorder& border1, <font class="keyword">const</font> CTileBorder& border2, TBorder where1, TBorder where2, <font class="keywordtype">int</font>& pixel, <font class="keywordtype">int</font>& composante) +01633 { +01634 <font class="comment">// Check border is initialized</font> +01635 <a class="code" href="debug_8h.html#a6">nlassert</a> (border1.isSet()); +01636 <a class="code" href="debug_8h.html#a6">nlassert</a> (border2.isSet()); +01637 +01638 <font class="keywordflow">if</font> (border1._Borders[where1].size()!=border2._Borders[where2].size()) +01639 <font class="keywordflow">return</font> <font class="keyword">false</font>; +01640 <font class="keywordflow">for</font> (pixel=0; pixel<(int)border1._Borders[where1].size(); pixel++) +01641 { +01642 <font class="keywordflow">if</font> (border1._Borders[where1][pixel].R!=border2._Borders[where2][pixel].R) +01643 { +01644 composante=0; +01645 <font class="keywordflow">return</font> <font class="keyword">false</font>; +01646 } +01647 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (border1._Borders[where1][pixel].G!=border2._Borders[where2][pixel].G) +01648 { +01649 composante=1; +01650 <font class="keywordflow">return</font> <font class="keyword">false</font>; +01651 } +01652 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (border1._Borders[where1][pixel].B!=border2._Borders[where2][pixel].B) +01653 { +01654 composante=2; +01655 <font class="keywordflow">return</font> <font class="keyword">false</font>; +01656 } +01657 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (border1._Borders[where1][pixel].A!=border2._Borders[where2][pixel].A) +01658 { +01659 composante=3; +01660 <font class="keywordflow">return</font> <font class="keyword">false</font>; +01661 } +01662 } +01663 +01664 <font class="keywordflow">return</font> <font class="keyword">true</font>; +01665 } +01666 <font class="comment">// ***************************************************************************</font> +<a name="l01667"></a><a class="code" href="classNL3D_1_1CTileBorder.html#d0">01667</a> <font class="keywordtype">bool</font> CTileBorder::allAlphaSet (<font class="keyword">const</font> CTileBorder& <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>, TBorder where, <font class="keywordtype">int</font>& pixel, <font class="keywordtype">int</font>& composante) +01668 { +01669 <font class="comment">// Check border is initialized</font> +01670 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>.isSet()); +01671 +01672 <font class="comment">// always Alpha</font> +01673 composante=3; +01674 +01675 <font class="keywordflow">for</font> (pixel=0; pixel<(int)<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Borders[where].size(); pixel++) +01676 { +01677 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Borders[where][pixel].A!=0xff) +01678 <font class="keywordflow">return</font> <font class="keyword">false</font>; +01679 } +01680 +01681 <font class="keywordflow">return</font> <font class="keyword">true</font>; +01682 } +01683 <font class="comment">// ***************************************************************************</font> +<a name="l01684"></a><a class="code" href="classNL3D_1_1CTileBorder.html#a4">01684</a> <font class="keywordtype">bool</font> CTileBorder::operator== (<font class="keyword">const</font> CTileBorder& <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>)<font class="keyword"> const</font> +01685 <font class="keyword"></font>{ +01686 <font class="keywordflow">return</font> (<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>==<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Width) && (<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>==<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Height) && (<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>==<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Borders); +01687 } +01688 <font class="comment">// ***************************************************************************</font> +<a name="l01689"></a><a class="code" href="classNL3D_1_1CTileBorder.html#a5">01689</a> <font class="keywordtype">void</font> CTileBorder::operator= (<font class="keyword">const</font> CTileBorder& <a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>) +01690 { +01691 <a class="code" href="classNL3D_1_1CTileBorder.html#o0">_Set</a>=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Set; +01692 <a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Width; +01693 <a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Width; +01694 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>]=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Borders[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>]; +01695 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>]=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Borders[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>]; +01696 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>]=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Borders[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>]; +01697 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>]=<a class="code" href="driver__opengl__extension__def_8h.html#a392">border</a>._Borders[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>]; +01698 } +01699 +01700 <font class="comment">// ***************************************************************************</font> +<a name="l01701"></a><a class="code" href="classNL3D_1_1CTileBorder.html#a3">01701</a> <font class="keywordtype">void</font> CTileBorder::doubleSize () +01702 { +01703 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>].resize (<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>*2); +01704 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>].resize (<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>*2); +01705 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>].resize (<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>*2); +01706 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>].resize (<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>*2); +01707 +01708 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a><<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>; <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>++) +01709 { +01710 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>][<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>+<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>][<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>]; +01711 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>][<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>+<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>][<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>]; +01712 } +01713 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> h=0; h<<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>; h++) +01714 { +01715 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>][h+<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>][h]; +01716 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>][h+<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>][h]; +01717 } +01718 } +01719 <font class="comment">// ***************************************************************************</font> +<a name="l01720"></a><a class="code" href="classNL3D_1_1CTileBorder.html#a11">01720</a> <font class="keywordtype">void</font> CTileBorder::rotate() +01721 { +01722 <font class="comment">// Copy the right</font> +01723 std::vector<NLMISC::CBGRA> tmpLeft=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>]; +01724 +01725 <font class="comment">// Top inverted becomes left</font> +01726 uint i, size; +01727 size=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>].size(); +01728 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>].resize (size); +01729 +01730 <font class="comment">// copy inverted</font> +01731 <font class="keywordflow">for</font> (i=0; i<size; i++) +01732 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s2">left</a>][i]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>][size-i-1]; +01733 +01734 <font class="comment">// Right become top</font> +01735 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s0">top</a>]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>]; +01736 +01737 <font class="comment">// bottom inverted becomes right</font> +01738 size=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>].size(); +01739 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>].resize (size); +01740 +01741 <font class="comment">// copy inverted</font> +01742 <font class="keywordflow">for</font> (i=0; i<size; i++) +01743 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s3">right</a>][i]=<a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>][size-i-1]; +01744 +01745 <font class="comment">// Left become bottom</font> +01746 <a class="code" href="classNL3D_1_1CTileBorder.html#o3">_Borders</a>[<a class="code" href="classNL3D_1_1CTileBorder.html#s5s1">bottom</a>]=tmpLeft; +01747 +01748 <font class="comment">// Invert size</font> +01749 sint32 tmpSize=<a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>; +01750 <a class="code" href="classNL3D_1_1CTileBorder.html#o1">_Width</a>=<a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>; +01751 <a class="code" href="classNL3D_1_1CTileBorder.html#o2">_Height</a>=tmpSize; +01752 } +01753 +01754 <font class="comment">// ***************************************************************************</font> +01755 <font class="comment">// ***************************************************************************</font> +01756 <font class="comment">// CTileSetTransition.</font> +01757 <font class="comment">// ***************************************************************************</font> +01758 <font class="comment">// ***************************************************************************</font> +01759 +01760 +01761 <font class="comment">// ***************************************************************************</font> +<a name="l01762"></a><a class="code" href="classNL3D_1_1CTileSetTransition.html#r0">01762</a> <font class="keyword">const</font> sint CTileSetTransition::_Version=1; +01763 <font class="comment">// ***************************************************************************</font> +<a name="l01764"></a><a class="code" href="classNL3D_1_1CTileSetTransition.html#a2">01764</a> <font class="keywordtype">void</font> CTileSetTransition::serial(<font class="keyword">class</font> <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f) <font class="keywordflow">throw</font>(EStream) +01765 { +01766 sint streamver = f.serialVersion(_Version); +01767 +01768 <font class="keywordflow">switch</font> (streamver) +01769 { +01770 <font class="keywordflow">case</font> 0: +01771 { +01772 <font class="keywordtype">bool</font> doomy; +01773 f.serial (_Tile); +01774 f.serial (doomy); <font class="comment">// skip the old argu</font> +01775 } +01776 <font class="keywordflow">break</font>; +01777 <font class="keywordflow">case</font> 1: +01778 f.serial (_Tile); +01779 <font class="keywordflow">break</font>; +01780 } +01781 } +01782 <font class="comment">// ***************************************************************************</font> +01783 +01784 +01785 <font class="comment">// ***************************************************************************</font> +01786 <font class="comment">// ***************************************************************************</font> +01787 <font class="comment">// CTileNoise.</font> +01788 <font class="comment">// ***************************************************************************</font> +01789 <font class="comment">// ***************************************************************************</font> +01790 +01791 +01792 <font class="comment">// ***************************************************************************</font> +<a name="l01793"></a><a class="code" href="classNL3D_1_1CTileNoise.html#a0">01793</a> CTileNoise::CTileNoise () +01794 { +01795 <font class="comment">// Not loaded</font> +01796 <a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>=NULL; +01797 <a class="code" href="classNL3D_1_1CTileNoise.html#o1">_FileName</a>=<font class="stringliteral">""</font>; +01798 } +01799 <font class="comment">// ***************************************************************************</font> +<a name="l01800"></a><a class="code" href="classNL3D_1_1CTileNoise.html#a1">01800</a> CTileNoise::CTileNoise (<font class="keyword">const</font> CTileNoise &<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>) +01801 { +01802 <font class="comment">// Default ctor</font> +01803 <a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>=NULL; +01804 <a class="code" href="classNL3D_1_1CTileNoise.html#o1">_FileName</a>=<font class="stringliteral">""</font>; +01805 +01806 <font class="comment">// Copy</font> +01807 *<font class="keyword">this</font>=<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>; +01808 } +01809 <font class="comment">// ***************************************************************************</font> +<a name="l01810"></a><a class="code" href="classNL3D_1_1CTileNoise.html#a2">01810</a> CTileNoise::~CTileNoise () +01811 { +01812 <font class="keywordflow">if</font> (_TileNoiseMap) +01813 { +01814 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>; +01815 <a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>=NULL; +01816 } +01817 } +01818 <font class="comment">// ***************************************************************************</font> +<a name="l01819"></a><a class="code" href="classNL3D_1_1CTileNoise.html#a3">01819</a> CTileNoise& CTileNoise::operator= (<font class="keyword">const</font> CTileNoise &<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>) +01820 { +01821 <font class="comment">// Copy the filename</font> +01822 <a class="code" href="classNL3D_1_1CTileNoise.html#o1">_FileName</a>=<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>._FileName; +01823 +01824 <font class="comment">// Tile noise map ?</font> +01825 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>._TileNoiseMap) +01826 { +01827 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>==NULL) +01828 { +01829 <font class="comment">// Allocate it</font> +01830 <a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>=<font class="keyword">new</font> CTileNoiseMap; +01831 } +01832 +01833 <font class="comment">// Copy the noise map</font> +01834 *<a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>=*<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>._TileNoiseMap; +01835 } +01836 <font class="keywordflow">else</font> +01837 { +01838 <font class="comment">// Erase the map</font> +01839 <font class="keywordflow">if</font> (_TileNoiseMap) +01840 { +01841 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>; +01842 <a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>=NULL; +01843 } +01844 } +01845 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +01846 } +01847 <font class="comment">// ***************************************************************************</font> +<a name="l01848"></a><a class="code" href="classNL3D_1_1CTileNoise.html#a4">01848</a> <font class="keywordtype">void</font> CTileNoise::serial (IStream& f) +01849 { +01850 <font class="comment">// Version</font> +01851 f.serialVersion (0); +01852 +01853 <font class="comment">// Serial the file name</font> +01854 f.serial (<a class="code" href="classNL3D_1_1CTileNoise.html#o1">_FileName</a>); +01855 } +01856 <font class="comment">// ***************************************************************************</font> +<a name="l01857"></a><a class="code" href="classNL3D_1_1CTileNoise.html#a5">01857</a> <font class="keywordtype">void</font> CTileNoise::setEmpty () +01858 { +01859 <font class="comment">// Reset it</font> +01860 <a class="code" href="classNL3D_1_1CTileNoise.html#a6">reset</a>(); +01861 <a class="code" href="classNL3D_1_1CTileNoise.html#o1">_FileName</a>=<font class="stringliteral">"EmptyDisplacementMap"</font>; +01862 <a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>=<font class="keyword">new</font> CTileNoiseMap(); +01863 memset (<a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>->Pixels, 0, <a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>*<a class="code" href="tile__noise__map_8h.html#a1">NL3D_TILE_NOISE_MAP_SIZE</a>); +01864 } +01865 <font class="comment">// ***************************************************************************</font> +<a name="l01866"></a><a class="code" href="classNL3D_1_1CTileNoise.html#a6">01866</a> <font class="keywordtype">void</font> CTileNoise::reset() +01867 { +01868 <font class="comment">// Erase the map</font> +01869 <font class="keywordflow">if</font> (_TileNoiseMap) +01870 { +01871 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>; +01872 <a class="code" href="classNL3D_1_1CTileNoise.html#o0">_TileNoiseMap</a>=NULL; +01873 } +01874 +01875 <font class="comment">// Erase filename</font> +01876 <a class="code" href="classNL3D_1_1CTileNoise.html#o1">_FileName</a>=<font class="stringliteral">""</font>; +01877 } +01878 <font class="comment">// ***************************************************************************</font> +01879 +01880 } <font class="comment">// NL3D</font> +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |