#include <landscape_user.h>
Inheritance diagram for NL3D::CLandscapeUser:
Nevrax France
Definition at line 48 of file landscape_user.h.
Public Member Functions | |
ShadowMapping | |
virtual bool | canReceiveShadowMap () const |
true if the instance receive shadow. By default false | |
virtual void | enableReceiveShadowMap (bool state) |
Object | |
CLandscapeUser (CScene *scene) | |
virtual | ~CLandscapeUser () |
Misc | |
virtual void | enableAdditive (bool enable) |
virtual bool | getRefineCenterAuto () const |
virtual const CVector & | getRefineCenterUser () const |
virtual std::string | getZoneName (const CVector &pos) |
Return the name of the zone around a particular position (in NL3D basis!). | |
virtual void | hide () |
hide the landscape. It is nor refined, nor rendered (=> take 0 CPU time). | |
virtual bool | isAdditiveEnabled () const |
virtual void | setRefineCenterAuto (bool mode) |
virtual void | setRefineCenterUser (const CVector &refineCenter) |
setRefineCenterAuto | |
virtual void | show () |
show the landscape. visible by default. | |
virtual void | enableVegetable (bool enable) |
virtual void | loadVegetableTexture (const std::string &textureFileName) |
virtual void | setupVegetableLighting (const CRGBA &ambient, const CRGBA &diffuse, const CVector &directionalLight) |
virtual void | setVegetableUpdateLightingFrequency (float freq) |
virtual void | setVegetableWind (const CVector &windDir, float windFreq, float windPower, float windBendMin) |
Load | |
All those load methods use CPath to search files. | |
virtual void | flushTiles (NLMISC::IProgressCallback &progress) |
Flush the tiles. | |
virtual void | getAllZoneLoaded (std::vector< std::string > &zoneLoaded) const |
Flush the tiles. | |
virtual void | invalidateAllTiles () |
Flush the tiles. | |
virtual void | loadAllZonesAround (const CVector &pos, float radius, std::vector< std::string > &zonesAdded) |
Flush the tiles. | |
virtual void | loadAllZonesAround (const CVector &pos, float radius) |
Load all Zones around a position. Call at init only!! (no zone must exist before). This is a blocking call. | |
virtual void | loadBankFiles (const std::string &tileBankFile, const std::string &farBankFile) |
Load the tile banks: the ".bank" and the ".farbank". | |
virtual void | postfixTileFilename (const char *postfix) |
Postfix tile filename. | |
virtual void | postfixTileVegetableDesc (const char *postfix) |
Postfix vegetable filename. | |
virtual void | refreshAllZonesAround (const CVector &pos, float radius, std::vector< std::string > &zonesAdded, std::vector< std::string > &zonesRemoved, NLMISC::IProgressCallback &progress) |
Delete old zones, or load new zones, around a position, until it is finished. This is a blocking call. | |
virtual void | refreshZonesAround (const CVector &pos, float radius, std::string &zoneAdded, std::string &zoneRemoved) |
Flush the tiles. | |
virtual void | refreshZonesAround (const CVector &pos, float radius) |
Delete old zones, or load new zones, around a position. new Zones are loaded async. | |
virtual void | removeAllZones () |
Flush the tiles. | |
virtual void | setZonePath (const std::string &zonePath) |
Set the zonePath from where zones are loaded. | |
Dynamic Lighting management | |
virtual CRGBA | getDLMGlobalVegetableColor () const |
virtual void | setDLMGlobalVegetableColor (CRGBA gvc) |
HeightField DeltaZ. | |
virtual CVector | getHeightFieldDeltaZ (float x, float y) const |
return the HeightField DeltaZ for the 2D position. (0,0,dZ) is returned. | |
virtual void | setHeightField (const CHeightMap &hf) |
Accessor for CLandscapeUser. | |
CLandscapeModel * | getLandscape () |
Lighting | |
virtual CRGBA | getPointLightDiffuseMaterial () const |
virtual void | setPointLightDiffuseMaterial (CRGBA diffuse) |
virtual void | setUpdateLightingFrequency (float freq) |
virtual void | setupStaticLight (const CRGBA &diffuse, const CRGBA &ambiant, float multiply) |
virtual void | updateLightingAll () |
Parameters | |
virtual float | getThreshold () const |
Get threshold. | |
virtual uint | getTileMaxSubdivision () |
Get Maximum Tile subdivision. | |
virtual float | getTileNear () const |
Get tile near distance. | |
virtual void | setThreshold (float thre) |
Set threshold for subdivsion quality. The lower is threshold, the more the landscape is subdivided. Default: 0.001. | |
virtual void | setTileColor (bool monochrome, float factor) |
Set all zones monochromatic or colored. | |
virtual void | setTileMaxSubdivision (uint tileDiv) |
Set Maximum Tile subdivision. Valid values must be in [0..4] (assert). Default is 0 (for now :) ). | |
virtual void | setTileNear (float tileNear) |
Set tile near distance. Default 50.f. maximized to length of Far alpha transition). | |
TileCallback | |
virtual ULandscapeTileCallback * | getTileCallback () const |
virtual void | setTileCallback (ULandscapeTileCallback *cb) |
Private Attributes | |
CLandscapeModel * | _Landscape |
CScene * | _Scene |
CZoneManager | _ZoneManager |
|
Definition at line 62 of file landscape_user.h. References _Landscape, NL3D::CScene::createModel(), NL3D::LandscapeModelId, NL3D_MEM_LANDSCAPE, and nlassert.
00063 { 00064 NL3D_MEM_LANDSCAPE 00065 nlassert(scene); 00066 _Scene= scene; 00067 _Landscape= (CLandscapeModel*)_Scene->createModel(LandscapeModelId); 00068 } |
|
Definition at line 69 of file landscape_user.h. References _Landscape, NL3D::CScene::deleteModel(), and NL3D_MEM_LANDSCAPE.
00070 { 00071 NL3D_MEM_LANDSCAPE 00072 _Scene->deleteModel(_Landscape); 00073 _Landscape= NULL; 00074 } |
|
true if the instance receive shadow. By default false
Implements NL3D::ULandscape. Definition at line 554 of file landscape_user.cpp. References _Landscape, and NL3D::CTransform::canReceiveShadowMap().
00555 { 00556 return _Landscape->canReceiveShadowMap(); 00557 } |
|
Set additive Lighting. Disabled by default.
Implements NL3D::ULandscape. Definition at line 482 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::enableAdditive(), NL3D_HAUTO_UI_LANDSCAPE, and NL3D_MEM_LANDSCAPE.
00483 { 00484 NL3D_MEM_LANDSCAPE 00485 NL3D_HAUTO_UI_LANDSCAPE; 00486 _Landscape->enableAdditive(enable); 00487 } |
|
By default, map shadow receiving is disabled. This enabled shadow for this model. Fails if the model don't support dynamic Map Shadow Receiving (eg Particle system) Implements NL3D::ULandscape. Definition at line 548 of file landscape_user.cpp. References _Landscape, and NL3D::CTransform::enableReceiveShadowMap().
00549 { 00550 _Landscape->enableReceiveShadowMap(state); 00551 } |
|
enable the vegetable management in landscape. Valid only if Hardware support VertexShader. Implements NL3D::ULandscape. Definition at line 432 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::enableVegetable(), NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, and NL3D_MEM_LANDSCAPE.
00433 { 00434 NL3D_MEM_LANDSCAPE 00435 NL3D_HAUTO_UI_LANDSCAPE; 00436 _Landscape->Landscape.enableVegetable(enable); 00437 } |
|
Flush the tiles.
Implements NL3D::ULandscape. Definition at line 91 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::flushTiles(), NL3D::CScene::getDriver(), NL3D::CTileSet::getNumTile128(), NL3D::CTileSet::getNumTile256(), NL3D::CTileSetTransition::getTile(), NL3D::CTileSet::getTile128(), NL3D::CTileSet::getTile256(), NL3D::CTileBank::getTileSet(), NL3D::CTileBank::getTileSetCount(), NL3D::CTileSet::getTransition(), NL3D::CLandscape::initTileBank(), NL3D::CLandscape::initTileBanks(), NL3D::CLandscapeModel::Landscape, NL3D::CTileBank::loadTileVegetableDescs(), nlwarning, NLMISC::IProgressCallback::progress(), sint, NL3D::CLandscape::TileBank, uint, and uint16.
00092 { 00093 // After loading the TileBank, and before initTileBanks(), must load the vegetables descritpor 00094 _Landscape->Landscape.TileBank.loadTileVegetableDescs(); 00095 00096 if ( ! _Landscape->Landscape.initTileBanks() ) 00097 { 00098 nlwarning( "You need to recompute bank.farbank for the far textures" ); 00099 } 00100 00101 // Count tiles 00102 uint tileCount = 0; 00103 sint ts; 00104 for (ts=0; ts<_Landscape->Landscape.TileBank.getTileSetCount (); ts++) 00105 { 00106 CTileSet *tileSet=_Landscape->Landscape.TileBank.getTileSet (ts); 00107 tileCount += tileSet->getNumTile128(); 00108 tileCount += tileSet->getNumTile256(); 00109 tileCount += CTileSet::count; 00110 } 00111 00112 // Second, temporary, flushTiles. 00113 //=============================== 00114 uint tile = 0; 00115 for (ts=0; ts<_Landscape->Landscape.TileBank.getTileSetCount (); ts++) 00116 { 00117 CTileSet *tileSet=_Landscape->Landscape.TileBank.getTileSet (ts); 00118 sint tl; 00119 for (tl=0; tl<tileSet->getNumTile128(); tl++) 00120 { 00121 // Progress bar 00122 progress.progress ((float)tile/(float)tileCount); 00123 tile++; 00124 00125 _Landscape->Landscape.flushTiles (_Scene->getDriver(), (uint16)tileSet->getTile128(tl), 1); 00126 } 00127 for (tl=0; tl<tileSet->getNumTile256(); tl++) 00128 { 00129 // Progress bar 00130 progress.progress ((float)tile/(float)tileCount); 00131 tile++; 00132 00133 _Landscape->Landscape.flushTiles (_Scene->getDriver(), (uint16)tileSet->getTile256(tl), 1); 00134 } 00135 for (tl=0; tl<CTileSet::count; tl++) 00136 { 00137 // Progress bar 00138 progress.progress ((float)tile/(float)tileCount); 00139 tile++; 00140 00141 _Landscape->Landscape.flushTiles (_Scene->getDriver(), (uint16)tileSet->getTransition(tl)->getTile (), 1); 00142 } 00143 } 00144 00145 // Init tiles 00146 _Landscape->Landscape.initTileBank(); 00147 } |
|
Flush the tiles.
Implements NL3D::ULandscape. Definition at line 230 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::getZoneList(), NL3D::CLandscapeModel::Landscape, NL3D_MEM_LANDSCAPE, and uint.
00231 { 00232 NL3D_MEM_LANDSCAPE 00233 // Build the list of zoneId. 00234 std::vector<uint16> zoneIds; 00235 _Landscape->Landscape.getZoneList(zoneIds); 00236 00237 // transcript 00238 zoneLoaded.clear(); 00239 zoneLoaded.resize(zoneIds.size()); 00240 for(uint i=0;i<zoneLoaded.size();i++) 00241 { 00242 CLandscape::buildZoneName(zoneIds[i], zoneLoaded[i]); 00243 } 00244 } |
|
see setDLMGlobalVegetableColor() Implements NL3D::ULandscape. Definition at line 519 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::getDLMGlobalVegetableColor(), NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, and NL3D_MEM_LANDSCAPE.
00520 { 00521 NL3D_MEM_LANDSCAPE 00522 NL3D_HAUTO_UI_LANDSCAPE; 00523 return _Landscape->Landscape.getDLMGlobalVegetableColor(); 00524 } |
|
return the HeightField DeltaZ for the 2D position. (0,0,dZ) is returned.
Implements NL3D::ULandscape. Definition at line 415 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::getHeightFieldDeltaZ(), NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, x, and y.
00416 { 00417 NL3D_MEM_LANDSCAPE 00418 NL3D_HAUTO_UI_LANDSCAPE; 00419 return _Landscape->Landscape.getHeightFieldDeltaZ(x,y); 00420 } |
|
Definition at line 212 of file landscape_user.h. References _Landscape, and NL3D_MEM_LANDSCAPE.
00213 { 00214 NL3D_MEM_LANDSCAPE 00215 return _Landscape; 00216 } |
|
Implements NL3D::ULandscape. Definition at line 504 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::getPointLightDiffuseMaterial(), NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, and NL3D_MEM_LANDSCAPE.
00505 { 00506 NL3D_MEM_LANDSCAPE 00507 NL3D_HAUTO_UI_LANDSCAPE; 00508 return _Landscape->Landscape.getPointLightDiffuseMaterial(); 00509 } |
|
Implements NL3D::ULandscape. Definition at line 572 of file landscape_user.cpp. References _Landscape, and NL3D::CLandscapeModel::getRefineCenterAuto().
00573 { 00574 return _Landscape->getRefineCenterAuto(); 00575 } |
|
Implements NL3D::ULandscape. Definition at line 578 of file landscape_user.cpp. References _Landscape, and NL3D::CLandscapeModel::getRefineCenterUser().
00579 { 00580 return _Landscape->getRefineCenterUser(); 00581 } |
|
Get threshold.
Implements NL3D::ULandscape. Definition at line 369 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::getThreshold(), NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, and NL3D_MEM_LANDSCAPE.
00370 { 00371 NL3D_MEM_LANDSCAPE 00372 NL3D_HAUTO_UI_LANDSCAPE; 00373 return _Landscape->Landscape.getThreshold(); 00374 } |
|
Implements NL3D::ULandscape. Definition at line 590 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::getTileCallback(), and NL3D::CLandscapeModel::Landscape.
00591 { 00592 return _Landscape->Landscape.getTileCallback(); 00593 } |
|
Get Maximum Tile subdivision.
Implements NL3D::ULandscape. Definition at line 397 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::getTileMaxSubdivision(), NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and uint.
00398 { 00399 NL3D_MEM_LANDSCAPE 00400 NL3D_HAUTO_UI_LANDSCAPE; 00401 return _Landscape->Landscape.getTileMaxSubdivision(); 00402 } |
|
Get tile near distance.
Implements NL3D::ULandscape. Definition at line 383 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::getTileNear(), NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, and NL3D_MEM_LANDSCAPE.
00384 { 00385 NL3D_MEM_LANDSCAPE 00386 NL3D_HAUTO_UI_LANDSCAPE; 00387 return _Landscape->Landscape.getTileNear(); 00388 } |
|
Return the name of the zone around a particular position (in NL3D basis!).
Implements NL3D::ULandscape. Definition at line 406 of file landscape_user.cpp. References _ZoneManager, NL3D::CZoneSearch::getZoneName(), NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, uint, NLMISC::CVector::x, and NLMISC::CVector::y.
00407 { 00408 NL3D_MEM_LANDSCAPE 00409 NL3D_HAUTO_UI_LANDSCAPE; 00410 return _ZoneManager.getZoneName((uint)pos.x, (uint)(-pos.y), 0, 0).first; 00411 } |
|
hide the landscape. It is nor refined, nor rendered (=> take 0 CPU time).
Implements NL3D::ULandscape. Definition at line 158 of file landscape_user.h. References _Landscape, NL3D::CTransform::hide(), and NL3D_MEM_LANDSCAPE.
00159 { 00160 NL3D_MEM_LANDSCAPE 00161 _Landscape->hide(); 00162 } |
|
Flush the tiles.
Implements NL3D::ULandscape. Definition at line 57 of file landscape_user.cpp. References _Landscape, NL3D::CLandscape::invalidateAllTiles(), NL3D::CLandscapeModel::Landscape, and NL3D_MEM_LANDSCAPE.
00058 { 00059 NL3D_MEM_LANDSCAPE 00060 _Landscape->Landscape.invalidateAllTiles(); 00061 } |
|
Get additive Lighting
Implements NL3D::ULandscape. Definition at line 489 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::isAdditive(), NL3D_HAUTO_UI_LANDSCAPE, and NL3D_MEM_LANDSCAPE.
00490 { 00491 NL3D_MEM_LANDSCAPE 00492 NL3D_HAUTO_UI_LANDSCAPE; 00493 return _Landscape->isAdditive (); 00494 } |
|
Flush the tiles.
Implements NL3D::ULandscape. Definition at line 151 of file landscape_user.cpp. References _Landscape, _ZoneManager, NL3D::CLandscape::addZone(), NL3D::CLandscape::checkBinds(), NL3D::CZoneManager::checkZonesAround(), NL3D::CZoneManager::isLoading(), NL3D::CZoneManager::isWorkComplete(), NL3D::CLandscapeModel::Landscape, NL3D::CZoneManager::SZoneManagerWork::NameZoneAdded, NL3D_HAUTO_LOAD_LANDSCAPE, NL3D_MEM_LANDSCAPE, nlassert, NLMISC::nlSleep(), nlwarning, uint, NLMISC::CVector::x, NLMISC::CVector::y, NL3D::CZoneManager::SZoneManagerWork::Zone, NL3D::CZoneManager::SZoneManagerWork::ZoneAdded, and NL3D::CZoneManager::SZoneManagerWork::ZoneRemoved.
00152 { 00153 NL3D_MEM_LANDSCAPE 00154 NL3D_HAUTO_LOAD_LANDSCAPE; 00155 00156 zonesAdded.clear(); 00157 00158 _ZoneManager.checkZonesAround ((uint)pos.x, (uint)(-pos.y), (uint)radius); 00159 while (_ZoneManager.isLoading()) 00160 { 00161 CZoneManager::SZoneManagerWork Work; 00162 if (_ZoneManager.isWorkComplete(Work)) 00163 { 00164 nlassert(!Work.ZoneRemoved); 00165 if (Work.ZoneAdded) 00166 { 00167 if (Work.Zone == (CZone*)-1) 00168 { 00169 nlwarning ("Can't load zone %s", Work.NameZoneAdded.c_str ()); 00170 } 00171 else 00172 { 00173 _Landscape->Landscape.addZone (*Work.Zone); 00174 00175 delete Work.Zone; 00176 std::string zoneadd = Work.NameZoneAdded; 00177 zoneadd = zoneadd.substr(0, zoneadd.find('.')); 00178 zonesAdded.push_back(zoneadd); 00179 } 00180 } 00181 } 00182 else 00183 { 00184 nlSleep (1); 00185 } 00186 _ZoneManager.checkZonesAround ((uint)pos.x, (uint)(-pos.y), (uint)radius); 00187 } 00188 // Yoyo: must check the binds of the zones. 00189 _Landscape->Landscape.checkBinds(); 00190 } |
|
Load all Zones around a position. Call at init only!! (no zone must exist before). This is a blocking call.
Implements NL3D::ULandscape. Definition at line 247 of file landscape_user.cpp. References NL3D_MEM_LANDSCAPE.
00248 { 00249 NL3D_MEM_LANDSCAPE 00250 std::vector<std::string> dummy; 00251 loadAllZonesAround(pos, radius, dummy); 00252 } |
|
Load the tile banks: the ".bank" and the ".farbank".
Implements NL3D::ULandscape. Definition at line 64 of file landscape_user.cpp. References _Landscape, NL3D::CTileBank::clear(), NLMISC::CIFile::close(), NL3D::CLandscapeModel::Landscape, NL3D::CTileBank::makeAllExtensionDDS(), NL3D::CTileBank::makeAllPathRelative(), NL3D_HAUTO_LOAD_LANDSCAPE, NL3D_MEM_LANDSCAPE, NL3D::CTileFarBank::serial(), NL3D::CTileBank::serial(), NL3D::CTileBank::setAbsPath(), NL3D::CLandscape::TileBank, and NL3D::CLandscape::TileFarBank.
00065 { 00066 NL3D_MEM_LANDSCAPE 00067 NL3D_HAUTO_LOAD_LANDSCAPE; 00068 00069 // Clear the bank 00070 _Landscape->Landscape.TileBank.clear (); 00071 00072 // First, load the banks. 00073 //======================= 00074 CIFile bankFile(CPath::lookup(tileBankFile)); 00075 _Landscape->Landscape.TileBank.serial(bankFile); 00076 // All textures path are relative! 00077 _Landscape->Landscape.TileBank.makeAllPathRelative(); 00078 // Use DDS!!! 00079 _Landscape->Landscape.TileBank.makeAllExtensionDDS(); 00080 // No absolute path 00081 _Landscape->Landscape.TileBank.setAbsPath (""); 00082 00083 CIFile farbankFile(CPath::lookup(farBankFile)); 00084 _Landscape->Landscape.TileFarBank.serial(farbankFile); 00085 bankFile.close(); 00086 farbankFile.close(); 00087 } |
|
load a texture for the vegetable, lookup in CPath Implements NL3D::ULandscape. Definition at line 440 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D::CLandscape::loadVegetableTexture(), NL3D_HAUTO_LOAD_LANDSCAPE, and NL3D_MEM_LANDSCAPE.
00441 { 00442 NL3D_MEM_LANDSCAPE 00443 NL3D_HAUTO_LOAD_LANDSCAPE; 00444 _Landscape->Landscape.loadVegetableTexture(textureFileName); 00445 } |
|
Postfix tile filename.
Implements NL3D::ULandscape. Definition at line 533 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL, NL3D_MEM_LANDSCAPE, NL3D::CTileBank::postfixTileFilename(), and NL3D::CLandscape::TileBank.
00534 { 00535 NL3D_MEM_LANDSCAPE 00536 NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL; 00537 _Landscape->Landscape.TileBank.postfixTileFilename (postfix); 00538 } |
|
Postfix vegetable filename.
Implements NL3D::ULandscape. Definition at line 540 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL, NL3D_MEM_LANDSCAPE, NL3D::CTileBank::postfixTileVegetableDesc(), and NL3D::CLandscape::TileBank.
00541 { 00542 NL3D_MEM_LANDSCAPE 00543 NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL; 00544 _Landscape->Landscape.TileBank.postfixTileVegetableDesc (postfix); 00545 } |
|
Delete old zones, or load new zones, around a position, until it is finished. This is a blocking call.
Implements NL3D::ULandscape. Definition at line 193 of file landscape_user.cpp. References _ZoneManager, NL3D::CZoneManager::checkZonesAround(), NL3D::CZoneManager::getNumZoneLeftToLoad(), NL3D::CZoneManager::isLoading(), NL3D::CZoneManager::isRemoving(), NL3D_HAUTO_LOAD_LANDSCAPE, NL3D_MEM_LANDSCAPE, NLMISC::nlSleep(), NLMISC::IProgressCallback::progress(), refreshZonesAround(), uint, NLMISC::CVector::x, and NLMISC::CVector::y.
00195 { 00196 NL3D_MEM_LANDSCAPE 00197 NL3D_HAUTO_LOAD_LANDSCAPE; 00198 00199 zonesAdded.clear(); 00200 zonesRemoved.clear(); 00201 std::string za, zr; 00202 00203 _ZoneManager.checkZonesAround ((uint)pos.x, (uint)(-pos.y), (uint)radius); 00204 refreshZonesAround (pos, radius, za, zr); 00205 00206 // Zone to load 00207 uint zoneToLoad = _ZoneManager.getNumZoneLeftToLoad (); 00208 while (_ZoneManager.isLoading() || _ZoneManager.isRemoving()) 00209 { 00210 // Progress bar 00211 if (zoneToLoad != 0) 00212 progress.progress ((float)(zoneToLoad-_ZoneManager.getNumZoneLeftToLoad ())/(float)zoneToLoad); 00213 00214 refreshZonesAround (pos, radius, za, zr); 00215 00216 // some zone added or removed?? 00217 if(za != "") 00218 zonesAdded.push_back(za); 00219 if(zr != "") 00220 zonesRemoved.push_back(zr); 00221 00222 _ZoneManager.checkZonesAround ((uint)pos.x, (uint)(-pos.y), (uint)radius); 00223 00224 if (_ZoneManager.isLoading()) 00225 nlSleep (0); 00226 } 00227 } |
|
Flush the tiles.
Implements NL3D::ULandscape. Definition at line 265 of file landscape_user.cpp. References _Landscape, _ZoneManager, NL3D::CLandscape::addZone(), NL3D::CLandscape::checkBinds(), NL3D::CZoneManager::checkZonesAround(), NL3D::CZone::getZoneId(), NL3D::CZoneManager::SZoneManagerWork::IdZoneToRemove, NL3D::CZoneManager::isWorkComplete(), NL3D::CLandscapeModel::Landscape, NL3D::CZoneManager::SZoneManagerWork::NameZoneAdded, NL3D::CZoneManager::SZoneManagerWork::NameZoneRemoved, NL3D_HAUTO_LOAD_LANDSCAPE, NL3D_MEM_LANDSCAPE, nlwarning, NL3D::CLandscape::removeZone(), uint, NLMISC::CVector::x, NLMISC::CVector::y, NL3D::CZoneManager::SZoneManagerWork::Zone, NL3D::CZoneManager::SZoneManagerWork::ZoneAdded, and NL3D::CZoneManager::SZoneManagerWork::ZoneRemoved.
00266 { 00267 NL3D_MEM_LANDSCAPE 00268 NL3D_HAUTO_LOAD_LANDSCAPE; 00269 00270 zoneRemoved= ""; 00271 zoneAdded= ""; 00272 CZoneManager::SZoneManagerWork Work; 00273 // Check if new zone must be added to landscape 00274 if (_ZoneManager.isWorkComplete(Work)) 00275 { 00276 if (Work.ZoneAdded) 00277 { 00278 if (Work.Zone == (CZone*)-1) 00279 { 00280 nlwarning ("Can't load zone %s", Work.NameZoneAdded.c_str ()); 00281 } 00282 else 00283 { 00284 _Landscape->Landscape.addZone(*Work.Zone); 00285 00286 // Yoyo: must check the binds of the new inserted zone. 00287 try 00288 { 00289 _Landscape->Landscape.checkBinds(Work.Zone->getZoneId()); 00290 } 00291 catch (EBadBind &e) 00292 { 00293 nlwarning ("Bind error : %s", e.what()); 00294 } 00295 00296 delete Work.Zone; 00297 zoneAdded = Work.NameZoneAdded; 00298 zoneAdded = zoneAdded.substr(0, zoneAdded.find('.')); 00299 } 00300 } 00301 00302 // Check if a zone must be removed from landscape 00303 if (Work.ZoneRemoved) 00304 { 00305 _Landscape->Landscape.removeZone (Work.IdZoneToRemove); 00306 zoneRemoved = Work.NameZoneRemoved; 00307 zoneRemoved = zoneRemoved.substr(0, zoneRemoved.find('.')); 00308 } 00309 } 00310 00311 _ZoneManager.checkZonesAround((uint)pos.x, (uint)(-pos.y), (uint)radius); 00312 } |
|
Delete old zones, or load new zones, around a position. new Zones are loaded async.
Implements NL3D::ULandscape. Definition at line 256 of file landscape_user.cpp. References NL3D_HAUTO_LOAD_LANDSCAPE, and NL3D_MEM_LANDSCAPE. Referenced by refreshAllZonesAround().
00257 { 00258 NL3D_MEM_LANDSCAPE 00259 NL3D_HAUTO_LOAD_LANDSCAPE; 00260 00261 std::string dummy1, dummy2; 00262 refreshZonesAround(pos, radius, dummy1, dummy2); 00263 } |
|
Flush the tiles.
Implements NL3D::ULandscape. Definition at line 315 of file landscape_user.cpp. References _Landscape, _ZoneManager, NL3D::CZoneManager::clear(), NL3D::CLandscape::clear(), NL3D::CZoneManager::SZoneManagerWork::IdZoneToRemove, NL3D::CZoneManager::isLoading(), NL3D::CZoneManager::isWorkComplete(), NL3D::CLandscapeModel::Landscape, NL3D::CZoneManager::SZoneManagerWork::NameZoneAdded, NL3D_HAUTO_LOAD_LANDSCAPE, NL3D_MEM_LANDSCAPE, nlwarning, NL3D::CLandscape::removeZone(), NL3D::CZoneManager::SZoneManagerWork::Zone, NL3D::CZoneManager::SZoneManagerWork::ZoneAdded, and NL3D::CZoneManager::SZoneManagerWork::ZoneRemoved.
00316 { 00317 NL3D_MEM_LANDSCAPE 00318 NL3D_HAUTO_LOAD_LANDSCAPE; 00319 00320 CZoneManager::SZoneManagerWork Work; 00321 // Check if new zone must be added to landscape 00322 while (_ZoneManager.isLoading()) 00323 { 00324 if (_ZoneManager.isWorkComplete(Work)) 00325 { 00326 if (Work.ZoneAdded) 00327 { 00328 if (Work.Zone == (CZone*)-1) 00329 { 00330 nlwarning ("Can't load zone %s", Work.NameZoneAdded.c_str ()); 00331 } 00332 else 00333 { 00334 delete Work.Zone; 00335 } 00336 } 00337 00338 // Check if a zone must be removed from landscape 00339 if (Work.ZoneRemoved) 00340 { 00341 _Landscape->Landscape.removeZone (Work.IdZoneToRemove); 00342 } 00343 } 00344 } 00345 00346 _Landscape->Landscape.clear(); 00347 00348 _ZoneManager.clear(); 00349 } |
|
For Vegetable Dynamic ligthing only: this is an approximate color of all vegetables. Default is (180, 180, 180). Implements NL3D::ULandscape. Definition at line 512 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::setDLMGlobalVegetableColor().
00513 { 00514 NL3D_MEM_LANDSCAPE 00515 NL3D_HAUTO_UI_LANDSCAPE; 00516 _Landscape->Landscape.setDLMGlobalVegetableColor(gvc); 00517 } |
|
set the HeightField data. NB: take lot of place in memory. only one is possible. You should setup this heightfield around the zones which will be loaded. It is applied only when a zone is loaded, so you should setup it 2km around the user, each time you move too far from a previous place (eg 160m from last setup). Implements NL3D::ULandscape. Definition at line 423 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::setHeightField().
00424 { 00425 NL3D_MEM_LANDSCAPE 00426 NL3D_HAUTO_UI_LANDSCAPE; 00427 _Landscape->Landscape.setHeightField(hf); 00428 } |
|
Setup the equivalent material diffuse component used for both Static and Dynamic PointLights. Default is White. Implements NL3D::ULandscape. Definition at line 497 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::setPointLightDiffuseMaterial().
00498 { 00499 NL3D_MEM_LANDSCAPE 00500 NL3D_HAUTO_UI_LANDSCAPE; 00501 _Landscape->Landscape.setPointLightDiffuseMaterial(diffuse); 00502 } |
|
if true, the refine Center is auto computed each frame from Camera Position. Else must be given by setRefineCenterUser() Default to true. Implements NL3D::ULandscape. Definition at line 560 of file landscape_user.cpp. References _Landscape, and NL3D::CLandscapeModel::setRefineCenterAuto().
00561 { 00562 _Landscape->setRefineCenterAuto(mode); 00563 } |
|
setRefineCenterAuto
Implements NL3D::ULandscape. Definition at line 566 of file landscape_user.cpp. References _Landscape, and NL3D::CLandscapeModel::setRefineCenterUser().
00567 { 00568 _Landscape->setRefineCenterUser(refineCenter); 00569 } |
|
Set threshold for subdivsion quality. The lower is threshold, the more the landscape is subdivided. Default: 0.001.
Implements NL3D::ULandscape. Definition at line 362 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::setThreshold().
00363 { 00364 NL3D_MEM_LANDSCAPE 00365 NL3D_HAUTO_UI_LANDSCAPE; 00366 _Landscape->Landscape.setThreshold(thre); 00367 } |
|
Implements NL3D::ULandscape. Definition at line 584 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, and NL3D::CLandscape::setTileCallback().
00585 { 00586 _Landscape->Landscape.setTileCallback(cb); 00587 } |
|
Set all zones monochromatic or colored.
Implements NL3D::ULandscape. Definition at line 144 of file landscape_user.h. References _ZoneManager, and NL3D::CZoneManager::setZoneTileColor().
00144 { _ZoneManager.setZoneTileColor(monochrome, factor); } |
|
Set Maximum Tile subdivision. Valid values must be in [0..4] (assert). Default is 0 (for now :) ).
Implements NL3D::ULandscape. Definition at line 390 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, NL3D::CLandscape::setTileMaxSubdivision(), and uint.
00391 { 00392 NL3D_MEM_LANDSCAPE 00393 NL3D_HAUTO_UI_LANDSCAPE; 00394 _Landscape->Landscape.setTileMaxSubdivision(tileDiv); 00395 } |
|
Set tile near distance. Default 50.f. maximized to length of Far alpha transition).
Implements NL3D::ULandscape. Definition at line 376 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::setTileNear().
00377 { 00378 NL3D_MEM_LANDSCAPE 00379 NL3D_HAUTO_UI_LANDSCAPE; 00380 _Landscape->Landscape.setTileNear(tileNear); 00381 } |
|
Set the frequency of lighting update. If freq==1, ALL patchs are updated each second. e.g: if 1/20, then every 20 seconds, all patchs are updated. If you set 0, no update will be done at all (this is the default setup!!). Implements NL3D::ULandscape. Definition at line 473 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::setUpdateLightingFrequency().
00474 { 00475 NL3D_MEM_LANDSCAPE 00476 NL3D_HAUTO_UI_LANDSCAPE; 00477 _Landscape->Landscape.setUpdateLightingFrequency(freq); 00478 } |
|
Setup the light color use for static illumination. NB: This setup will be visible only for new texture far/near computed (when player move or see dynamic lighting).
Implements NL3D::ULandscape. Definition at line 352 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::setupStaticLight().
00353 { 00354 NL3D_MEM_LANDSCAPE 00355 NL3D_HAUTO_UI_LANDSCAPE; 00356 _Landscape->Landscape.setupStaticLight(diffuse, ambiant, multiply); 00357 } |
|
setup lighting ambient and diffuse for vegetable. Implements NL3D::ULandscape. Definition at line 448 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::setupVegetableLighting().
00449 { 00450 NL3D_MEM_LANDSCAPE 00451 NL3D_HAUTO_UI_LANDSCAPE; 00452 _Landscape->Landscape.setupVegetableLighting(ambient, diffuse, directionalLight); 00453 } |
|
set the frequency of Vegetable lighting update. If freq==1, ALL lighted igs are updated each second. e.g: if 1/20, then every 20 seconds, all Igs are updated. If you set 0, no update will be done at all (this is the default setup!!). Implements NL3D::ULandscape. Definition at line 464 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::setVegetableUpdateLightingFrequency().
00465 { 00466 NL3D_MEM_LANDSCAPE 00467 NL3D_HAUTO_UI_LANDSCAPE; 00468 _Landscape->Landscape.setVegetableUpdateLightingFrequency(freq); 00469 } |
|
set the vegetable Wind for animation. All thoses variables may be modified each frame without penalty.
Implements NL3D::ULandscape. Definition at line 456 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_UI_LANDSCAPE, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::setVegetableWind().
00457 { 00458 NL3D_MEM_LANDSCAPE 00459 NL3D_HAUTO_UI_LANDSCAPE; 00460 _Landscape->Landscape.setVegetableWind(windDir, windFreq, windPower, windBendMin); 00461 } |
|
Set the zonePath from where zones are loaded.
Implements NL3D::ULandscape. |
|
show the landscape. visible by default.
Implements NL3D::ULandscape. Definition at line 153 of file landscape_user.h. References _Landscape, NL3D_MEM_LANDSCAPE, and NL3D::CTransform::show().
00154 { 00155 NL3D_MEM_LANDSCAPE 00156 _Landscape->show(); 00157 } |
|
update the lighting of ALL patch (slow method). NB: work even if UpdateLightingFrequency==0 Additionaly, vegetables are also ALL updated. WARNING!! If Scene Lighting is enabled (usual case), vegetable lighting setup take last Sun setup at UScene::render(). Hence, you should force the new lighting setup with ULandscape::setupVegetableLighting(), before calling updateLightingAll(). Implements NL3D::ULandscape. Definition at line 526 of file landscape_user.cpp. References _Landscape, NL3D::CLandscapeModel::Landscape, NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL, NL3D_MEM_LANDSCAPE, and NL3D::CLandscape::updateLightingAll().
00527 { 00528 NL3D_MEM_LANDSCAPE 00529 NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL; 00530 _Landscape->Landscape.updateLightingAll(); 00531 } |
|
|
Definition at line 52 of file landscape_user.h. |
|
Definition at line 56 of file landscape_user.h. Referenced by getZoneName(), loadAllZonesAround(), refreshAllZonesAround(), refreshZonesAround(), removeAllZones(), and setTileColor(). |