Changed: #825 Remove all warning when compiling Ryzom

This commit is contained in:
kervala 2010-10-16 18:58:53 +02:00
parent cd0670404a
commit 30ad426e03
3 changed files with 208 additions and 209 deletions

View file

@ -154,7 +154,7 @@ void CExport::delAllIGZoneUnderPath (float fCellSize, CPrimPath *pPath, const st
vSquare[3].x = x * fCellSize; vSquare[3].x = x * fCellSize;
vSquare[3].y = (y+1) * fCellSize; vSquare[3].y = (y+1) * fCellSize;
vSquare[3].z = 0.0f; vSquare[3].z = 0.0f;
// Is a vertex of the path inside the zone ? // Is a vertex of the path inside the zone ?
for (i = 0; i < pPath->VPoints.size(); ++i) for (i = 0; i < pPath->VPoints.size(); ++i)
{ {
@ -167,7 +167,7 @@ void CExport::delAllIGZoneUnderPath (float fCellSize, CPrimPath *pPath, const st
CTools::chdir (sIGOutputDir); CTools::chdir (sIGOutputDir);
} }
} }
// Is an segment of the path cut an edge of the patat ? // Is an segment of the path cut an edge of the patat ?
for (i = 0; i < pPath->VPoints.size()-1; ++i) for (i = 0; i < pPath->VPoints.size()-1; ++i)
for (j = 0; j < 4; ++j) for (j = 0; j < 4; ++j)
@ -249,7 +249,7 @@ void CExport::delAllIGZoneUnderPatat (float fCellSize, CPrimZone *pPatat, const
CTools::chdir (sIGOutputDir); CTools::chdir (sIGOutputDir);
} }
} }
// Is a vertex of the patat inside the zone ? // Is a vertex of the patat inside the zone ?
for (i = 0; i < pPatat->VPoints.size(); ++i) for (i = 0; i < pPatat->VPoints.size(); ++i)
{ {
@ -262,7 +262,7 @@ void CExport::delAllIGZoneUnderPatat (float fCellSize, CPrimZone *pPatat, const
CTools::chdir (sIGOutputDir); CTools::chdir (sIGOutputDir);
} }
} }
// Is an edge of the zone cut an edge of the patat ? // Is an edge of the zone cut an edge of the patat ?
for (i = 0; i < pPatat->VPoints.size(); ++i) for (i = 0; i < pPatat->VPoints.size(); ++i)
for (j = 0; j < 4; ++j) for (j = 0; j < 4; ++j)
@ -342,11 +342,11 @@ bool CExport::isPatatNeedUpdate (float fCellSize, CPrimZone *pPatat, const strin
if (pPatat->contains(vSquare[i])) if (pPatat->contains(vSquare[i]))
{ {
string sTmp = CExport::getZoneNameFromXY(x,y) + ".ig"; string sTmp = CExport::getZoneNameFromXY(x,y) + ".ig";
if (!CTools::fileExist(sTmp)) // If the file does not exist if (!CTools::fileExist(sTmp)) // If the file does not exist
return true; // need update return true; // need update
} }
} }
// Is a vertex of the patat inside the zone ? // Is a vertex of the patat inside the zone ?
for (i = 0; i < pPatat->VPoints.size(); ++i) for (i = 0; i < pPatat->VPoints.size(); ++i)
{ {
@ -356,11 +356,11 @@ bool CExport::isPatatNeedUpdate (float fCellSize, CPrimZone *pPatat, const strin
(pPatat->VPoints[i].y <= ((y+1)*fCellSize))) (pPatat->VPoints[i].y <= ((y+1)*fCellSize)))
{ {
string sTmp = CExport::getZoneNameFromXY(x,y) + ".ig"; string sTmp = CExport::getZoneNameFromXY(x,y) + ".ig";
if (!CTools::fileExist(sTmp)) // If the file does not exist if (!CTools::fileExist(sTmp)) // If the file does not exist
return true; // need update return true; // need update
} }
} }
// Is an edge of the zone cut an edge of the patat ? // Is an edge of the zone cut an edge of the patat ?
for (i = 0; i < pPatat->VPoints.size(); ++i) for (i = 0; i < pPatat->VPoints.size(); ++i)
for (j = 0; j < 4; ++j) for (j = 0; j < 4; ++j)
@ -378,7 +378,7 @@ bool CExport::isPatatNeedUpdate (float fCellSize, CPrimZone *pPatat, const strin
if (segmentIntersection(x1, y1, x2, y2, x3, y3, x4, y4)) if (segmentIntersection(x1, y1, x2, y2, x3, y3, x4, y4))
{ {
string sTmp = CExport::getZoneNameFromXY (x, y) + ".ig"; string sTmp = CExport::getZoneNameFromXY (x, y) + ".ig";
if (!CTools::fileExist(sTmp)) // If the file does not exist if (!CTools::fileExist(sTmp)) // If the file does not exist
return true; // need update return true; // need update
} }
} }
@ -446,11 +446,11 @@ bool CExport::isPathNeedUpdate (float fCellSize, CPrimPath *pPath, const string
(pPath->VPoints[i].y <= ((y+1)*fCellSize))) (pPath->VPoints[i].y <= ((y+1)*fCellSize)))
{ {
string sTmp = CExport::getZoneNameFromXY(x,y) + ".ig"; string sTmp = CExport::getZoneNameFromXY(x,y) + ".ig";
if (!CTools::fileExist(sTmp)) // If the file does not exist if (!CTools::fileExist(sTmp)) // If the file does not exist
return true; // need update return true; // need update
} }
} }
// Is an edge of the zone cut an edge of the patat ? // Is an edge of the zone cut an edge of the patat ?
for (i = 0; i < (pPath->VPoints.size()-1); ++i) for (i = 0; i < (pPath->VPoints.size()-1); ++i)
for (j = 0; j < 4; ++j) for (j = 0; j < 4; ++j)
@ -468,7 +468,7 @@ bool CExport::isPathNeedUpdate (float fCellSize, CPrimPath *pPath, const string
if (segmentIntersection(x1, y1, x2, y2, x3, y3, x4, y4)) if (segmentIntersection(x1, y1, x2, y2, x3, y3, x4, y4))
{ {
string sTmp = CExport::getZoneNameFromXY (x, y) + ".ig"; string sTmp = CExport::getZoneNameFromXY (x, y) + ".ig";
if (!CTools::fileExist(sTmp)) // If the file does not exist if (!CTools::fileExist(sTmp)) // If the file does not exist
return true; // need update return true; // need update
} }
} }
@ -481,7 +481,7 @@ bool CExport::isPathNeedUpdate (float fCellSize, CPrimPath *pPath, const string
bool CExport::isPointNeedUpdate (float fCellSize, CPrimPoint *pPoint, const string &sIGOutputDir) bool CExport::isPointNeedUpdate (float fCellSize, CPrimPoint *pPoint, const string &sIGOutputDir)
{ {
CTools::chdir (sIGOutputDir); CTools::chdir (sIGOutputDir);
sint32 x, y; sint32 x, y;
x = (sint32) floor (pPoint->Point.x / fCellSize); x = (sint32) floor (pPoint->Point.x / fCellSize);
y = (sint32) floor (pPoint->Point.y / fCellSize); y = (sint32) floor (pPoint->Point.y / fCellSize);
@ -513,7 +513,7 @@ bool CExport::isPointNeedUpdate (float fCellSize, CPrimPoint *pPoint, const stri
(pPoint->Point.y <= ((y+1)*fCellSize))) (pPoint->Point.y <= ((y+1)*fCellSize)))
{ {
string sTmp = CExport::getZoneNameFromXY(x,y) + ".ig"; string sTmp = CExport::getZoneNameFromXY(x,y) + ".ig";
if (!CTools::fileExist(sTmp)) // If the file does not exist if (!CTools::fileExist(sTmp)) // If the file does not exist
return true; // need update return true; // need update
} }
@ -608,7 +608,7 @@ CExport::~CExport()
_VCM->deleteEntity (_VCE); _VCM->deleteEntity (_VCE);
delete _VCM; delete _VCM;
} }
} }
@ -702,7 +702,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
HANDLE hFind; HANDLE hFind;
CTools::chdir (sContinentDir); CTools::chdir (sContinentDir);
hFind = FindFirstFile ("*.*", &findData); hFind = FindFirstFile ("*.*", &findData);
while (hFind != INVALID_HANDLE_VALUE) while (hFind != INVALID_HANDLE_VALUE)
{ {
if (GetFileAttributes(findData.cFileName)&FILE_ATTRIBUTE_DIRECTORY) if (GetFileAttributes(findData.cFileName)&FILE_ATTRIBUTE_DIRECTORY)
@ -725,7 +725,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
} }
FindClose (hFind); FindClose (hFind);
// Process all regions // Process all regions
uint32 nRegion; uint32 nRegion;
for (nRegion = 0; nRegion < vRegions.size(); ++nRegion) for (nRegion = 0; nRegion < vRegions.size(); ++nRegion)
@ -828,7 +828,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
{ {
// Get all patats referenced by the flora and suppress zones under // Get all patats referenced by the flora and suppress zones under
// Load the .flora file // Load the .flora file
SFormFlora FormFlora; SFormFlora FormFlora;
{ {
// Get a loader // Get a loader
@ -860,7 +860,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
} }
// Delete zones under the old prims referenced by the old zone // Delete zones under the old prims referenced by the old zone
for (i = 0; i < FormFlora.IncludePatats.size(); ++i) for (i = 0; i < FormFlora.IncludePatats.size(); ++i)
{ {
// Get the patat // Get the patat
@ -1020,13 +1020,13 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
// Interpretation of structure for update // Interpretation of structure for update
for (i = 0; i < vPrimToUpdate.size(); ++i) for (i = 0; i < vPrimToUpdate.size(); ++i)
{ {
// Load all the .flora file // Load all the .flora file
vector<SFormFlora> vFormFloras; vector<SFormFlora> vFormFloras;
for (j = 0; j < vPrimToUpdate[i].FloraFile.size(); ++j) for (j = 0; j < vPrimToUpdate[i].FloraFile.size(); ++j)
{ {
// Create the loader // Create the loader
UFormLoader *loader = UFormLoader::createLoader (); UFormLoader *loader = UFormLoader::createLoader ();
// Load the form // Load the form
CSmartPtr<UForm> form = loader->loadForm (vPrimToUpdate[i].FloraFile[j].c_str ()); CSmartPtr<UForm> form = loader->loadForm (vPrimToUpdate[i].FloraFile[j].c_str ());
if (form) if (form)
@ -1051,7 +1051,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
} }
// Delete zones under the prims that has been referenced by a flora // Delete zones under the prims that has been referenced by a flora
for (j = 0; j < PrimRegion.VZones.size(); ++j) for (j = 0; j < PrimRegion.VZones.size(); ++j)
{ {
// Get the patat // Get the patat
@ -1098,7 +1098,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
} }
// End of process all regions // End of process all regions
// Check all patat to export (a patat that has no zone under itself (deleted or not present)) // Check all patat to export (a patat that has no zone under itself (deleted or not present))
vector<SExportPrimitive> vExportPrimitives; vector<SExportPrimitive> vExportPrimitives;
vector<string> vAllPrimFiles; // All prim files of a continent vector<string> vAllPrimFiles; // All prim files of a continent
@ -1115,7 +1115,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
CIXml input; CIXml input;
input.init (fileIn); input.init (fileIn);
PrimRegion.serial (input); PrimRegion.serial (input);
} }
for (j = 0; j < PrimRegion.VZones.size(); ++j) for (j = 0; j < PrimRegion.VZones.size(); ++j)
{ {
@ -1160,7 +1160,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
_Options->PrimFloraDir = sContinentDir; _Options->PrimFloraDir = sContinentDir;
sTmp = "Exporting"; sTmp = "Exporting";
if (_ExportCB != NULL) _ExportCB->dispInfo (sTmp); if (_ExportCB != NULL) _ExportCB->dispInfo (sTmp);
export (*_Options, _ExportCB, &vExportPrimitives); doExport (*_Options, _ExportCB, &vExportPrimitives);
// Copy new files for incremental purpose // Copy new files for incremental purpose
CTools::chdir (_ExeDir); CTools::chdir (_ExeDir);
@ -1193,7 +1193,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// If the new file do not exists anymore but the old file exists -> delete old file // If the new file do not exists anymore but the old file exists -> delete old file
CTools::chdir (_OutIGDir); CTools::chdir (_OutIGDir);
CTools::dir (vRegions[nRegion] + "-*.prim", vFiles, false); CTools::dir (vRegions[nRegion] + "-*.prim", vFiles, false);
for (i = 0; i < vFiles.size(); ++i) for (i = 0; i < vFiles.size(); ++i)
@ -1212,7 +1212,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
} }
} }
// If the new file do not exists anymore but the old file exists -> delete old file // If the new file do not exists anymore but the old file exists -> delete old file
CTools::dir (vRegions[nRegion] + "-*.flora", vFiles, false); CTools::dir (vRegions[nRegion] + "-*.flora", vFiles, false);
for (i = 0; i < vFiles.size(); ++i) for (i = 0; i < vFiles.size(); ++i)
{ {
@ -1230,13 +1230,13 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
} }
} }
} }
CTools::chdir (_ExeDir); CTools::chdir (_ExeDir);
return true; return true;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
bool CExport::export (SExportOptions &opt, IExportCB *expCB, vector<SExportPrimitive> *selection) bool CExport::doExport (SExportOptions &opt, IExportCB *expCB, vector<SExportPrimitive> *selection)
{ {
char sTmp[MAX_PATH]; char sTmp[MAX_PATH];
GetCurrentDirectory (MAX_PATH, sTmp); GetCurrentDirectory (MAX_PATH, sTmp);
@ -1251,7 +1251,7 @@ bool CExport::export (SExportOptions &opt, IExportCB *expCB, vector<SExportPrimi
_ExportCB->dispInfo ("Nothing to export"); _ExportCB->dispInfo ("Nothing to export");
return true; return true;
} }
// If we want to generate flora then we have to load the landscape // If we want to generate flora then we have to load the landscape
uint32 i; uint32 i;
@ -1265,7 +1265,7 @@ bool CExport::export (SExportOptions &opt, IExportCB *expCB, vector<SExportPrimi
_VCE = _VCM->createEntity (); _VCE = _VCM->createEntity ();
_VCM->setLandscape (_Landscape); _VCM->setLandscape (_Landscape);
_VCE->setSnapToRenderedTesselation (false); _VCE->setSnapToRenderedTesselation (false);
try try
{ {
CIFile bankFile (_LandBankFile); CIFile bankFile (_LandBankFile);
_Landscape->TileBank.serial (bankFile); _Landscape->TileBank.serial (bankFile);
@ -1313,7 +1313,7 @@ void CExport::getAllFiles (const string &ext, vector<string> &files)
GetCurrentDirectory (MAX_PATH, sCurDir); GetCurrentDirectory (MAX_PATH, sCurDir);
WIN32_FIND_DATA findData; WIN32_FIND_DATA findData;
HANDLE hFind = FindFirstFile ("*.*", &findData); HANDLE hFind = FindFirstFile ("*.*", &findData);
while (hFind != INVALID_HANDLE_VALUE) while (hFind != INVALID_HANDLE_VALUE)
{ {
if (!((strcmp (findData.cFileName, ".") == 0) || (strcmp (findData.cFileName, "..") == 0))) if (!((strcmp (findData.cFileName, ".") == 0) || (strcmp (findData.cFileName, "..") == 0)))
@ -1355,7 +1355,7 @@ bool CExport::searchFile (const std::string &plantName, std::string &dir)
GetCurrentDirectory (MAX_PATH, sCurDir); GetCurrentDirectory (MAX_PATH, sCurDir);
WIN32_FIND_DATA findData; WIN32_FIND_DATA findData;
HANDLE hFind = FindFirstFile ("*.*", &findData); HANDLE hFind = FindFirstFile ("*.*", &findData);
while (hFind != INVALID_HANDLE_VALUE) while (hFind != INVALID_HANDLE_VALUE)
{ {
string filename = findData.cFileName; string filename = findData.cFileName;
@ -1412,7 +1412,7 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector<SExpo
SetCurrentDirectory (sCurDir); SetCurrentDirectory (sCurDir);
for (i = 0; i < allPrimFiles.size(); ++i) for (i = 0; i < allPrimFiles.size(); ++i)
{ {
try try
{ {
CPrimRegion tmpPrimRegion; CPrimRegion tmpPrimRegion;
CIFile fileIn; CIFile fileIn;
@ -1441,7 +1441,7 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector<SExpo
// CPath::addSearchPath (_Options->DfnDir, true, true); // CPath::addSearchPath (_Options->DfnDir, true, true);
// CPath::addSearchPath (_Options->GameElemDir, true, true); // CPath::addSearchPath (_Options->GameElemDir, true, true);
// CPath::addSearchPath (_Options->LandTileNoiseDir, true, true); // CPath::addSearchPath (_Options->LandTileNoiseDir, true, true);
// Load the form // Load the form
CSmartPtr<UForm> form = loader->loadForm (SrcFile.c_str ()); CSmartPtr<UForm> form = loader->loadForm (SrcFile.c_str ());
if (form == NULL) if (form == NULL)
@ -1454,7 +1454,7 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector<SExpo
// Read .Flora // Read .Flora
formFlora.build (form->getRootNode ()); formFlora.build (form->getRootNode ());
// Load the .plant associated // Load the .plant associated
for (i = 0; i < formFlora.PlantInstances.size(); ++i) for (i = 0; i < formFlora.PlantInstances.size(); ++i)
{ {
const string &plantName = formFlora.PlantInstances[i].Name; const string &plantName = formFlora.PlantInstances[i].Name;
@ -1464,7 +1464,7 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector<SExpo
char sCurDir[MAX_PATH]; char sCurDir[MAX_PATH];
GetCurrentDirectory (MAX_PATH, sCurDir); GetCurrentDirectory (MAX_PATH, sCurDir);
try try
{ {
SetCurrentDirectory (_GameElemDir.c_str()); SetCurrentDirectory (_GameElemDir.c_str());
@ -1473,7 +1473,7 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector<SExpo
if (searchFile (plantName, dir)) if (searchFile (plantName, dir))
{ {
string tmpName = dir + string("\\") + plantName; string tmpName = dir + string("\\") + plantName;
CSmartPtr<UForm> form2 = loader->loadForm (tmpName.c_str()); CSmartPtr<UForm> form2 = loader->loadForm (tmpName.c_str());
if (form2) if (form2)
{ {
@ -1631,21 +1631,21 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector<SExpo
{ {
if (selection == NULL) if (selection == NULL)
if (_ExportCB) if (_ExportCB)
_ExportCB->dispWarning ("Cannot find " + formFlora.IncludePatats[i]); _ExportCB->dispWarning ("Cannot find " + formFlora.IncludePatats[i]);
continue; continue;
} }
if ((pPatat != NULL) && (pPatat->VPoints.size() <= 2)) if ((pPatat != NULL) && (pPatat->VPoints.size() <= 2))
{ {
if (_ExportCB) if (_ExportCB)
_ExportCB->dispWarning ("Patat " + pPatat->getName() + " has less than 3 points"); _ExportCB->dispWarning ("Patat " + pPatat->getName() + " has less than 3 points");
continue; continue;
} }
if ((pPath != NULL) && (pPath->VPoints.size() <= 1)) if ((pPath != NULL) && (pPath->VPoints.size() <= 1))
{ {
if (_ExportCB) if (_ExportCB)
_ExportCB->dispWarning ("Path " + pPath->getName() + " has less than 2 points"); _ExportCB->dispWarning ("Path " + pPath->getName() + " has less than 2 points");
continue; continue;
} }
@ -1733,7 +1733,7 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector<SExpo
vi.Scale = scaleTmp; vi.Scale = scaleTmp;
vi.Radius = rFormPlant.BoundingRadius * vi.Scale; vi.Radius = rFormPlant.BoundingRadius * vi.Scale;
vi.Rot = (float)Pi * frand (1.0); vi.Rot = (float)Pi * frand (1.0);
if (formFlora.PutOnWater) if (formFlora.PutOnWater)
{ {
if (pos.z < formFlora.WaterHeight) if (pos.z < formFlora.WaterHeight)
@ -1761,7 +1761,7 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector<SExpo
total += formFlora.PlantInstances[j].Density; total += formFlora.PlantInstances[j].Density;
if (posf < total) break; if (posf < total) break;
} }
if (j == formFlora.PlantInstances.size()) if (j == formFlora.PlantInstances.size())
j = formFlora.PlantInstances.size()-1; j = formFlora.PlantInstances.size()-1;
SPlantInstance &rPlant = formFlora.PlantInstances[j]; SPlantInstance &rPlant = formFlora.PlantInstances[j];
@ -1793,7 +1793,7 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector<SExpo
vi.Pos = pos; vi.Pos = pos;
if (pos.z > -90000.0f) if (pos.z > -90000.0f)
_FloraInsts.push_back (vi); _FloraInsts.push_back (vi);
} // End of Generate for a point } // End of Generate for a point
// Generate for a path // Generate for a path
@ -1891,7 +1891,7 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector<SExpo
vi.Scale = scaleTmp; vi.Scale = scaleTmp;
vi.Radius = rFormPlant.BoundingRadius * vi.Scale; vi.Radius = rFormPlant.BoundingRadius * vi.Scale;
vi.Rot = (float)Pi * frand (1.0); vi.Rot = (float)Pi * frand (1.0);
if (formFlora.PutOnWater) if (formFlora.PutOnWater)
{ {
if (pos.z < formFlora.WaterHeight) if (pos.z < formFlora.WaterHeight)
@ -2015,7 +2015,7 @@ void CExport::writeFloraIG (const string &LandFile, bool bTestForWriting)
// Take all Flora instances in the zone (i,j) // Take all Flora instances in the zone (i,j)
for (k = 0; k < (sint32)_FloraInsts.size(); ++k) for (k = 0; k < (sint32)_FloraInsts.size(); ++k)
{ {
if (((i*_Options->CellSize) < _FloraInsts[k].Pos.x) && (_FloraInsts[k].Pos.x < ((i+1)*_Options->CellSize)) && if (((i*_Options->CellSize) < _FloraInsts[k].Pos.x) && (_FloraInsts[k].Pos.x < ((i+1)*_Options->CellSize)) &&
((j*_Options->CellSize) < _FloraInsts[k].Pos.y) && (_FloraInsts[k].Pos.y < ((j+1)*_Options->CellSize))) ((j*_Options->CellSize) < _FloraInsts[k].Pos.y) && (_FloraInsts[k].Pos.y < ((j+1)*_Options->CellSize)))
{ {
vegZone.push_back (k); vegZone.push_back (k);
@ -2071,7 +2071,7 @@ void CExport::writeFloraIG (const string &LandFile, bool bTestForWriting)
continue; continue;
} }
try try
{ {
COFile outFile (ZoneName); COFile outFile (ZoneName);
IG.serial (outFile); IG.serial (outFile);
@ -2090,9 +2090,9 @@ void CExport::writeFloraIG (const string &LandFile, bool bTestForWriting)
void CExport::loadLandscape (const string &LandFile) void CExport::loadLandscape (const string &LandFile)
{ {
CZoneRegion zoneRegion; CZoneRegion zoneRegion;
CIFile inFile; CIFile inFile;
try try
{ {
if (inFile.open (LandFile)) if (inFile.open (LandFile))
{ {

View file

@ -66,7 +66,7 @@ struct SExportOptions
std::string GameElemDir; // Directory to get georges file (pipoti.plant) std::string GameElemDir; // Directory to get georges file (pipoti.plant)
// ======================================================================= // =======================================================================
SExportOptions (); SExportOptions ();
bool loadcf (NLMISC::CConfigFile &cf); bool loadcf (NLMISC::CConfigFile &cf);
bool save (FILE *f); bool save (FILE *f);
@ -122,21 +122,21 @@ public:
CExport (); CExport ();
~CExport (); ~CExport ();
// EXPORT one region : // EXPORT one region :
// Parse the SourceDir find the .land and .prim // Parse the SourceDir find the .land and .prim
// newExport is the incremental export // newExport is the incremental export
bool newExport (SExportOptions &options, IExportCB *expCB = NULL); bool newExport (SExportOptions &options, IExportCB *expCB = NULL);
bool export (SExportOptions &options, IExportCB *expCB = NULL, std::vector<SExportPrimitive> *selection = NULL); bool doExport (SExportOptions &options, IExportCB *expCB = NULL, std::vector<SExportPrimitive> *selection = NULL);
// HELPERS // HELPERS
// Get All files with the extension ext in the current directory and subdirectory // Get All files with the extension ext in the current directory and subdirectory
static void getAllFiles (const std::string &ext, std::vector<std::string> &files); static void getAllFiles (const std::string &ext, std::vector<std::string> &files);
// Search a file through all subdirectories of the current one (and in the current too) // Search a file through all subdirectories of the current one (and in the current too)
static bool searchFile (const std::string &plantName, std::string &dir); static bool searchFile (const std::string &plantName, std::string &dir);
private: private:
SExportOptions *_Options; SExportOptions *_Options;
IExportCB *_ExportCB; IExportCB *_ExportCB;
@ -160,7 +160,7 @@ private:
private: private:
struct SFloraToUpdate struct SFloraToUpdate
{ {
std::string FloraFile; std::string FloraFile;
std::vector<std::string> PrimFile; std::vector<std::string> PrimFile;
@ -186,7 +186,7 @@ private:
// Write zone by zone the instance group of the flora generated in the specific land // Write zone by zone the instance group of the flora generated in the specific land
void writeFloraIG (const std::string &LandFile, bool bTestForWriting = false); void writeFloraIG (const std::string &LandFile, bool bTestForWriting = false);
// Helpers // Helpers
// ******* // *******
@ -204,11 +204,11 @@ private:
public: public:
static std::string getZoneNameFromXY (sint32 x, sint32 y); static std::string getZoneNameFromXY (sint32 x, sint32 y);
static sint32 getXFromZoneName (const std::string &ZoneName); static sint32 getXFromZoneName (const std::string &ZoneName);
static sint32 getYFromZoneName (const std::string &ZoneName); static sint32 getYFromZoneName (const std::string &ZoneName);
}; };
#endif // LD_EXPORT_H #endif // LD_EXPORT_H

View file

@ -34,7 +34,6 @@
#include "nel/ligo/zone_region.h" #include "nel/ligo/zone_region.h"
#include "nel/ligo/zone_bank.h" #include "nel/ligo/zone_bank.h"
#include "nel/../../src/pacs/collision_mesh_build.h" #include "nel/../../src/pacs/collision_mesh_build.h"
@ -81,7 +80,7 @@ void SExportOptions::serial (NLMISC::IStream& s)
s.serial (OutZoneDir); s.serial (OutZoneDir);
s.serial (RefZoneDir); s.serial (RefZoneDir);
if (version > 0) if (version > 0)
s.serial (LigoBankDir); s.serial (LigoBankDir);
@ -117,7 +116,7 @@ void SExportOptions::serial (NLMISC::IStream& s)
{ {
s.serial(ExportCollisions); s.serial(ExportCollisions);
s.serial(RefCMBDir, OutCMBDir); s.serial(RefCMBDir, OutCMBDir);
s.serial(AdditionnalIGInDir, AdditionnalIGOutDir); s.serial(AdditionnalIGInDir, AdditionnalIGOutDir);
s.serial(ContinentFile); s.serial(ContinentFile);
s.serial(DFNDir); s.serial(DFNDir);
} }
@ -144,14 +143,14 @@ void SExportOptions::serial (NLMISC::IStream& s)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
CExport::CExport () CExport::CExport ()
{ {
_ZeZoneBank = NULL; _ZeZoneBank = NULL;
_FormLoader = UFormLoader::createLoader (); _FormLoader = UFormLoader::createLoader ();
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
CExport::~CExport () CExport::~CExport ()
{ {
UFormLoader::releaseLoader (_FormLoader); UFormLoader::releaseLoader (_FormLoader);
} }
@ -171,12 +170,12 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB)
} }
// LOADING // LOADING
// --- continent form // --- continent form
CPath::addSearchPath(_Options->DFNDir, true, false); CPath::addSearchPath(_Options->DFNDir, true, false);
CPath::addSearchPath(_Options->RefCMBDir, true, false); CPath::addSearchPath(_Options->RefCMBDir, true, false);
CPath::addSearchPath(_Options->ContinentsDir, true, false); CPath::addSearchPath(_Options->ContinentsDir, true, false);
CPath::addSearchPath(_Options->AdditionnalIGInDir, true, false); CPath::addSearchPath(_Options->AdditionnalIGInDir, true, false);
// --- ligozone // --- ligozone
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispPass ("Loading ligozone bank"); _ExportCB->dispPass ("Loading ligozone bank");
@ -188,7 +187,7 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB)
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispPass ("Loading tile bank"); _ExportCB->dispPass ("Loading tile bank");
_ZeTileBank = new CTileBank; _ZeTileBank = new CTileBank;
try try
{ {
CIFile inFile (_Options->TileBankFile); CIFile inFile (_Options->TileBankFile);
_ZeTileBank->serial (inFile); _ZeTileBank->serial (inFile);
@ -207,7 +206,7 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB)
if (_Options->HeightMapFile != "") if (_Options->HeightMapFile != "")
{ {
_HeightMap = new CBitmap; _HeightMap = new CBitmap;
try try
{ {
CIFile inFile; CIFile inFile;
if (inFile.open (_Options->HeightMapFile)) if (inFile.open (_Options->HeightMapFile))
@ -238,7 +237,7 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB)
if (_Options->HeightMapFile2 != "") if (_Options->HeightMapFile2 != "")
{ {
_HeightMap2 = new CBitmap; _HeightMap2 = new CBitmap;
try try
{ {
CIFile inFile; CIFile inFile;
if (inFile.open (_Options->HeightMapFile2)) if (inFile.open (_Options->HeightMapFile2))
@ -269,7 +268,7 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB)
if (_Options->ColorMapFile != "") if (_Options->ColorMapFile != "")
{ {
_ColorMap = new CBitmap; _ColorMap = new CBitmap;
try try
{ {
CIFile inFile; CIFile inFile;
if (inFile.open (_Options->ColorMapFile)) if (inFile.open (_Options->ColorMapFile))
@ -329,9 +328,9 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB)
return false; return false;
} }
// zones // zones
for (uint32 nFile = 0; nFile < allFiles.size(); ++nFile) for (uint32 nFile = 0; nFile < allFiles.size(); ++nFile)
{ {
@ -364,18 +363,18 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB)
if (!DeleteFile (allFiles[nFile].c_str())) if (!DeleteFile (allFiles[nFile].c_str()))
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning (string("Can't delete ") + fileName); _ExportCB->dispWarning (string("Can't delete ") + fileName);
} }
else else
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispInfo (string("Deleted ") + fileName); _ExportCB->dispInfo (string("Deleted ") + fileName);
} }
} }
} }
} }
CTools::chdir (sCurDir); CTools::chdir (sCurDir);
@ -394,9 +393,9 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB)
sint32 nNewMaxX = getXFromZoneName (_Options->ZoneMax); sint32 nNewMaxX = getXFromZoneName (_Options->ZoneMax);
sint32 nNewMaxY = getYFromZoneName (_Options->ZoneMax); sint32 nNewMaxY = getYFromZoneName (_Options->ZoneMax);
if (nNewMinX > nNewMaxX) if (nNewMinX > nNewMaxX)
swap (nNewMinX, nNewMaxX); swap (nNewMinX, nNewMaxX);
if (nNewMinY > nNewMaxY) if (nNewMinY > nNewMaxY)
swap (nNewMinY, nNewMaxY); swap (nNewMinY, nNewMaxY);
if (nNewMinX > nMinX) if (nNewMinX > nMinX)
@ -448,19 +447,19 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB)
_ExportCB->dispPass ("Finished"); _ExportCB->dispPass ("Finished");
delete _ZeZoneBank; delete _ZeZoneBank;
delete _ZeTileBank; delete _ZeTileBank;
return true; return true;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
void CExport::treatPattern (sint32 x, sint32 y, void CExport::treatPattern (sint32 x, sint32 y,
vector<bool> &ZoneTreated, sint32 nMinX, sint32 nMinY, sint32 nStride) vector<bool> &ZoneTreated, sint32 nMinX, sint32 nMinY, sint32 nStride)
{ {
CZoneRegion *pZR = _Options->ZoneRegion; CZoneRegion *pZR = _Options->ZoneRegion;
const string &rSZone = pZR->getName (x, y); const string &rSZone = pZR->getName (x, y);
CZoneBankElement *pZBE = _ZeZoneBank->getElementByZoneName (rSZone); CZoneBankElement *pZBE = _ZeZoneBank->getElementByZoneName (rSZone);
if (pZBE == NULL) if (pZBE == NULL)
return; return;
@ -514,7 +513,7 @@ void CExport::treatPattern (sint32 x, sint32 y,
if (!CTools::fileExist(finalZoneName)) if (!CTools::fileExist(finalZoneName))
{ {
bHaveToExportZone = true; // A file do not exist -> export it bHaveToExportZone = true; // A file do not exist -> export it
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispInfo (string("finalZone do not exist")); _ExportCB->dispInfo (string("finalZone do not exist"));
@ -552,7 +551,7 @@ void CExport::treatPattern (sint32 x, sint32 y,
_ExportCB->dispInfo (string("Cell date newer")); _ExportCB->dispInfo (string("Cell date newer"));
break; break;
} }
} }
// Check if we have to export the igs // Check if we have to export the igs
@ -569,7 +568,7 @@ void CExport::treatPattern (sint32 x, sint32 y,
if (!CTools::fileExist(finalIGName)) if (!CTools::fileExist(finalIGName))
{ {
bHaveToExportIG = true; // A file do not exist -> export it bHaveToExportIG = true; // A file do not exist -> export it
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispInfo (string("final instance group do not exist")); _ExportCB->dispInfo (string("final instance group do not exist"));
@ -607,7 +606,7 @@ void CExport::treatPattern (sint32 x, sint32 y,
_ExportCB->dispInfo (string("Cell date newer")); _ExportCB->dispInfo (string("Cell date newer"));
break; break;
} }
} }
@ -616,7 +615,7 @@ void CExport::treatPattern (sint32 x, sint32 y,
// Put the big zone at the right position // Put the big zone at the right position
CZone BigZone; CZone BigZone;
// 1 - Load the zone and IG // 1 - Load the zone and IG
string BigZoneFileName; string BigZoneFileName;
@ -628,7 +627,7 @@ void CExport::treatPattern (sint32 x, sint32 y,
BigZoneFileName = _Options->RefZoneDir + string("\\") + rSZone + string(".zone"); BigZoneFileName = _Options->RefZoneDir + string("\\") + rSZone + string(".zone");
CIFile inFile ; CIFile inFile ;
if (inFile.open(BigZoneFileName)) if (inFile.open(BigZoneFileName))
{ {
BigZone.serial (inFile); BigZone.serial (inFile);
} }
else else
@ -658,7 +657,7 @@ void CExport::treatPattern (sint32 x, sint32 y,
bigIGFileName = _Options->RefIGDir + string("\\") + rSZone + string(".ig"); bigIGFileName = _Options->RefIGDir + string("\\") + rSZone + string(".ig");
CIFile inFile; CIFile inFile;
if (inFile.open(bigIGFileName)) if (inFile.open(bigIGFileName))
{ {
bigIG.serial (inFile); bigIG.serial (inFile);
} }
else else
@ -689,21 +688,21 @@ void CExport::treatPattern (sint32 x, sint32 y,
{ {
switch (rot) switch (rot)
{ {
case 0: case 0:
transformZone (BigZone, x+deltaX, y+deltaY, rot, flip, true); transformZone (BigZone, x+deltaX, y+deltaY, rot, flip, true);
transformZone (BigZoneNoHeightmap, x+deltaX, y+deltaY, rot, flip, false); transformZone (BigZoneNoHeightmap, x+deltaX, y+deltaY, rot, flip, false);
break; break;
case 1: case 1:
transformZone (BigZone, x+deltaX+sizeY, y+deltaY, rot, flip, true); transformZone (BigZone, x+deltaX+sizeY, y+deltaY, rot, flip, true);
transformZone (BigZoneNoHeightmap, x+deltaX+sizeY, y+deltaY, rot, flip, false); transformZone (BigZoneNoHeightmap, x+deltaX+sizeY, y+deltaY, rot, flip, false);
break; break;
case 2: case 2:
transformZone (BigZone, x+deltaX+sizeX, y+deltaY+sizeY, rot, flip, true); transformZone (BigZone, x+deltaX+sizeX, y+deltaY+sizeY, rot, flip, true);
transformZone (BigZoneNoHeightmap, x+deltaX+sizeX, y+deltaY+sizeY, rot, flip, false); transformZone (BigZoneNoHeightmap, x+deltaX+sizeX, y+deltaY+sizeY, rot, flip, false);
break; break;
case 3: case 3:
transformZone (BigZone, x+deltaX, y+deltaY+sizeX, rot, flip, true); transformZone (BigZone, x+deltaX, y+deltaY+sizeX, rot, flip, true);
transformZone (BigZoneNoHeightmap, x+deltaX, y+deltaY+sizeX, rot, flip, false); transformZone (BigZoneNoHeightmap, x+deltaX, y+deltaY+sizeX, rot, flip, false);
break; break;
} }
} }
@ -711,21 +710,21 @@ void CExport::treatPattern (sint32 x, sint32 y,
{ {
switch (rot) switch (rot)
{ {
case 0: case 0:
transformZone (BigZone, x+deltaX+sizeX, y+deltaY, rot, flip, true); transformZone (BigZone, x+deltaX+sizeX, y+deltaY, rot, flip, true);
transformZone (BigZoneNoHeightmap, x+deltaX+sizeX, y+deltaY, rot, flip, false); transformZone (BigZoneNoHeightmap, x+deltaX+sizeX, y+deltaY, rot, flip, false);
break; break;
case 1: case 1:
transformZone (BigZone, x+deltaX+sizeY, y+deltaY+sizeX, rot, flip, true); transformZone (BigZone, x+deltaX+sizeY, y+deltaY+sizeX, rot, flip, true);
transformZone (BigZoneNoHeightmap, x+deltaX+sizeY, y+deltaY+sizeX, rot, flip, false); transformZone (BigZoneNoHeightmap, x+deltaX+sizeY, y+deltaY+sizeX, rot, flip, false);
break; break;
case 2: case 2:
transformZone (BigZone, x+deltaX, y+deltaY+sizeY, rot, flip, true); transformZone (BigZone, x+deltaX, y+deltaY+sizeY, rot, flip, true);
transformZone (BigZoneNoHeightmap, x+deltaX, y+deltaY+sizeY, rot, flip, false); transformZone (BigZoneNoHeightmap, x+deltaX, y+deltaY+sizeY, rot, flip, false);
break; break;
case 3: case 3:
transformZone (BigZone, x+deltaX, y+deltaY, rot, flip, true); transformZone (BigZone, x+deltaX, y+deltaY, rot, flip, true);
transformZone (BigZoneNoHeightmap, x+deltaX, y+deltaY, rot, flip, false); transformZone (BigZoneNoHeightmap, x+deltaX, y+deltaY, rot, flip, false);
break; break;
} }
} }
@ -737,17 +736,17 @@ void CExport::treatPattern (sint32 x, sint32 y,
{ {
switch (rot) switch (rot)
{ {
case 0: case 0:
transformIG (bigIG, x+deltaX, y+deltaY, rot, flip); transformIG (bigIG, x+deltaX, y+deltaY, rot, flip);
break; break;
case 1: case 1:
transformIG (bigIG, x+deltaX+sizeY, y+deltaY, rot, flip); transformIG (bigIG, x+deltaX+sizeY, y+deltaY, rot, flip);
break; break;
case 2: case 2:
transformIG (bigIG, x+deltaX+sizeX, y+deltaY+sizeY, rot, flip); transformIG (bigIG, x+deltaX+sizeX, y+deltaY+sizeY, rot, flip);
break; break;
case 3: case 3:
transformIG (bigIG, x+deltaX, y+deltaY+sizeX, rot, flip); transformIG (bigIG, x+deltaX, y+deltaY+sizeX, rot, flip);
break; break;
} }
} }
@ -755,17 +754,17 @@ void CExport::treatPattern (sint32 x, sint32 y,
{ {
switch (rot) switch (rot)
{ {
case 0: case 0:
transformIG (bigIG, x+deltaX+sizeX, y+deltaY, rot, flip); transformIG (bigIG, x+deltaX+sizeX, y+deltaY, rot, flip);
break; break;
case 1: case 1:
transformIG (bigIG, x+deltaX+sizeY, y+deltaY+sizeX, rot, flip); transformIG (bigIG, x+deltaX+sizeY, y+deltaY+sizeX, rot, flip);
break; break;
case 2: case 2:
transformIG (bigIG, x+deltaX, y+deltaY+sizeY, rot, flip); transformIG (bigIG, x+deltaX, y+deltaY+sizeY, rot, flip);
break; break;
case 3: case 3:
transformIG (bigIG, x+deltaX, y+deltaY, rot, flip); transformIG (bigIG, x+deltaX, y+deltaY, rot, flip);
break; break;
} }
} }
@ -823,7 +822,7 @@ void CExport::treatPattern (sint32 x, sint32 y,
if (bHaveToExportZone) if (bHaveToExportZone)
{ {
// Put all the patches contained in the square ... in the unit zone // Put all the patches contained in the square ... in the unit zone
cutZone (BigZone, BigZoneNoHeightmap, UnitZone, UnitZoneNoHeightmap, x+deltaX+i, y+deltaY+j, PatchTransfered, bb, SrcPI, SrcPINoHeightmap, cutZone (BigZone, BigZoneNoHeightmap, UnitZone, UnitZoneNoHeightmap, x+deltaX+i, y+deltaY+j, PatchTransfered, bb, SrcPI, SrcPINoHeightmap,
sMask, BorderVertices, BorderVerticesNoHeightmap, x+deltaX, y+deltaY); sMask, BorderVertices, BorderVerticesNoHeightmap, x+deltaX, y+deltaY);
if (_Options->Light > 0) if (_Options->Light > 0)
light (UnitZoneLighted, UnitZone); light (UnitZoneLighted, UnitZone);
@ -890,7 +889,7 @@ void CExport::treatPattern (sint32 x, sint32 y,
_ExportCB->dispWarning (string("Cant write ") + dstIGFileName); _ExportCB->dispWarning (string("Cant write ") + dstIGFileName);
} }
} }
// Set the zone as unused to not treat it the next time // Set the zone as unused to not treat it the next time
ZoneTreated[(x+deltaX+i)-nMinX + ((y+deltaY+j)-nMinY) * nStride] = true; ZoneTreated[(x+deltaX+i)-nMinX + ((y+deltaY+j)-nMinY) * nStride] = true;
@ -899,11 +898,11 @@ void CExport::treatPattern (sint32 x, sint32 y,
first = false; first = false;
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Tile conversion // Tile conversion
int TransitionFlipLR[48] = int TransitionFlipLR[48] =
{ {
0, // 0 0, // 0
@ -1089,8 +1088,8 @@ bool transformTile (const CTileBank &bank, uint &tile, uint &tileRotation, bool
const CTileSet *pTileSet = bank.getTileSet (tileSet); const CTileSet *pTileSet = bank.getTileSet (tileSet);
// Get border desc // Get border desc
CTileSet::TFlagBorder oriented[4] = CTileSet::TFlagBorder oriented[4] =
{ {
pTileSet->getOrientedBorder (CTileSet::left, CTileSet::getEdgeType ((CTileSet::TTransition)number, CTileSet::left)), pTileSet->getOrientedBorder (CTileSet::left, CTileSet::getEdgeType ((CTileSet::TTransition)number, CTileSet::left)),
pTileSet->getOrientedBorder (CTileSet::bottom, CTileSet::getEdgeType ((CTileSet::TTransition)number, CTileSet::bottom)), pTileSet->getOrientedBorder (CTileSet::bottom, CTileSet::getEdgeType ((CTileSet::TTransition)number, CTileSet::bottom)),
pTileSet->getOrientedBorder (CTileSet::right, CTileSet::getEdgeType ((CTileSet::TTransition)number, CTileSet::right)), pTileSet->getOrientedBorder (CTileSet::right, CTileSet::getEdgeType ((CTileSet::TTransition)number, CTileSet::right)),
@ -1214,7 +1213,7 @@ void CExport::addColorMap (CZone &zeZone)
dest = tmp.get565 (); dest = tmp.get565 ();
} }
} }
zeZone.build (zeZone.getZoneId (), PatchInfos, BorderVertices); zeZone.build (zeZone.getZoneId (), PatchInfos, BorderVertices);
} }
} }
@ -1307,7 +1306,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
angleAxis.Angle= (float)asin(angleAxis.Axis.norm()); angleAxis.Angle= (float)asin(angleAxis.Axis.norm());
angleAxis.Axis.normalize(); angleAxis.Axis.normalize();
// build the matrix which transform the old tgt/interior to his newValue: // build the matrix which transform the old tgt/interior to his newValue:
// newVertexPos+ rotate*(oldTgPos-oldVertexPos) // newVertexPos+ rotate*(oldTgPos-oldVertexPos)
tgMatrix[j].identity(); tgMatrix[j].identity();
tgMatrix[j].translate(rPI.Patch.Vertices[j]); tgMatrix[j].translate(rPI.Patch.Vertices[j]);
@ -1317,7 +1316,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
// For all interior. // For all interior.
for (j = 0; j < 4; ++j) for (j = 0; j < 4; ++j)
rPI.Patch.Interiors[j]= tgMatrix[j] * rPI.Patch.Interiors[j]; rPI.Patch.Interiors[j]= tgMatrix[j] * rPI.Patch.Interiors[j];
// when j == 7 or 0 use vertex 0 for delta Z to ensure continuity of normals // when j == 7 or 0 use vertex 0 for delta Z to ensure continuity of normals
// when j == 1 or 2 use vertex 1 // when j == 1 or 2 use vertex 1
@ -1409,7 +1408,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
bindedTangent= subTangents[vb*2+1]; bindedTangent= subTangents[vb*2+1];
// get the patch id. // get the patch id.
ngbId= rPI.BindEdges[j].Next[vb]; ngbId= rPI.BindEdges[j].Next[vb];
bindVertexModified|= applyVertexBind(PatchInfos[ ngbId ], oldPatchInfos[ ngbId ], edgeToModify, bindVertexModified|= applyVertexBind(PatchInfos[ ngbId ], oldPatchInfos[ ngbId ], edgeToModify,
true, oldTgSpace, newTgSpace, bindedPos, bindedTangent); true, oldTgSpace, newTgSpace, bindedPos, bindedTangent);
// The second patch (CCW) must change the vertex which ends on the edge (CCW) // The second patch (CCW) must change the vertex which ends on the edge (CCW)
@ -1418,7 +1417,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
bindedTangent= subTangents[vb*2+2]; bindedTangent= subTangents[vb*2+2];
// get the patch id. // get the patch id.
ngbId= rPI.BindEdges[j].Next[vb+1]; ngbId= rPI.BindEdges[j].Next[vb+1];
bindVertexModified|= applyVertexBind(PatchInfos[ ngbId ], oldPatchInfos[ ngbId ], edgeToModify, bindVertexModified|= applyVertexBind(PatchInfos[ ngbId ], oldPatchInfos[ ngbId ], edgeToModify,
false, oldTgSpace, newTgSpace, bindedPos, bindedTangent); false, oldTgSpace, newTgSpace, bindedPos, bindedTangent);
} }
} }
@ -1493,7 +1492,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
angleAxis.Angle= (float)asin(angleAxis.Axis.norm()); angleAxis.Angle= (float)asin(angleAxis.Axis.norm());
angleAxis.Axis.normalize(); angleAxis.Axis.normalize();
// build the matrix which transform the old tgt/interior to his newValue: // build the matrix which transform the old tgt/interior to his newValue:
// newVertexPos+ rotate*(oldTgPos-oldVertexPos) // newVertexPos+ rotate*(oldTgPos-oldVertexPos)
tgMatrix[j].identity(); tgMatrix[j].identity();
tgMatrix[j].translate(rPI.Patch.Vertices[j]); tgMatrix[j].translate(rPI.Patch.Vertices[j]);
@ -1595,7 +1594,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
bindedTangent= subTangents[vb*2+1]; bindedTangent= subTangents[vb*2+1];
// get the patch id. // get the patch id.
ngbId= rPI.BindEdges[j].Next[vb]; ngbId= rPI.BindEdges[j].Next[vb];
bindVertexModified|= applyVertexBind(PatchInfos[ ngbId ], oldPatchInfos[ ngbId ], edgeToModify, bindVertexModified|= applyVertexBind(PatchInfos[ ngbId ], oldPatchInfos[ ngbId ], edgeToModify,
true, oldTgSpace, newTgSpace, bindedPos, bindedTangent); true, oldTgSpace, newTgSpace, bindedPos, bindedTangent);
// The second patch (CCW) must change the vertex which ends on the edge (CCW) // The second patch (CCW) must change the vertex which ends on the edge (CCW)
@ -1604,7 +1603,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
bindedTangent= subTangents[vb*2+2]; bindedTangent= subTangents[vb*2+2];
// get the patch id. // get the patch id.
ngbId= rPI.BindEdges[j].Next[vb+1]; ngbId= rPI.BindEdges[j].Next[vb+1];
bindVertexModified|= applyVertexBind(PatchInfos[ ngbId ], oldPatchInfos[ ngbId ], edgeToModify, bindVertexModified|= applyVertexBind(PatchInfos[ ngbId ], oldPatchInfos[ ngbId ], edgeToModify,
false, oldTgSpace, newTgSpace, bindedPos, bindedTangent); false, oldTgSpace, newTgSpace, bindedPos, bindedTangent);
} }
} }
@ -1679,7 +1678,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
swap(rPI.Tiles[j+k*rPI.OrderS], rPI.Tiles[(rPI.OrderS-1-j)+k*rPI.OrderS]); swap(rPI.Tiles[j+k*rPI.OrderS], rPI.Tiles[(rPI.OrderS-1-j)+k*rPI.OrderS]);
} }
} }
for (j = 0; j < (uint32)((rPI.OrderS+1)/2); ++j) for (j = 0; j < (uint32)((rPI.OrderS+1)/2); ++j)
{ {
for (k = 0; k < (uint32)(rPI.OrderT+1); ++k) for (k = 0; k < (uint32)(rPI.OrderT+1); ++k)
@ -1698,7 +1697,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
for (i = 0; i < PatchInfos.size(); ++i) for (i = 0; i < PatchInfos.size(); ++i)
{ {
CPatchInfo &rPI = PatchInfos[i]; CPatchInfo &rPI = PatchInfos[i];
for (j = 0; j < rPI.Tiles.size(); ++j) for (j = 0; j < rPI.Tiles.size(); ++j)
{ {
@ -1711,7 +1710,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
// Is the tile is painted ? // Is the tile is painted ?
if (rPI.Tiles[j].Tile[0] == 65535) if (rPI.Tiles[j].Tile[0] == 65535)
continue; continue;
// Rotate Tiles // Rotate Tiles
// Invert rotation effect on transition // Invert rotation effect on transition
for (pass = 0; pass < 3; ++pass) for (pass = 0; pass < 3; ++pass)
@ -1749,7 +1748,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR
} }
} }
} }
zeZone.build (nZoneId, PatchInfos, BorderVertices); zeZone.build (nZoneId, PatchInfos, BorderVertices);
}*/ }*/
@ -1768,7 +1767,7 @@ void CExport::buildTransfo(sint32 nPosX, sint32 nPosY, uint8 nRot, uint8 nFlip,
posTransfo.setRot(rotTransfo); posTransfo.setRot(rotTransfo);
posTransfo.setPos(CVector(nPosX * _Options->CellSize, (nPosY) * _Options->CellSize, 0.0f)); posTransfo.setPos(CVector(nPosX * _Options->CellSize, (nPosY) * _Options->CellSize, 0.0f));
if (nFlip == 1) if (nFlip == 1)
posTransfo.scale(CVector(-1.0f, 1.0f, 1.0f)); posTransfo.scale(CVector(-1.0f, 1.0f, 1.0f));
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -1777,8 +1776,8 @@ void CExport::transformIG (CInstanceGroup &ig, sint32 nPosX, sint32 nPosY, uint8
uint k; uint k;
CQuat rotTransfo; CQuat rotTransfo;
CMatrix transformation; CMatrix transformation;
buildTransfo(nPosX, nPosY, nRot, nFlip, transformation, rotTransfo); buildTransfo(nPosX, nPosY, nRot, nFlip, transformation, rotTransfo);
/////////////// ///////////////
// instances // // instances //
@ -1792,7 +1791,7 @@ void CExport::transformIG (CInstanceGroup &ig, sint32 nPosX, sint32 nPosY, uint8
// add height map influence // add height map influence
//igi.Pos.z += getHeight(igi.Pos.x, igi.Pos.y); //igi.Pos.z += getHeight(igi.Pos.x, igi.Pos.y);
// Instance // Instance
CInstanceGroup::CInstance &igi = ig.getInstance(k); CInstanceGroup::CInstance &igi = ig.getInstance(k);
@ -1829,7 +1828,7 @@ void CExport::transformIG (CInstanceGroup &ig, sint32 nPosX, sint32 nPosY, uint8
plm.setPosition(transformation * plm.getPosition()); plm.setPosition(transformation * plm.getPosition());
// add height map influence // add height map influence
// plm.setPosition(plm.getPosition() + CVector::K * getHeight(plm.getPosition().x, plm.getPosition().y)); // plm.setPosition(plm.getPosition() + CVector::K * getHeight(plm.getPosition().x, plm.getPosition().y));
} }
} }
@ -1848,13 +1847,13 @@ void CExport::transformCMB (NLPACS::CCollisionMeshBuild &cmb,sint32 nPosX,sint32
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
void CExport::cutZone (NL3D::CZone &bigZone, NL3D::CZone &bigZoneNoHeightmap, NL3D::CZone &unitZone, NL3D::CZone &unitZoneNoHeightmap, void CExport::cutZone (NL3D::CZone &bigZone, NL3D::CZone &bigZoneNoHeightmap, NL3D::CZone &unitZone, NL3D::CZone &unitZoneNoHeightmap,
sint32 nPosX, sint32 nPosY, vector<bool> &PatchTransfered, const vector<CAABBox> &bb, vector<CPatchInfo> &SrcPI, sint32 nPosX, sint32 nPosY, vector<bool> &PatchTransfered, const vector<CAABBox> &bb, vector<CPatchInfo> &SrcPI,
vector<CPatchInfo> &SrcPINoHeightmap, SPiece &sMask, vector<CBorderVertex> &BorderVertices, vector<CPatchInfo> &SrcPINoHeightmap, SPiece &sMask, vector<CBorderVertex> &BorderVertices,
vector<CBorderVertex> &BorderVerticesNoHeightmap, sint32 baseX, sint32 baseY) vector<CBorderVertex> &BorderVerticesNoHeightmap, sint32 baseX, sint32 baseY)
{ {
string DstZoneFileName = getZoneNameFromXY (nPosX, nPosY); string DstZoneFileName = getZoneNameFromXY (nPosX, nPosY);
uint32 i, j, k, l, m; uint32 i, j, k, l, m;
vector<CPatchInfo> DstPI; vector<CPatchInfo> DstPI;
vector<CPatchInfo> DstPINoHeightmap; vector<CPatchInfo> DstPINoHeightmap;
@ -1955,7 +1954,7 @@ void CExport::cutZone (NL3D::CZone &bigZone, NL3D::CZone &bigZoneNoHeightmap, NL
} }
while (foundOne); while (foundOne);
// Add all patch that are binded to one of those of the DstPI list // Add all patch that are binded to one of those of the DstPI list
uint32 nPreviousDstPISize = (uint32)DstPI.size(); uint32 nPreviousDstPISize = (uint32)DstPI.size();
for (;;) for (;;)
{ {
@ -1989,8 +1988,8 @@ void CExport::cutZone (NL3D::CZone &bigZone, NL3D::CZone &bigZoneNoHeightmap, NL
uint next = DstPI[i].BindEdges[j].Next[k]; uint next = DstPI[i].BindEdges[j].Next[k];
if (!PatchTransfered[next]) if (!PatchTransfered[next])
{ {
CPatchInfo &rPITmp = SrcPI[next]; CPatchInfo &rPITmp = SrcPI[next];
CPatchInfo &rPITmpNoHeightmap = SrcPINoHeightmap[next]; CPatchInfo &rPITmpNoHeightmap = SrcPINoHeightmap[next];
for (m = 0; m < 4; ++m) for (m = 0; m < 4; ++m)
{ {
rPITmp.BindEdges[m].ZoneId = nZoneId; rPITmp.BindEdges[m].ZoneId = nZoneId;
@ -2069,7 +2068,7 @@ void CExport::cutZone (NL3D::CZone &bigZone, NL3D::CZone &bigZoneNoHeightmap, NL
gLand.init(); gLand.init();
gLandInited = true; gLandInited = true;
} }
gLand.addZone(unitZone); gLand.addZone(unitZone);
gLand.checkBinds(); gLand.checkBinds();
}*/ }*/
@ -2126,14 +2125,14 @@ void CExport::cutIG(CInstanceGroup &bigIG, CInstanceGroup &unitIG, sint32 nPosX,
// lights // // lights //
//////////// ////////////
const std::vector<CPointLightNamed> &lights = bigIG.getPointLightList(); const std::vector<CPointLightNamed> &lights = bigIG.getPointLightList();
for (k = 0; k < lights.size(); ++k) for (k = 0; k < lights.size(); ++k)
{ {
const CVector &pos = lights[k].getPosition(); const CVector &pos = lights[k].getPosition();
if (pos.x >= rMinX && pos.x < rMaxX && pos.y >= rMinY && pos.y < rMaxY) if (pos.x >= rMinX && pos.x < rMaxX && pos.y >= rMinY && pos.y < rMaxY)
{ {
pointLightList.push_back(lights[k]); pointLightList.push_back(lights[k]);
} }
// First zone ? // First zone ?
if (first) if (first)
@ -2165,13 +2164,13 @@ float CExport::getHeight (float x, float y)
CRGBAF color; CRGBAF color;
sint32 SizeX = _ZoneMaxX - _ZoneMinX + 1; sint32 SizeX = _ZoneMaxX - _ZoneMinX + 1;
sint32 SizeY = _ZoneMaxY - _ZoneMinY + 1; sint32 SizeY = _ZoneMaxY - _ZoneMinY + 1;
clamp (x, _Options->CellSize*_ZoneMinX, _Options->CellSize*(_ZoneMaxX+1)); clamp (x, _Options->CellSize*_ZoneMinX, _Options->CellSize*(_ZoneMaxX+1));
clamp (y, _Options->CellSize*_ZoneMinY, _Options->CellSize*(_ZoneMaxY+1)); clamp (y, _Options->CellSize*_ZoneMinY, _Options->CellSize*(_ZoneMaxY+1));
if (_HeightMap != NULL) if (_HeightMap != NULL)
{ {
color = _HeightMap->getColor ( (x-_Options->CellSize*_ZoneMinX)/(_Options->CellSize*SizeX), color = _HeightMap->getColor ( (x-_Options->CellSize*_ZoneMinX)/(_Options->CellSize*SizeX),
1.0f - ((y-_Options->CellSize*_ZoneMinY)/(_Options->CellSize*SizeY))); 1.0f - ((y-_Options->CellSize*_ZoneMinY)/(_Options->CellSize*SizeY)));
color *= 255; color *= 255;
deltaZ = color.A; deltaZ = color.A;
@ -2181,7 +2180,7 @@ float CExport::getHeight (float x, float y)
if (_HeightMap2 != NULL) if (_HeightMap2 != NULL)
{ {
color = _HeightMap2->getColor ( (x-_Options->CellSize*_ZoneMinX)/(_Options->CellSize*SizeX), color = _HeightMap2->getColor ( (x-_Options->CellSize*_ZoneMinX)/(_Options->CellSize*SizeX),
1.0f - ((y-_Options->CellSize*_ZoneMinY)/(_Options->CellSize*SizeY))); 1.0f - ((y-_Options->CellSize*_ZoneMinY)/(_Options->CellSize*SizeY)));
color *= 255; color *= 255;
deltaZ2 = color.A; deltaZ2 = color.A;
@ -2198,13 +2197,13 @@ CRGBAF CExport::getColor (float x, float y)
CRGBAF color = CRGBA::Black; CRGBAF color = CRGBA::Black;
sint32 SizeX = _ZoneMaxX - _ZoneMinX + 1; sint32 SizeX = _ZoneMaxX - _ZoneMinX + 1;
sint32 SizeY = _ZoneMaxY - _ZoneMinY + 1; sint32 SizeY = _ZoneMaxY - _ZoneMinY + 1;
clamp (x, _Options->CellSize*_ZoneMinX, _Options->CellSize*(_ZoneMaxX+1)); clamp (x, _Options->CellSize*_ZoneMinX, _Options->CellSize*(_ZoneMaxX+1));
clamp (y, _Options->CellSize*_ZoneMinY, _Options->CellSize*(_ZoneMaxY+1)); clamp (y, _Options->CellSize*_ZoneMinY, _Options->CellSize*(_ZoneMaxY+1));
if (_ColorMap != NULL) if (_ColorMap != NULL)
{ {
color = _ColorMap->getColor ( (x-_Options->CellSize*_ZoneMinX)/(_Options->CellSize*SizeX), color = _ColorMap->getColor ( (x-_Options->CellSize*_ZoneMinX)/(_Options->CellSize*SizeX),
1.0f - ((y-_Options->CellSize*_ZoneMinY)/(_Options->CellSize*SizeY))); 1.0f - ((y-_Options->CellSize*_ZoneMinY)/(_Options->CellSize*SizeY)));
color *= 255; color *= 255;
} }
@ -2257,7 +2256,7 @@ void CExport::light (NL3D::CZone &zoneOut, NL3D::CZone &zoneIn)
land.TileBank = *_ZeTileBank; land.TileBank = *_ZeTileBank;
land.initTileBanks(); land.initTileBanks();
land.addZone (zoneIn); land.addZone (zoneIn);
vector<CPatchInfo> vPI; vector<CPatchInfo> vPI;
vector<CBorderVertex> vBV; vector<CBorderVertex> vBV;
@ -2383,7 +2382,7 @@ sint32 CExport::getYFromZoneName (const string &ZoneName)
} }
return -atoi(yStr.c_str()); return -atoi(yStr.c_str());
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
void CExport::transformCMB (const std::string &name, const NLMISC::CMatrix &transfo, bool verbose) const void CExport::transformCMB (const std::string &name, const NLMISC::CMatrix &transfo, bool verbose) const
{ {
@ -2405,9 +2404,9 @@ void CExport::transformCMB (const std::string &name, const NLMISC::CMatrix &tran
if (inStream.open(cmbName)) if (inStream.open(cmbName))
{ {
try try
{ {
CCollisionMeshBuild cmb; CCollisionMeshBuild cmb;
cmb.serial(inStream); cmb.serial(inStream);
// translate and save // translate and save
cmb.transform (transfo); cmb.transform (transfo);
COFile outStream; COFile outStream;
@ -2418,7 +2417,7 @@ void CExport::transformCMB (const std::string &name, const NLMISC::CMatrix &tran
_ExportCB->dispWarning("Couldn't open " + outFileName + "for writing, not exporting"); _ExportCB->dispWarning("Couldn't open " + outFileName + "for writing, not exporting");
} }
else else
{ {
try try
{ {
cmb.serial(outStream); cmb.serial(outStream);
@ -2428,23 +2427,23 @@ void CExport::transformCMB (const std::string &name, const NLMISC::CMatrix &tran
{ {
outStream.close(); outStream.close();
if (_ExportCB != NULL) if (_ExportCB != NULL)
{ {
_ExportCB->dispWarning("Error while writing " + outFileName); _ExportCB->dispWarning("Error while writing " + outFileName);
_ExportCB->dispWarning(e.what()); _ExportCB->dispWarning(e.what());
} }
} }
} }
inStream.close(); inStream.close();
} }
catch (EStream &e) catch (EStream &e)
{ {
inStream.close(); inStream.close();
if (_ExportCB != NULL) if (_ExportCB != NULL)
{ {
_ExportCB->dispWarning("Error while reading " + cmbName); _ExportCB->dispWarning("Error while reading " + cmbName);
_ExportCB->dispWarning(e.what()); _ExportCB->dispWarning(e.what());
} }
} }
} }
else else
{ {
@ -2474,7 +2473,7 @@ void CExport::transformAdditionnalIG (const std::string &name, const NLMISC::CMa
if (inStream.open(igName)) if (inStream.open(igName))
{ {
try try
{ {
CInstanceGroup ig, igOut; CInstanceGroup ig, igOut;
ig.serial(inStream); ig.serial(inStream);
@ -2483,22 +2482,22 @@ void CExport::transformAdditionnalIG (const std::string &name, const NLMISC::CMa
std::vector<CCluster> Clusters; std::vector<CCluster> Clusters;
std::vector<CPortal> Portals; std::vector<CPortal> Portals;
std::vector<CPointLightNamed> PLN; std::vector<CPointLightNamed> PLN;
ig.retrieve(globalPos, IA, Clusters, Portals, PLN); ig.retrieve(globalPos, IA, Clusters, Portals, PLN);
bool realTimeSuncontribution = ig.getRealTimeSunContribution(); bool realTimeSuncontribution = ig.getRealTimeSunContribution();
uint k; uint k;
// elevate instance // elevate instance
for(k = 0; k < IA.size(); ++k) for(k = 0; k < IA.size(); ++k)
{ {
IA[k].Pos = transfo * IA[k].Pos; IA[k].Pos = transfo * IA[k].Pos;
IA[k].Rot = rotTransfo * IA[k].Rot; IA[k].Rot = rotTransfo * IA[k].Rot;
} }
// lights // lights
for(k = 0; k < PLN.size(); ++k) for(k = 0; k < PLN.size(); ++k)
{ {
PLN[k].setPosition(transfo * PLN[k].getPosition()); PLN[k].setPosition(transfo * PLN[k].getPosition());
} }
// portals // portals
std::vector<CVector> portal; std::vector<CVector> portal;
for(k = 0; k < Portals.size(); ++k) for(k = 0; k < Portals.size(); ++k)
@ -2507,13 +2506,13 @@ void CExport::transformAdditionnalIG (const std::string &name, const NLMISC::CMa
for(uint l = 0; l < portal.size(); ++l) for(uint l = 0; l < portal.size(); ++l)
{ {
portal[l] = transfo * portal[l]; portal[l] = transfo * portal[l];
} }
Portals[k].setPoly(portal); Portals[k].setPoly(portal);
} }
// clusters // clusters
for(k = 0; k < Clusters.size(); ++k) for(k = 0; k < Clusters.size(); ++k)
{ {
Clusters[k].applyMatrix (transfo); Clusters[k].applyMatrix (transfo);
} }
@ -2530,7 +2529,7 @@ void CExport::transformAdditionnalIG (const std::string &name, const NLMISC::CMa
_ExportCB->dispWarning("Couldn't open " + outFileName + "for writing, not exporting"); _ExportCB->dispWarning("Couldn't open " + outFileName + "for writing, not exporting");
} }
else else
{ {
try try
{ {
igOut.serial(outStream); igOut.serial(outStream);
@ -2540,23 +2539,23 @@ void CExport::transformAdditionnalIG (const std::string &name, const NLMISC::CMa
{ {
outStream.close(); outStream.close();
if (_ExportCB != NULL) if (_ExportCB != NULL)
{ {
_ExportCB->dispWarning("Error while writing " + outFileName); _ExportCB->dispWarning("Error while writing " + outFileName);
_ExportCB->dispWarning(e.what()); _ExportCB->dispWarning(e.what());
} }
} }
} }
inStream.close(); inStream.close();
} }
catch (EStream &e) catch (EStream &e)
{ {
inStream.close(); inStream.close();
if (_ExportCB != NULL) if (_ExportCB != NULL)
{ {
_ExportCB->dispWarning("Error while reading " + igName); _ExportCB->dispWarning("Error while reading " + igName);
_ExportCB->dispWarning(e.what()); _ExportCB->dispWarning(e.what());
} }
} }
} }
else else
{ {
@ -2567,7 +2566,7 @@ void CExport::transformAdditionnalIG (const std::string &name, const NLMISC::CMa
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
void CExport::exportCMBAndAdditionnalIGs() void CExport::exportCMBAndAdditionnalIGs()
{ {
if (!_Options->ExportCollisions && !_Options->ExportCollisions) return; if (!_Options->ExportCollisions && !_Options->ExportCollisions) return;
CSmartPtr<UForm> continent = loadContinent(_Options->ContinentFile); CSmartPtr<UForm> continent = loadContinent(_Options->ContinentFile);
if (!continent) return; if (!continent) return;
@ -2575,7 +2574,7 @@ void CExport::exportCMBAndAdditionnalIGs()
NLGEORGES::UFormElm *villages; NLGEORGES::UFormElm *villages;
if (!continent->getRootNode ().getNodeByName (&villages, "Villages") || !villages) if (!continent->getRootNode ().getNodeByName (&villages, "Villages") || !villages)
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning("Cant find villages in a continent form"); _ExportCB->dispWarning("Cant find villages in a continent form");
return; return;
} }
@ -2588,7 +2587,7 @@ void CExport::exportCMBAndAdditionnalIGs()
NLGEORGES::UFormElm *village; NLGEORGES::UFormElm *village;
if (!villages->getArrayNode (&village, k) || !village) if (!villages->getArrayNode (&village, k) || !village)
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning("Cant get a village "); _ExportCB->dispWarning("Cant get a village ");
continue; continue;
} }
@ -2597,7 +2596,7 @@ void CExport::exportCMBAndAdditionnalIGs()
float altitude; float altitude;
if (!village->getValueByName (altitude, "Altitude")) if (!village->getValueByName (altitude, "Altitude"))
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning("Cant get a village position"); _ExportCB->dispWarning("Cant get a village position");
continue; continue;
} }
@ -2606,7 +2605,7 @@ void CExport::exportCMBAndAdditionnalIGs()
sint32 rotation; sint32 rotation;
if (!village->getValueByName (rotation, "Rotation")) if (!village->getValueByName (rotation, "Rotation"))
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning("Cant get a village rotation"); _ExportCB->dispWarning("Cant get a village rotation");
continue; continue;
} }
@ -2615,7 +2614,7 @@ void CExport::exportCMBAndAdditionnalIGs()
uint32 width; uint32 width;
if (!village->getValueByName (width, "Width")) if (!village->getValueByName (width, "Width"))
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning("Cant get a village width"); _ExportCB->dispWarning("Cant get a village width");
continue; continue;
} }
@ -2624,7 +2623,7 @@ void CExport::exportCMBAndAdditionnalIGs()
uint32 height; uint32 height;
if (!village->getValueByName (height, "Height")) if (!village->getValueByName (height, "Height"))
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning("Cant get a village height"); _ExportCB->dispWarning("Cant get a village height");
continue; continue;
} }
@ -2633,7 +2632,7 @@ void CExport::exportCMBAndAdditionnalIGs()
std::string zoneName; std::string zoneName;
if (!village->getValueByName (zoneName, "Zone")) if (!village->getValueByName (zoneName, "Zone"))
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning("Cant get a village name"); _ExportCB->dispWarning("Cant get a village name");
continue; continue;
} }
@ -2675,7 +2674,7 @@ void CExport::exportCMBAndAdditionnalIGs()
NLGEORGES::UFormElm *igNamesItem; NLGEORGES::UFormElm *igNamesItem;
if (!village->getNodeByName (&igNamesItem, "IgList") || !igNamesItem) if (!village->getNodeByName (&igNamesItem, "IgList") || !igNamesItem)
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning("Cant get village ig list"); _ExportCB->dispWarning("Cant get village ig list");
continue; continue;
} }
@ -2693,14 +2692,14 @@ void CExport::exportCMBAndAdditionnalIGs()
if (igNamesItem->getArrayNode (&currIg, k) && currIg) if (igNamesItem->getArrayNode (&currIg, k) && currIg)
{ {
const NLGEORGES::UFormElm *igNameItem; const NLGEORGES::UFormElm *igNameItem;
if (!currIg->getNodeByName (&igNameItem, "IgName") || !igNameItem) if (!currIg->getNodeByName (&igNameItem, "IgName") || !igNameItem)
{ {
nlwarning("Unable to get village name from a form"); nlwarning("Unable to get village name from a form");
continue; continue;
} }
if (igNameItem->getValue (igName)) if (igNameItem->getValue (igName))
{ {
if (_Options->ExportCollisions) if (_Options->ExportCollisions)
{ {
transformCMB (igName, transfo, true); transformCMB (igName, transfo, true);
@ -2719,7 +2718,7 @@ void CExport::exportCMBAndAdditionnalIGs()
} }
} }
} }
} }
return; return;
} }
@ -2730,7 +2729,7 @@ NLGEORGES::UForm* CExport::loadContinent(const std::string &name) const
{ {
if (!NLMISC::CFile::fileExists(name)) if (!NLMISC::CFile::fileExists(name))
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning("Can't find " + name); _ExportCB->dispWarning("Can't find " + name);
return NULL; return NULL;
} }
@ -2739,13 +2738,13 @@ NLGEORGES::UForm* CExport::loadContinent(const std::string &name) const
if (!(form = _FormLoader->loadForm (name.c_str ()))) if (!(form = _FormLoader->loadForm (name.c_str ())))
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
{ {
_ExportCB->dispWarning("Unable to load continent form : " + name); _ExportCB->dispWarning("Unable to load continent form : " + name);
} }
return NULL; return NULL;
} }
return form; return form;
} }
@ -2817,8 +2816,8 @@ void CExport::computeSubdividedTangents(uint numBinds, const NL3D::CBezierPatch
// *************************************************************************** // ***************************************************************************
bool CExport::applyVertexBind(NL3D::CPatchInfo &pa, NL3D::CPatchInfo &oldPa, uint edgeToModify, bool startEdge, bool CExport::applyVertexBind(NL3D::CPatchInfo &pa, NL3D::CPatchInfo &oldPa, uint edgeToModify, bool startEdge,
const NLMISC::CMatrix &oldTgSpace, const NLMISC::CMatrix &newTgSpace, const NLMISC::CMatrix &oldTgSpace, const NLMISC::CMatrix &newTgSpace,
const NLMISC::CVector &bindedPos, const NLMISC::CVector &bindedTangent ) const NLMISC::CVector &bindedPos, const NLMISC::CVector &bindedTangent )
{ {
// Get the vertex to modify according to edge/startEdge // Get the vertex to modify according to edge/startEdge
@ -2836,7 +2835,7 @@ bool CExport::applyVertexBind(NL3D::CPatchInfo &pa, NL3D::CPatchInfo &oldPa, uin
// change the tangent, according to startEdge // change the tangent, according to startEdge
pa.Patch.Tangents[edgeToModify*2 + (startEdge?0:1) ]= bindedTangent; pa.Patch.Tangents[edgeToModify*2 + (startEdge?0:1) ]= bindedTangent;
// Must change the tangent which is on the other side of the vertex: // Must change the tangent which is on the other side of the vertex:
uint tgToModify= 8 + edgeToModify*2 + (startEdge?-1:+2); uint tgToModify= 8 + edgeToModify*2 + (startEdge?-1:+2);
tgToModify&=7; tgToModify&=7;
/* To keep the same continuity aspect around the vertex, we compute the original tangent in a /* To keep the same continuity aspect around the vertex, we compute the original tangent in a
@ -2862,7 +2861,7 @@ NLMISC::CVector CExport::getHeightNormal (float x, float y)
sint32 SizeX = _ZoneMaxX - _ZoneMinX + 1; sint32 SizeX = _ZoneMaxX - _ZoneMinX + 1;
sint32 SizeY = _ZoneMaxY - _ZoneMinY + 1; sint32 SizeY = _ZoneMaxY - _ZoneMinY + 1;
sint32 bmpW, bmpH; sint32 bmpW, bmpH;
// get width/height of the bitmap // get width/height of the bitmap
if (_HeightMap != NULL) if (_HeightMap != NULL)