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/a04455.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/a04455.html | 512 |
1 files changed, 512 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a04455.html b/docs/doxygen/nel/a04455.html new file mode 100644 index 00000000..261b5acb --- /dev/null +++ b/docs/doxygen/nel/a04455.html @@ -0,0 +1,512 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: landscapeig_manager.cpp File Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>landscapeig_manager.cpp File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2> +<dl compact><dt><b>Id</b></dt><dd><a class="el" href="a04455.html">landscapeig_manager.cpp</a>,v 1.14 2003/12/10 10:17:47 corvazier Exp </dd></dl> + +<p> +Definition in file <a class="el" href="a05878.html">landscapeig_manager.cpp</a>. +<p> +<code>#include "<a class="el" href="a06438.html">std3d.h</a>"</code><br> +<code>#include "<a class="el" href="a05879.html">nel/3d/landscapeig_manager.h</a>"</code><br> +<code>#include "<a class="el" href="a06353.html">3d/scene_user.h</a>"</code><br> +<code>#include "<a class="el" href="a05823.html">3d/instance_group_user.h</a>"</code><br> +<code>#include "<a class="el" href="a06377.html">3d/shape.h</a>"</code><br> +<code>#include "<a class="el" href="a05587.html">nel/misc/common.h</a>"</code><br> +<code>#include "<a class="el" href="a05622.html">nel/misc/debug.h</a>"</code><br> +<code>#include "<a class="el" href="a06168.html">nel/misc/path.h</a>"</code><br> +<code>#include "<a class="el" href="a05709.html">nel/misc/file.h</a>"</code><br> +<code>#include "<a class="el" href="a05788.html">nel/misc/hierarchical_timer.h</a>"</code><br> +<code>#include <fstream></code><br> + +<p> +<a href="a05878.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Defines</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>#define </td><td class="memItemRight" valign=bottom><a class="el" href="a04455.html#a0">NL3D_HAUTO_LAND_MNGR_LOAD_ZONEIG</a> H_AUTO_USE( NL3D_Load_Zone_IG )</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>#define </td><td class="memItemRight" valign=bottom><a class="el" href="a04455.html#a1">NL3D_HAUTO_LAND_MNGR_UNLOAD_ZONEIG</a> H_AUTO_USE( NL3D_Unload_Zone_IG )</td></tr> + +<tr><td colspan=2><br><h2>Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a04455.html#a2">H_AUTO_DECL</a> (NL3D_Load_Zone_IG) H_AUTO_DECL(NL3D_Unload_Zone_IG) namespace NL3D</td></tr> + +</table> +<hr><h2>Define Documentation</h2> +<a class="anchor" name="a0" doxytag="landscapeig_manager.cpp::NL3D_HAUTO_LAND_MNGR_LOAD_ZONEIG" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> #define NL3D_HAUTO_LAND_MNGR_LOAD_ZONEIG H_AUTO_USE( NL3D_Load_Zone_IG ) + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05878.html#l00045">H_AUTO_DECL()</a>. </td> + </tr> +</table> +<a class="anchor" name="a1" doxytag="landscapeig_manager.cpp::NL3D_HAUTO_LAND_MNGR_UNLOAD_ZONEIG" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> #define NL3D_HAUTO_LAND_MNGR_UNLOAD_ZONEIG H_AUTO_USE( NL3D_Unload_Zone_IG ) + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05878.html#l00045">H_AUTO_DECL()</a>. </td> + </tr> +</table> +<hr><h2>Function Documentation</h2> +<a class="anchor" name="a2" doxytag="landscapeig_manager.cpp::H_AUTO_DECL" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> H_AUTO_DECL </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">NL3D_Load_Zone_IG </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05878.html#l00045">45</a> of file <a class="el" href="a05878.html">landscapeig_manager.cpp</a>. +<p> +References <a class="el" href="a05538.html#l02654">file</a>, <a class="el" href="a04455.html#a0">NL3D_HAUTO_LAND_MNGR_LOAD_ZONEIG</a>, <a class="el" href="a04455.html#a1">NL3D_HAUTO_LAND_MNGR_UNLOAD_ZONEIG</a>, <a class="el" href="a05879.html#l00034">NL3D_MEM_LANDSCAPE_IG</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>, <a class="el" href="a05586.html#l00581">NLMISC::strupr()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00052 { +00053 +00054 +00055 <span class="comment">// ***************************************************************************</span> +00056 CLandscapeIGManager::CInstanceGroupElement::CInstanceGroupElement(UInstanceGroup *ig, <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName) +00057 { +00058 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00059 Ig = ig; +00060 AddedToScene = <span class="keyword">false</span>; +00061 <span class="keywordflow">if</span> (fileName != NULL) +00062 FileName = fileName; +00063 } +00064 +00065 <span class="comment">// ***************************************************************************</span> +00066 <span class="keywordtype">void</span> CLandscapeIGManager::CInstanceGroupElement::release() +00067 { +00068 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00069 <span class="keyword">delete</span> Ig; +00070 Ig= NULL; +00071 } +00072 +00073 +00074 <span class="comment">// ***************************************************************************</span> +00075 CLandscapeIGManager::CLandscapeIGManager() +00076 { +00077 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00078 _Scene=NULL; +00079 } +00080 <span class="comment">// ***************************************************************************</span> +00081 CLandscapeIGManager::~CLandscapeIGManager() +00082 { +00083 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00084 <span class="comment">// reset should have been called.</span> +00085 <span class="keywordflow">if</span>(_Scene!=NULL) +00086 <span class="keywordflow">throw</span> <a class="code" href="a02482.html">Exception</a>(<span class="stringliteral">"CLandscapeIGManager not reseted"</span>); +00087 } +00088 <span class="comment">// ***************************************************************************</span> +00089 <span class="keywordtype">void</span> CLandscapeIGManager::initIG(UScene *scene, <span class="keyword">const</span> std::string &igDesc, UDriver *driver, <a class="code" href="a04558.html#a15">uint</a> selectedTexture, +00090 <a class="code" href="a03873.html">NLMISC::IProgressCallback</a> *callBack) +00091 { +00092 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00093 <a class="code" href="a04199.html#a6">nlassert</a>(scene); +00094 _Scene= scene; +00095 +00096 <span class="comment">// Load the file.</span> +00097 <span class="keywordflow">if</span>(igDesc.empty()) +00098 <span class="keywordflow">return</span>; +00099 +00100 string igFile = CPath::lookup(igDesc); +00101 +00102 <span class="comment">//ifstream file(igFile.c_str(), ios::in);</span> +00103 +00104 <a class="code" href="a02653.html">CIFile</a> <a class="code" href="a04115.html#a95">file</a>; +00105 +00106 <span class="comment">// Shape to add should be empty !</span> +00107 <a class="code" href="a04199.html#a6">nlassert</a>(_ShapeAdded.empty ()); +00108 +00109 <span class="comment">// if loading ok.</span> +00110 <span class="comment">//if(file.is_open())</span> +00111 <span class="keywordflow">if</span> (<a class="code" href="a04115.html#a95">file</a>.open (igFile)) +00112 { +00113 <span class="keywordtype">char</span> tmpBuff[260]; +00114 <span class="keywordtype">char</span> delimiterBox[] = <span class="stringliteral">"\t"</span>; +00115 <span class="comment">// While the end of the file is not reached.</span> +00116 <span class="keywordflow">while</span>(!<a class="code" href="a04115.html#a95">file</a>.eof()) +00117 { +00118 <span class="comment">// Get a line</span> +00119 <a class="code" href="a04115.html#a95">file</a>.getline(tmpBuff, 260); +00120 <span class="keywordtype">char</span> *token = strtok(tmpBuff, delimiterBox); +00121 <span class="comment">// create the instance group.</span> +00122 <span class="keywordflow">if</span>(token != NULL) +00123 { +00124 <span class="keywordflow">if</span>( _ZoneInstanceGroupMap.find(token)!=_ZoneInstanceGroupMap.end() ) +00125 <span class="keywordflow">throw</span> <a class="code" href="a02482.html">Exception</a>(<span class="stringliteral">"CLandscapeIGManager::initIG() found 2 igs with same name in %s"</span>, igFile.c_str()); +00126 <span class="keywordflow">else</span> +00127 { +00128 <span class="comment">// create the instanceGroup.</span> +00129 UInstanceGroup *ig = UInstanceGroup::createInstanceGroup(token); +00130 <span class="keywordflow">if</span> (ig) +00131 { +00132 <span class="comment">// add it to the map.</span> +00133 string tokId= token; +00134 <a class="code" href="a05378.html#a276">strupr</a>(tokId); +00135 _ZoneInstanceGroupMap[tokId]= CInstanceGroupElement(ig, token); +00136 +00137 <span class="comment">// Add a reference on the shapes</span> +00138 CInstanceGroup &_ig = static_cast<CInstanceGroupUser*>(ig)->getInternalIG(); +00139 CScene &_scene = static_cast<CSceneUser*>(scene)->getScene(); +00140 <a class="code" href="a04558.html#a15">uint</a> i; +00141 <span class="keywordflow">for</span> (i=0; i<_ig.getNumInstance(); i++) +00142 { +00143 <span class="comment">// Get the instance name</span> +00144 string shapeName; +00145 _ig.getShapeName(i, shapeName); +00146 <span class="keywordflow">if</span> (!shapeName.empty ()) +00147 { +00148 <span class="keywordflow">if</span> (<a class="code" href="a05378.html#a273">strlwr</a>(CFile::getExtension(shapeName)) != <span class="stringliteral">"pacs_prim"</span>) +00149 { +00150 <span class="comment">// Insert a new shape ?</span> +00151 <span class="keywordflow">if</span> (_ShapeAdded.find(shapeName) == _ShapeAdded.end()) +00152 { +00153 <span class="comment">// Shape present ?</span> +00154 CShapeBank *shapeBank = _scene.getShapeBank(); +00155 IShape *shape = NULL; +00156 <span class="keywordflow">if</span> (shapeBank->isPresent (shapeName) == CShapeBank::NotPresent) +00157 shapeBank->load (shapeName); +00158 <span class="keywordflow">if</span> (shapeBank->isPresent (shapeName) == CShapeBank::Present) +00159 shape = shapeBank->addRef(shapeName); +00160 +00161 <span class="comment">// Shape loaded ?</span> +00162 <span class="keywordflow">if</span> (shape) +00163 { +00164 <span class="comment">// Insert the shape</span> +00165 <a class="code" href="a03408.html">CSmartPtr<IShape></a> *smartPtr = <span class="keyword">new</span> <a class="code" href="a03408.html">CSmartPtr<IShape></a>; +00166 *smartPtr = shape; +00167 _ShapeAdded.insert (TShapeMap::value_type (shapeName, smartPtr)); +00168 +00169 <span class="comment">// Flush the shape</span> +00170 IDriver *_driver = static_cast<CDriverUser*>(driver)->getDriver(); +00171 shape->flushTextures(*_driver, selectedTexture); +00172 } +00173 } +00174 } +00175 } +00176 } +00177 } +00178 <span class="keywordflow">else</span> +00179 { +00180 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"CLandscapeIGManager::initIG() Can't load instance group '%s' in '%s'"</span>, token, igFile.c_str()); +00181 } +00182 } +00183 } +00184 } +00185 <a class="code" href="a04115.html#a95">file</a>.close(); +00186 } +00187 <span class="keywordflow">else</span> +00188 { +00189 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"Couldn't load '%s'"</span>, igFile.c_str()); +00190 } +00191 } +00192 <span class="comment">// ***************************************************************************</span> +00193 UInstanceGroup *CLandscapeIGManager::loadZoneIG(<span class="keyword">const</span> std::string &name) +00194 { +00195 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00196 <a class="code" href="a04455.html#a0">NL3D_HAUTO_LAND_MNGR_LOAD_ZONEIG</a> +00197 +00198 <span class="keywordflow">if</span>(name==<span class="stringliteral">""</span>) +00199 <span class="keywordflow">return</span> NULL; +00200 +00201 <span class="comment">// try to find this InstanceGroup.</span> +00202 ItZoneInstanceGroupMap it; +00203 it= _ZoneInstanceGroupMap.find( translateName(name) ); +00204 +00205 <span class="comment">// if found.</span> +00206 <span class="keywordflow">if</span>( it!= _ZoneInstanceGroupMap.end() ) +00207 { +00208 <span class="comment">// if not already added to the scene.</span> +00209 <span class="keywordflow">if</span>( !it->second.AddedToScene ) +00210 { +00211 <span class="comment">// add to the scene.</span> +00212 <span class="keywordflow">if</span> (it->second.Ig != NULL) +00213 { +00214 it->second.Ig->addToScene(*_Scene); +00215 it->second.AddedToScene= <span class="keyword">true</span>; +00216 } +00217 } +00218 <span class="keywordflow">return</span> it->second.Ig; +00219 } +00220 <span class="keywordflow">else</span> +00221 { +00222 <span class="keywordflow">return</span> NULL; +00223 } +00224 } +00225 <span class="comment">// ***************************************************************************</span> +00226 <span class="keywordtype">void</span> CLandscapeIGManager::loadArrayZoneIG(<span class="keyword">const</span> std::vector<std::string> &names, std::vector<UInstanceGroup *> *dest <span class="comment">/*= NULL*/</span>) +00227 { +00228 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00229 <span class="keywordflow">if</span> (dest) +00230 { +00231 dest->clear(); +00232 dest->reserve(names.size()); +00233 } +00234 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i<names.size(); i++) +00235 { +00236 UInstanceGroup *ig = loadZoneIG(names[i]); +00237 <span class="keywordflow">if</span> (dest && ig) +00238 { +00239 dest->push_back(ig); +00240 } +00241 } +00242 } +00243 +00244 <span class="comment">// ***************************************************************************</span> +00245 <span class="keywordtype">void</span> CLandscapeIGManager::unloadArrayZoneIG(<span class="keyword">const</span> std::vector<std::string> &names) +00246 { +00247 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00248 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i<names.size(); i++) +00249 { +00250 unloadZoneIG(names[i]); +00251 } +00252 } +00253 +00254 <span class="comment">// ***************************************************************************</span> +00255 <span class="keywordtype">void</span> CLandscapeIGManager::unloadZoneIG(<span class="keyword">const</span> std::string &name) +00256 { +00257 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00258 <a class="code" href="a04455.html#a1">NL3D_HAUTO_LAND_MNGR_UNLOAD_ZONEIG</a> +00259 <span class="keywordflow">if</span>(name==<span class="stringliteral">""</span>) +00260 <span class="keywordflow">return</span>; +00261 +00262 <span class="comment">// try to find this InstanceGroup.</span> +00263 ItZoneInstanceGroupMap it; +00264 it= _ZoneInstanceGroupMap.find( translateName(name) ); +00265 +00266 <span class="comment">// if found.</span> +00267 <span class="keywordflow">if</span>( it!= _ZoneInstanceGroupMap.end() ) +00268 { +00269 <span class="comment">// if really added to the scene.</span> +00270 <span class="keywordflow">if</span>( it->second.AddedToScene ) +00271 { +00272 <span class="comment">// remove from the scene.</span> +00273 it->second.Ig->removeFromScene(*_Scene); +00274 it->second.AddedToScene= <span class="keyword">false</span>; +00275 } +00276 } +00277 } +00278 +00279 <span class="comment">// ***************************************************************************</span> +00280 <span class="keywordtype">bool</span> CLandscapeIGManager::isIGAddedToScene(<span class="keyword">const</span> std::string &name)<span class="keyword"> const</span> +00281 <span class="keyword"></span>{ +00282 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00283 <span class="keywordflow">if</span>(name==<span class="stringliteral">""</span>) +00284 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00285 +00286 <span class="comment">// try to find this InstanceGroup.</span> +00287 ConstItZoneInstanceGroupMap it; +00288 it= _ZoneInstanceGroupMap.find( translateName(name) ); +00289 +00290 <span class="comment">// if found.</span> +00291 <span class="keywordflow">if</span>( it!= _ZoneInstanceGroupMap.end() ) +00292 <span class="keywordflow">return</span> it->second.AddedToScene; +00293 <span class="keywordflow">else</span> +00294 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00295 } +00296 +00297 <span class="comment">// ***************************************************************************</span> +00298 UInstanceGroup *CLandscapeIGManager::getIG(<span class="keyword">const</span> std::string &name)<span class="keyword"> const</span> +00299 <span class="keyword"></span>{ +00300 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00301 <span class="keywordflow">if</span>(name==<span class="stringliteral">""</span>) +00302 <span class="keywordflow">return</span> NULL; +00303 +00304 <span class="comment">// try to find this InstanceGroup.</span> +00305 ConstItZoneInstanceGroupMap it; +00306 it= _ZoneInstanceGroupMap.find( translateName(name) ); +00307 +00308 <span class="comment">// if found.</span> +00309 <span class="keywordflow">if</span>( it!= _ZoneInstanceGroupMap.end() ) +00310 <span class="keywordflow">return</span> it->second.Ig; +00311 <span class="keywordflow">else</span> +00312 <span class="keywordflow">return</span> NULL; +00313 } +00314 +00315 +00316 <span class="comment">// ***************************************************************************</span> +00317 std::string CLandscapeIGManager::translateName(<span class="keyword">const</span> std::string &name)<span class="keyword"> const</span> +00318 <span class="keyword"></span>{ +00319 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00320 std::string ret; +00321 ret= name + <span class="stringliteral">".ig"</span>; +00322 <a class="code" href="a05378.html#a276">strupr</a>(ret); +00323 +00324 <span class="keywordflow">return</span> ret; +00325 } +00326 +00327 +00328 <span class="comment">// ***************************************************************************</span> +00329 <span class="keywordtype">void</span> CLandscapeIGManager::reset() +00330 { +00331 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00332 <span class="keywordflow">while</span>( _ZoneInstanceGroupMap.begin() != _ZoneInstanceGroupMap.end() ) +00333 { +00334 string name= _ZoneInstanceGroupMap.begin()->first; +00335 <span class="comment">// first remove from scene</span> +00336 unloadZoneIG( name.substr(0, name.find(<span class="charliteral">'.'</span>)) ); +00337 +00338 <span class="comment">// then delete this entry.</span> +00339 _ZoneInstanceGroupMap.begin()->second.release(); +00340 _ZoneInstanceGroupMap.erase(_ZoneInstanceGroupMap.begin()); +00341 } +00342 +00343 <span class="comment">// For all shape reference</span> +00344 TShapeMap::iterator ite = _ShapeAdded.begin (); +00345 <span class="keywordflow">while</span> (ite != _ShapeAdded.end()) +00346 { +00347 <span class="comment">// Unreference shape</span> +00348 CScene &_scene = static_cast<CSceneUser*>(_Scene)->getScene(); +00349 <a class="code" href="a03408.html">CSmartPtr<IShape></a> *smartPtr = (<a class="code" href="a03408.html">CSmartPtr<IShape></a> *)(ite->second); +00350 IShape *shapeToRelease = *smartPtr; +00351 *smartPtr = NULL; +00352 _scene.getShapeBank()->release(shapeToRelease); +00353 <span class="keyword">delete</span> smartPtr; +00354 +00355 <span class="comment">// Next</span> +00356 ite++; +00357 } +00358 _ShapeAdded.clear (); +00359 +00360 _Scene=NULL; +00361 } +00362 +00363 +00364 <span class="comment">// ***************************************************************************</span> +00365 <span class="keywordtype">void</span> CLandscapeIGManager::reloadAllIgs() +00366 { +00367 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00368 vector<std::string> bkupIgFileNameList; +00369 vector<bool> bkupIgAddedToScene; +00370 +00371 <span class="comment">// First, erase all igs.</span> +00372 <span class="keywordflow">while</span>( _ZoneInstanceGroupMap.begin() != _ZoneInstanceGroupMap.end() ) +00373 { +00374 string name= _ZoneInstanceGroupMap.begin()->first; +00375 +00376 <span class="comment">// bkup the state of this ig.</span> +00377 bkupIgFileNameList.push_back(_ZoneInstanceGroupMap.begin()->second.FileName); +00378 bkupIgAddedToScene.push_back(_ZoneInstanceGroupMap.begin()->second.AddedToScene); +00379 +00380 <span class="comment">// first remove from scene</span> +00381 unloadZoneIG( name.substr(0, name.find(<span class="charliteral">'.'</span>)) ); +00382 +00383 <span class="comment">// then delete this entry.</span> +00384 _ZoneInstanceGroupMap.begin()->second.release(); +00385 _ZoneInstanceGroupMap.erase(_ZoneInstanceGroupMap.begin()); +00386 } +00387 +00388 <span class="comment">// Then reload all Igs.</span> +00389 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i<bkupIgFileNameList.size(); i++) +00390 { +00391 <span class="keyword">const</span> <span class="keywordtype">char</span> *token= bkupIgFileNameList[i].c_str(); +00392 UInstanceGroup *ig = UInstanceGroup::createInstanceGroup(token); +00393 <span class="comment">// add it to the map.</span> +00394 string tokId= token; +00395 <a class="code" href="a05378.html#a276">strupr</a>(tokId); +00396 _ZoneInstanceGroupMap[tokId]= CInstanceGroupElement(ig, token); +00397 +00398 <span class="comment">// If was addedToScene before, re-add to scene now.</span> +00399 <span class="keywordflow">if</span>(bkupIgAddedToScene[i]) +00400 { +00401 loadZoneIG( tokId.substr(0, tokId.find(<span class="charliteral">'.'</span>)) ); +00402 } +00403 } +00404 } +00405 +00406 +00407 <span class="comment">// ***************************************************************************</span> +00408 <span class="keywordtype">void</span> CLandscapeIGManager::getAllIG(std::vector<UInstanceGroup *> &dest)<span class="keyword"> const</span> +00409 <span class="keyword"></span>{ +00410 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00411 dest.clear(); +00412 dest.reserve(_ZoneInstanceGroupMap.size()); +00413 <span class="comment">// add the instances</span> +00414 <span class="keywordflow">for</span>(TZoneInstanceGroupMap::const_iterator it = _ZoneInstanceGroupMap.begin(); it != _ZoneInstanceGroupMap.end(); ++it) +00415 { +00416 dest.push_back(it->second.Ig); +00417 } +00418 } +00419 +00420 <span class="comment">// ***************************************************************************</span> +00421 <span class="keywordtype">void</span> CLandscapeIGManager::getAllIGWithNames(std::vector<std::pair<UInstanceGroup *, std::string> > &dest)<span class="keyword"> const</span> +00422 <span class="keyword"></span>{ +00423 <a class="code" href="a04456.html#a0">NL3D_MEM_LANDSCAPE_IG</a> +00424 dest.clear(); +00425 dest.reserve(_ZoneInstanceGroupMap.size()); +00426 <span class="comment">// add the instances</span> +00427 <span class="keywordflow">for</span>(TZoneInstanceGroupMap::const_iterator it = _ZoneInstanceGroupMap.begin(); it != _ZoneInstanceGroupMap.end(); ++it) +00428 { +00429 dest.push_back(std::make_pair(it->second.Ig, it->second.FileName)); +00430 } +00431 } +00432 +00433 +00434 } <span class="comment">// NL3D</span> +</pre></div> </td> + </tr> +</table> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:42:51 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |