#include <tile_bank.h>
Nevrax France
Definition at line 494 of file tile_bank.h.
Public Types | |
enum | TTileType { _128x128 = 0, _256x256, transition, undefined } |
Public Member Functions | |
sint | addLand (const std::string &name) |
sint | addTileSet (const std::string &name) |
void | cleanUnusedData () |
void | clear () |
void | computeXRef () |
CTileBank () | |
const std::string & | getAbsPath () const |
uint | getDisplacementMap (const std::string &fileName) |
const char * | getDisplacementMap (uint noiseMap) |
uint | getDisplacementMapCount () const |
CTileLand * | getLand (int landIndex) |
const CTileLand * | getLand (int landIndex) const |
sint | getLandCount () const |
sint | getNumBitmap (CTile::TBitmap bitmap) const |
CTile * | getTile (int tileIndex) |
const CTile * | getTile (int tileIndex) const |
sint | getTileCount () const |
CTileSet * | getTileSet (int tileIndex) |
const CTileSet * | getTileSet (int tileIndex) const |
sint | getTileSetCount () const |
void | getTileXRef (int tile, int &tileSet, int &number, TTileType &type) const |
void | makeAllExtensionDDS () |
This method change ".tga" of texture filename, to ".dds". Do this only for Additive and Diffuse part (not alpha). | |
void | makeAllPathRelative () |
void | postfixTileFilename (const char *filename) |
Postfix tile filename. | |
void | postfixTileVegetableDesc (const char *filename) |
Postfix tile vegetable desc. | |
void | removeDisplacementMap (uint mapId) |
void | removeLand (sint landIndex) |
void | removeTileSet (sint landIndex) |
void | serial (class NLMISC::IStream &f) throw (NLMISC::EStream) |
void | setAbsPath (const std::string &newPath) |
void | setDisplacementMap (uint noiseMap, const char *newName) |
void | xchgTileset (sint first, sint second) |
Vegetable | |
CTileNoiseMap * | getTileNoiseMap (uint tileNumber, uint tileSubNoise) |
const CTileVegetableDesc & | getTileVegetableDesc (uint tileNumber) const |
void | initTileVegetableDescs (CVegetableManager *vegetableManager) |
void | loadTileVegetableDescs () |
Private Member Functions | |
sint | createTile () |
void | freeTile (int tileIndex) |
Private Attributes | |
std::string | _AbsPath |
std::vector< CTileNoise > | _DisplacementMap |
std::vector< CTileLand > | _LandVector |
std::vector< CTileSet > | _TileSetVector |
std::vector< CTile > | _TileVector |
std::vector< CTileXRef > | _TileXRef |
Static Private Attributes | |
const sint | _Version = 4 |
Friends | |
class | CTileSet |
|
Definition at line 498 of file tile_bank.h.
00498 { _128x128=0, _256x256, transition, undefined }; |
|
Definition at line 90 of file tile_bank.cpp. References _DisplacementMap.
00091 { 00092 // Default _DisplacementMap 00093 _DisplacementMap.resize (1); 00094 00095 // Fill it with 0 00096 _DisplacementMap[0].setEmpty (); 00097 } |
|
Definition at line 172 of file tile_bank.cpp. References _LandVector, and sint.
00173 { 00174 sint last=_LandVector.size(); 00175 _LandVector.push_back(CTileLand()); 00176 _LandVector[last].setName (name); 00177 return last; 00178 } |
|
Definition at line 189 of file tile_bank.cpp. References _TileSetVector, createTile(), CTileSet, and sint.
00190 { 00191 sint last=_TileSetVector.size(); 00192 _TileSetVector.push_back(CTileSet()); 00193 _TileSetVector[last].setName (name); 00194 for (int i=0; i<CTileSet::count; i++) 00195 { 00196 _TileSetVector[last]._TileTransition[i]._Tile=createTile (); 00197 } 00198 return last; 00199 } |
|
Definition at line 429 of file tile_bank.cpp. References _LandVector, _TileSetVector, and uint.
00430 { 00431 // Clean each tileset 00432 for (uint i=0; i<_TileSetVector.size(); i++) 00433 { 00434 // Clean the tileset 00435 _TileSetVector[i].cleanUnusedData (); 00436 } 00437 00438 // Clear the land vector 00439 _LandVector.clear(); 00440 } |
|
Definition at line 216 of file tile_bank.cpp. References _AbsPath, _DisplacementMap, _LandVector, _TileSetVector, _TileVector, and _TileXRef. Referenced by NL3D::CLandscapeUser::loadBankFiles().
00217 { 00218 _LandVector.clear (); 00219 _TileSetVector.clear (); 00220 _TileVector.clear (); 00221 _TileXRef.clear (); 00222 _DisplacementMap.clear (); 00223 _AbsPath.clear (); 00224 } |
|
Definition at line 288 of file tile_bank.cpp. References _128x128, _256x256, _TileSetVector, _TileVector, _TileXRef, NL3D::CTileSet::getNumTile128(), NL3D::CTileSet::getNumTile256(), NL3D::CTileSetTransition::getTile(), NL3D::CTileSet::getTile128(), NL3D::CTileSet::getTile256(), getTileSet(), NL3D::CTileSet::getTransition(), index, s, sint, t, and transition.
00289 { 00290 // Resize 00291 _TileXRef.resize (_TileVector.size()); 00292 00293 // Erase number of the tileset in xref 00294 for (int tile=0; tile<(sint)_TileVector.size(); tile++) 00295 _TileXRef[tile]._XRefTileSet=-1; 00296 00297 // Erase number of the tileset in xref 00298 for (int s=0; s<(sint)_TileSetVector.size(); s++) 00299 { 00300 int t; 00301 CTileSet *tileSet=getTileSet (s); 00302 for (t=0; t<tileSet->getNumTile128(); t++) 00303 { 00304 int index=tileSet->getTile128 (t); 00305 _TileXRef[index]._XRefTileSet=s; 00306 _TileXRef[index]._XRefTileNumber=t; 00307 _TileXRef[index]._XRefTileType=_128x128; 00308 } 00309 for (t=0; t<tileSet->getNumTile256(); t++) 00310 { 00311 int index=tileSet->getTile256 (t); 00312 _TileXRef[index]._XRefTileSet=s; 00313 _TileXRef[index]._XRefTileNumber=t; 00314 _TileXRef[index]._XRefTileType=_256x256; 00315 } 00316 for (t=0; t<CTileSet::count; t++) 00317 { 00318 int index=tileSet->getTransition (t)->getTile(); 00319 _TileXRef[index]._XRefTileSet=s; 00320 _TileXRef[index]._XRefTileNumber=t; 00321 _TileXRef[index]._XRefTileType=transition; 00322 } 00323 } 00324 } |
|
Definition at line 226 of file tile_bank.cpp. References _TileVector, and sint. Referenced by NL3D::CTileSet::addTile128(), NL3D::CTileSet::addTile256(), and addTileSet().
00227 { 00228 // Look for a free tile 00229 for (int i=0; i<(sint)_TileVector.size(); i++) 00230 { 00231 if (_TileVector[i].isFree()) 00232 { 00233 _TileVector[i].setFileName (CTile::diffuse, ""); 00234 _TileVector[i].setFileName (CTile::additive, ""); 00235 _TileVector[i].setFileName (CTile::alpha, ""); 00236 return i; 00237 } 00238 } 00239 00240 // Nothing free, add a tile at the end 00241 _TileVector.push_back (CTile()); 00242 _TileVector[_TileVector.size()-1].setFileName (CTile::diffuse, ""); 00243 _TileVector[_TileVector.size()-1].setFileName (CTile::additive, ""); 00244 _TileVector[_TileVector.size()-1].setFileName (CTile::alpha, ""); 00245 return _TileVector.size()-1; 00246 } |
|
Definition at line 248 of file tile_bank.cpp. References _TileVector, nlassert, and sint. Referenced by NL3D::CTileSet::removeTile128(), NL3D::CTileSet::removeTile256(), and removeTileSet().
00249 { 00250 // Check args 00251 nlassert (tileIndex>=0); 00252 nlassert (tileIndex<(sint)_TileVector.size()); 00253 00254 // Free 00255 _TileVector[tileIndex].free(); 00256 00257 // Resize tile table 00258 int i; 00259 for (i=(sint)_TileVector.size()-1; i>=0; i--) 00260 { 00261 if (!_TileVector[i].isFree ()) 00262 break; 00263 } 00264 if (i<(sint)_TileVector.size()-1) 00265 _TileVector.resize (i+1); 00266 } |
|
Definition at line 619 of file tile_bank.h. References _AbsPath. Referenced by getTileNoiseMap(), and NL3D::CLandscape::loadTile().
00620 { 00621 return _AbsPath; 00622 } |
|
Definition at line 597 of file tile_bank.cpp. References _DisplacementMap, NLMISC::strlwr(), and uint.
00598 { 00599 // Lower string 00600 string lower=fileName; 00601 lower=strlwr (lower); 00602 00603 // Look for this texture filename 00604 uint noiseTile; 00605 for (noiseTile=0; noiseTile<_DisplacementMap.size(); noiseTile++) 00606 { 00607 // Same name ? 00608 if (lower==_DisplacementMap[noiseTile]._FileName) 00609 return noiseTile; 00610 } 00611 00612 // Look for a free space 00613 for (noiseTile=0; noiseTile<_DisplacementMap.size(); noiseTile++) 00614 { 00615 // Same name ? 00616 if (_DisplacementMap[noiseTile]._FileName=="") 00617 break; 00618 } 00619 if (noiseTile==_DisplacementMap.size()) 00620 { 00621 // Add a tile 00622 _DisplacementMap.resize (noiseTile+1); 00623 } 00624 00625 // Set the file name 00626 _DisplacementMap[noiseTile]._FileName=lower; 00627 00628 return noiseTile; 00629 } |
|
Definition at line 631 of file tile_bank.cpp. References _DisplacementMap, and uint. Referenced by NL3D::CTileSet::setDisplacement().
00632 { 00633 return _DisplacementMap[noiseMap]._FileName.c_str(); 00634 } |
|
Definition at line 641 of file tile_bank.cpp. References _DisplacementMap, and uint.
00642 { 00643 return _DisplacementMap.size(); 00644 } |
|
Definition at line 512 of file tile_bank.h. References _LandVector.
00513 { 00514 return &_LandVector[landIndex]; 00515 }; |
|
Definition at line 508 of file tile_bank.h. References _LandVector.
00509 { 00510 return &_LandVector[landIndex]; 00511 }; |
|
Definition at line 504 of file tile_bank.h. References _LandVector, and sint.
00505 { 00506 return _LandVector.size(); 00507 }; |
|
Definition at line 268 of file tile_bank.cpp. References _TileVector, sint, and NLMISC::strlwr().
00269 { 00270 std::set<std::string> setString; 00271 for (int i=0; i<(sint)_TileVector.size(); i++) 00272 { 00273 if (!_TileVector[i].isFree()) 00274 { 00275 const std::string &str=_TileVector[i].getRelativeFileName (bitmap); 00276 if (str!="") 00277 { 00278 std::vector<char> vect (str.length()+1); 00279 memcpy (&*vect.begin(), str.c_str(), str.length()+1); 00280 NLMISC::strlwr (&*vect.begin()); 00281 setString.insert (std::string (&*vect.begin())); 00282 } 00283 } 00284 } 00285 return setString.size(); 00286 } |
|
Definition at line 536 of file tile_bank.h. References _TileVector.
00537 { 00538 return &_TileVector[tileIndex]; 00539 }; |
|
Definition at line 532 of file tile_bank.h. References _TileVector. Referenced by NL3D::CTileSet::clearTile128(), NL3D::CTileSet::clearTile256(), NL3D::CTileSet::clearTransition(), NL3D::CTileSet::deleteBordersIfLast(), NL3D::CLandscape::loadTile(), NL3D::CTileSet::setTile128(), NL3D::CTileSet::setTile256(), NL3D::CTileSet::setTileTransition(), and NL3D::CTileSet::setTileTransitionAlpha().
00533 { 00534 return &_TileVector[tileIndex]; 00535 }; |
|
Definition at line 528 of file tile_bank.h. References _TileVector, and sint. Referenced by NL3D::CPatchInfo::getTileSymmetryRotate(), NL3D::CLandscape::initTileBanks(), NL3D::CLandscape::loadTile(), NL3D::CZoneSymmetrisation::propagateTileState(), and NL3D::CPatchInfo::transformTile().
00529 { 00530 return _TileVector.size(); 00531 }; |
|
Return the tilenoisemap pointer for this tile and subnoise tile Definition at line 442 of file tile_bank.cpp. References _DisplacementMap, NL3D::CTileNoise::_FileName, NL3D::CTileNoise::_TileNoiseMap, _TileSetVector, _TileVector, _TileXRef, NLMISC::CBitmap::convertToType(), NL3D::ITexture::generate(), getAbsPath(), NLMISC::CBitmap::getHeight(), NLMISC::CBitmap::getPixels(), NLMISC::CBitmap::getWidth(), NLMISC::CBitmap::loadGrayscaleAsAlpha(), NL3D_TILE_NOISE_MAP_SIZE, nlassert, nlwarning, NL3D::CTileNoiseMap::Pixels, sint8, uint, and uint8. Referenced by NL3D::CPatch::computeDisplaceRawInteger().
00443 { 00444 if (_DisplacementMap.size() == 0) 00445 { 00446 // it happens when serial a tile bank with version < 4 00447 return NULL; 00448 } 00449 00450 // Check tile number.. 00451 if (tileNumber<_TileVector.size()) 00452 { 00453 // Get tileset number 00454 uint tileSet=_TileXRef[tileNumber]._XRefTileSet; 00455 00456 // Checks 00457 if (tileSet<_TileSetVector.size()) 00458 { 00459 nlassert (tileSubNoise<CTileSet::CountDisplace); 00460 //nlassert (_TileSetVector[tileSet]._DisplacementBitmap[tileSubNoise]<_DisplacementMap.size()); 00461 00462 if (_TileSetVector[tileSet]._DisplacementBitmap[tileSubNoise]>=_DisplacementMap.size()) 00463 return NULL; 00464 00465 // Return the tile noise map 00466 CTileNoise &tileNoise=_DisplacementMap[_TileSetVector[tileSet]._DisplacementBitmap[tileSubNoise]]; 00467 00468 // Not loaded ? 00469 if (tileNoise._TileNoiseMap==NULL) 00470 { 00471 // Load a bitmap 00472 CTextureFile texture (getAbsPath()+tileNoise._FileName); 00473 texture.loadGrayscaleAsAlpha (false); 00474 texture.generate (); 00475 texture.convertToType (CBitmap::Luminance); 00476 00477 // Alloc 00478 tileNoise._TileNoiseMap=new CTileNoiseMap; 00479 00480 // Good size ? 00481 if ((texture.getWidth ()==NL3D_TILE_NOISE_MAP_SIZE)&&(texture.getHeight()==NL3D_TILE_NOISE_MAP_SIZE)) 00482 { 00483 // Copy 00484 memcpy (tileNoise._TileNoiseMap->Pixels, &texture.getPixels()[0], NL3D_TILE_NOISE_MAP_SIZE*NL3D_TILE_NOISE_MAP_SIZE); 00485 00486 // Remap lumels 00487 for (uint i=0; i<NL3D_TILE_NOISE_MAP_SIZE*NL3D_TILE_NOISE_MAP_SIZE; i++) 00488 { 00489 tileNoise._TileNoiseMap->Pixels[i]=(sint8)((uint8)tileNoise._TileNoiseMap->Pixels[i]-128); 00490 if (tileNoise._TileNoiseMap->Pixels[i]==-128) 00491 tileNoise._TileNoiseMap->Pixels[i]=-127; 00492 } 00493 } 00494 else 00495 { 00496 // This is not a normal behaviour. 00497 string pathname= getAbsPath()+tileNoise._FileName; 00498 if( texture.getWidth ()==0 || texture.getHeight ()==0 ) 00499 nlwarning("TileNoiseMap not found: %s.", pathname.c_str()); 00500 else 00501 nlwarning("Bad TileNoiseMap size: %s.", pathname.c_str()); 00502 00503 // Not good size, copy a static map 00504 sint8 notGoodSizeForm[NL3D_TILE_NOISE_MAP_SIZE*NL3D_TILE_NOISE_MAP_SIZE]= 00505 { 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, 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, 00508 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, 00509 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, 00510 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, 00511 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, 00512 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, 00513 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, 00514 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, 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, 00, 00, 00, 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, 00, 00, 00, 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, 00, 00, 00, 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, 00, 00, 00, 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, 00, 00, 00, 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, 00, 00, 00, 00, 00, 00, 00, 00, 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, 00, 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, 00, 00, 00, 00, 00, 00, 00, 00, 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 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, 00527 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, 00528 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, 00529 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, 00530 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, 00531 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, 00532 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, 00533 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, 00534 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, 00535 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, 00536 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, 00537 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 00538 }; 00539 00540 // Copy 00541 memcpy (tileNoise._TileNoiseMap->Pixels, notGoodSizeForm, NL3D_TILE_NOISE_MAP_SIZE*NL3D_TILE_NOISE_MAP_SIZE); 00542 } 00543 } 00544 00545 // Return the noise map 00546 return tileNoise._TileNoiseMap; 00547 } 00548 } 00549 00550 if (_DisplacementMap.size()==0 || _DisplacementMap[0]._TileNoiseMap) 00551 return NULL; 00552 00553 // Checks 00554 nlassert (_DisplacementMap[0]._TileNoiseMap); 00555 return _DisplacementMap[0]._TileNoiseMap; 00556 } |
|
Definition at line 524 of file tile_bank.h. References _TileSetVector.
00525 { 00526 return &_TileSetVector[tileIndex]; 00527 }; |
|
Definition at line 520 of file tile_bank.h. References _TileSetVector. Referenced by computeXRef(), NL3D::CLandscapeUser::flushTiles(), NL3D::CVisualCollisionEntity::getSurfaceInfo(), NL3D::CPatchInfo::getTileSymmetryRotate(), NL3D::CLandscape::initTileBanks(), NL3D::CZoneSymmetrisation::propagateTileState(), NL3D::CZoneSymmetrisation::setOrientedTileState(), NL3D::CZoneSymmetrisation::setTileState(), and NL3D::CPatchInfo::transformTile().
00521 { 00522 return &_TileSetVector[tileIndex]; 00523 }; |
|
Definition at line 516 of file tile_bank.h. References _TileSetVector, and sint. Referenced by NL3D::CLandscapeUser::flushTiles(), NL3D::CPatchInfo::getTileSymmetryRotate(), NL3D::CLandscape::initTileBanks(), NL3D::CZoneSymmetrisation::propagateTileState(), NL3D::CZoneSymmetrisation::setOrientedTileState(), and NL3D::CZoneSymmetrisation::setTileState().
00517 { 00518 return _TileSetVector.size(); 00519 }; |
|
return the TileVegetable desc for this tile Definition at line 648 of file tile_bank.cpp. References _TileSetVector, _TileVector, _TileXRef, and uint. Referenced by NL3D::CLandscape::getTileVegetableDesc().
00649 { 00650 // Check tile number.. 00651 if (tileNumber<_TileVector.size()) 00652 { 00653 // Get tileset number 00654 uint tileSet=_TileXRef[tileNumber]._XRefTileSet; 00655 00656 // Checks 00657 if (tileSet<_TileSetVector.size()) 00658 { 00659 return _TileSetVector[tileSet].getTileVegetableDesc(); 00660 } 00661 00662 } 00663 00664 // if fails for any reason, return an empty tileVegetableDesc; 00665 static CTileVegetableDesc emptyTvd; 00666 return emptyTvd; 00667 } |
|
Return the xref for a tile.
Definition at line 560 of file tile_bank.h. References _TileXRef, nlassert, sint, and type. Referenced by NL3D::CVisualCollisionEntity::getSurfaceInfo(), NL3D::CPatchInfo::getTileSymmetryRotate(), NL3D::CZoneSymmetrisation::propagateTileState(), NL3D::CZoneSymmetrisation::setOrientedTileState(), NL3D::CZoneSymmetrisation::setTileState(), and NL3D::CPatchInfo::transformTile().
|
|
register all CVegetable to the Manager. called by CLandscape::initTileBanks() Definition at line 685 of file tile_bank.cpp. References _TileSetVector, NL3D::CTileVegetableDesc::registerToManager(), and uint. Referenced by NL3D::CLandscape::enableVegetable(), and NL3D::CLandscape::initTileBanks().
00686 { 00687 // For all tileSets. 00688 uint tileSet; 00689 00690 for(tileSet=0; tileSet<_TileSetVector.size(); tileSet++) 00691 { 00692 CTileVegetableDesc &tvd= _TileSetVector[tileSet].getTileVegetableDesc(); 00693 tvd.registerToManager(vegetableManager); 00694 } 00695 } |
|
you should call this method, after serialising the TileBank, and before CLandscape::initTileBanks() You must call CLandscape::initTileBanks() after calling this method for each tileSet call CTileSet::loadTileVegetableDesc() Definition at line 671 of file tile_bank.cpp. References _TileSetVector, and uint. Referenced by NL3D::CLandscapeUser::flushTiles().
00672 { 00673 // For all tileSets. 00674 uint tileSet; 00675 00676 for(tileSet=0; tileSet<_TileSetVector.size(); tileSet++) 00677 { 00678 // load their fileName 00679 _TileSetVector[tileSet].loadTileVegetableDesc(); 00680 } 00681 } |
|
This method change ".tga" of texture filename, to ".dds". Do this only for Additive and Diffuse part (not alpha).
Definition at line 390 of file tile_bank.cpp. References _TileVector, sint, and uint32. Referenced by NL3D::CLandscapeUser::loadBankFiles().
00391 { 00392 // For all tiles 00393 for (sint nTile=0; nTile<(sint)_TileVector.size(); nTile++) 00394 { 00395 string tmp; 00396 uint32 pos; 00397 00398 // Diffuse 00399 tmp= _TileVector[nTile].getRelativeFileName (CTile::diffuse); 00400 pos= tmp.rfind(".tga"); 00401 if(pos!= string::npos) 00402 { 00403 tmp.replace(pos, 4, ".dds"); 00404 _TileVector[nTile].setFileName (CTile::diffuse, tmp); 00405 } 00406 00407 // Additive. 00408 tmp= _TileVector[nTile].getRelativeFileName (CTile::additive); 00409 pos= tmp.rfind(".tga"); 00410 if(pos!= string::npos) 00411 { 00412 tmp.replace(pos, 4, ".dds"); 00413 _TileVector[nTile].setFileName (CTile::additive, tmp); 00414 } 00415 00416 // Alpha. 00417 tmp= _TileVector[nTile].getRelativeFileName (CTile::alpha); 00418 pos= tmp.rfind(".tga"); 00419 if(pos!= string::npos) 00420 { 00421 tmp.replace(pos, 4, ".dds"); 00422 _TileVector[nTile].setFileName (CTile::alpha, tmp); 00423 } 00424 00425 } 00426 00427 } |
|
Definition at line 355 of file tile_bank.cpp. References _DisplacementMap, _TileVector, sint, NL3D::TroncFileName(), and uint. Referenced by NL3D::CLandscapeUser::loadBankFiles().
00356 { 00357 // For all tiles 00358 for (sint nTile=0; nTile<(sint)_TileVector.size(); nTile++) 00359 { 00360 // Tronc filename 00361 char sTmpFileName[512]; 00362 00363 // Diffuse 00364 TroncFileName (sTmpFileName, _TileVector[nTile].getRelativeFileName (CTile::diffuse).c_str()); 00365 _TileVector[nTile].setFileName (CTile::diffuse, sTmpFileName); 00366 00367 // Additive 00368 TroncFileName (sTmpFileName, _TileVector[nTile].getRelativeFileName (CTile::additive).c_str()); 00369 _TileVector[nTile].setFileName (CTile::additive, sTmpFileName); 00370 00371 // Alpha 00372 TroncFileName (sTmpFileName, _TileVector[nTile].getRelativeFileName (CTile::alpha).c_str()); 00373 _TileVector[nTile].setFileName (CTile::alpha, sTmpFileName); 00374 } 00375 00376 // For all displaces 00377 for (uint i=0; i<_DisplacementMap.size(); i++) 00378 { 00379 // Tronc filename 00380 char sTmpFileName[512]; 00381 00382 TroncFileName (sTmpFileName, _DisplacementMap[i]._FileName.c_str()); 00383 _DisplacementMap[i]._FileName = sTmpFileName; 00384 } 00385 } |
|
Postfix tile filename.
Definition at line 699 of file tile_bank.cpp. References _TileVector, and uint. Referenced by NL3D::CLandscapeUser::postfixTileFilename().
00700 { 00701 // For each tiles 00702 uint tile; 00703 for (tile=0; tile<_TileVector.size (); tile++) 00704 { 00705 // For each bitmap 00706 uint bitmap; 00707 for (bitmap=0; bitmap<CTile::bitmapCount; bitmap++) 00708 { 00709 string &filename = _TileVector[tile]._BitmapName[bitmap]; 00710 if (!filename.empty()) 00711 { 00712 string ext = CFile::getExtension(filename); 00713 string name = CFile::getFilenameWithoutExtension(filename); 00714 filename = CFile::getPath (filename); 00715 filename += name; 00716 filename += postfix; 00717 filename += "."; 00718 filename += ext; 00719 } 00720 } 00721 } 00722 } |
|
Postfix tile vegetable desc.
Definition at line 726 of file tile_bank.cpp. References _TileSetVector, and uint. Referenced by NL3D::CLandscapeUser::postfixTileVegetableDesc().
00727 { 00728 // For each tiles 00729 uint tileSet; 00730 for (tileSet=0; tileSet<_TileSetVector.size (); tileSet++) 00731 { 00732 string &filename = _TileSetVector[tileSet]._TileVegetableDescFileName; 00733 if (!filename.empty()) 00734 { 00735 string ext = CFile::getExtension(filename); 00736 string name = CFile::getFilenameWithoutExtension(filename); 00737 filename = CFile::getPath (filename); 00738 filename += name; 00739 filename += postfix; 00740 filename += "."; 00741 filename += ext; 00742 } 00743 } 00744 } |
|
Definition at line 558 of file tile_bank.cpp. References _DisplacementMap, _TileSetVector, nlassert, and uint. Referenced by NL3D::CTileSet::clearDisplacement(), and NL3D::CTileSet::setDisplacement().
00559 { 00560 // Checks 00561 nlassert (mapId<_DisplacementMap.size()); 00562 00563 if (mapId!=0) 00564 { 00565 // Check if another tileSet uses it 00566 uint tileSet; 00567 for (tileSet=0; tileSet<_TileSetVector.size(); tileSet++) 00568 { 00569 // It uses it ? 00570 uint tile; 00571 for (tile=0; tile<CTileSet::CountDisplace; tile++) 00572 { 00573 // The same ? 00574 if (_TileSetVector[tileSet]._DisplacementBitmap[tile]==mapId) 00575 // Stop 00576 break; 00577 } 00578 if (tile!=CTileSet::CountDisplace) 00579 break; 00580 } 00581 if (tileSet==_TileSetVector.size()) 00582 { 00583 // Remove it 00584 _DisplacementMap[mapId].reset(); 00585 00586 // Last element ? 00587 if (mapId==_DisplacementMap.size()-1) 00588 { 00589 // Resize the array ? 00590 while ((mapId>0)&&(_DisplacementMap[mapId]._FileName=="")) 00591 _DisplacementMap.resize (mapId--); 00592 } 00593 } 00594 } 00595 } |
|
Definition at line 180 of file tile_bank.cpp. References _LandVector, nlassert, and sint.
00181 { 00182 // Check args 00183 nlassert (landIndex>=0); 00184 nlassert (landIndex<(sint)_LandVector.size()); 00185 00186 _LandVector.erase (_LandVector.begin ()+landIndex); 00187 } |
|
Definition at line 201 of file tile_bank.cpp. References _TileSetVector, freeTile(), index, nlassert, and sint.
00202 { 00203 // Check args 00204 nlassert (setIndex>=0); 00205 nlassert (setIndex<(sint)_TileSetVector.size()); 00206 00207 for (int i=0; i<CTileSet::count; i++) 00208 { 00209 int index=_TileSetVector[setIndex]._TileTransition[i]._Tile; 00210 if (index!=-1) 00211 freeTile (index); 00212 } 00213 _TileSetVector.erase (_TileSetVector.begin ()+setIndex); 00214 } |
|
Definition at line 99 of file tile_bank.cpp. References nlassert, sint, type, and uint. Referenced by NL3D::CLandscapeUser::loadBankFiles().
00100 { 00101 f.serialCheck (std::string ("BANK")); 00102 00103 sint streamver = f.serialVersion(_Version); 00104 00105 // Version 1 not compatible 00106 if (f.isReading()) 00107 { 00108 if (streamver<2) 00109 throw EOlderStream(f); 00110 } 00111 00112 switch (streamver) 00113 { 00114 case 4: 00115 // Displacement map array 00116 f.serialCont (_DisplacementMap); 00117 if (f.isReading()) 00118 { 00119 // Checks 00120 nlassert (_DisplacementMap.size()>0); 00121 00122 // Set first empty 00123 _DisplacementMap[0].setEmpty (); 00124 } 00125 case 3: 00126 // Absolute path 00127 f.serial (_AbsPath); 00128 case 2: 00129 // Serial all containers 00130 f.serialCont (_LandVector); 00131 f.serialCont (_TileSetVector); 00132 f.serialCont (_TileVector); 00133 } 00134 00135 // Compute XRef in read mode 00136 if (f.isReading()) 00137 computeXRef (); 00138 00139 // If Version<=2, remove diffuse and alpha tiles in transitions 00140 if (streamver<=2) 00141 { 00142 // Must be reading 00143 nlassert (f.isReading()); 00144 00145 // Reset _AbsPath 00146 _AbsPath=""; 00147 00148 // Remove diffuse and additive in transition 00149 uint tileCount=(uint)getTileCount (); 00150 for (uint i=0; i<tileCount; i++) 00151 { 00152 int tileSet; 00153 int number; 00154 TTileType type; 00155 00156 // Get xref 00157 getTileXRef (i, tileSet, number, type); 00158 00159 // Transition ? 00160 if (type==transition) 00161 { 00162 // Remove diffuse bitmap 00163 getTileSet(tileSet)->clearTransition ((CTileSet::TTransition)number, CTile::diffuse, *this); 00164 00165 // Remove alpha bitmap 00166 getTileSet(tileSet)->clearTransition ((CTileSet::TTransition)number, CTile::alpha, *this); 00167 } 00168 } 00169 } 00170 } |
|
Definition at line 615 of file tile_bank.h. References _AbsPath. Referenced by NL3D::CLandscapeUser::loadBankFiles().
00616 { 00617 _AbsPath=newPath; 00618 } |
|
Definition at line 636 of file tile_bank.cpp. References _DisplacementMap, and uint.
00637 { 00638 _DisplacementMap[noiseMap]._FileName=newName; 00639 } |
|
Definition at line 326 of file tile_bank.cpp. References _TileSetVector, nlassert, and sint.
00327 { 00328 // Some check 00329 nlassert ((firstTileSet>=0)&&(firstTileSet<(sint)_TileSetVector.size())); 00330 nlassert ((secondTileSet>=0)&&(secondTileSet<(sint)_TileSetVector.size())); 00331 00332 // Xchange the sets 00333 CTileSet tmp=_TileSetVector[firstTileSet]; 00334 _TileSetVector[firstTileSet]=_TileSetVector[secondTileSet]; 00335 _TileSetVector[secondTileSet]=tmp; 00336 } |
|
Definition at line 496 of file tile_bank.h. Referenced by addTileSet(). |
|
Definition at line 656 of file tile_bank.h. Referenced by clear(), getAbsPath(), and setAbsPath(). |
|
Definition at line 655 of file tile_bank.h. Referenced by clear(), CTileBank(), getDisplacementMap(), getDisplacementMapCount(), getTileNoiseMap(), makeAllPathRelative(), removeDisplacementMap(), and setDisplacementMap(). |
|
Definition at line 651 of file tile_bank.h. Referenced by addLand(), cleanUnusedData(), clear(), getLand(), getLandCount(), and removeLand(). |
|
Definition at line 652 of file tile_bank.h. Referenced by addTileSet(), cleanUnusedData(), clear(), computeXRef(), getTileNoiseMap(), getTileSet(), getTileSetCount(), getTileVegetableDesc(), initTileVegetableDescs(), loadTileVegetableDescs(), postfixTileVegetableDesc(), removeDisplacementMap(), removeTileSet(), and xchgTileset(). |
|
Definition at line 653 of file tile_bank.h. Referenced by clear(), computeXRef(), createTile(), freeTile(), getNumBitmap(), getTile(), getTileCount(), getTileNoiseMap(), getTileVegetableDesc(), makeAllExtensionDDS(), makeAllPathRelative(), and postfixTileFilename(). |
|
Definition at line 654 of file tile_bank.h. Referenced by clear(), computeXRef(), getTileNoiseMap(), getTileVegetableDesc(), and getTileXRef(). |
|
Definition at line 88 of file tile_bank.cpp. |