// NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "std_afx.h" #include "nel_export.h" #include "nel/misc/file.h" #include "nel/misc/o_xml.h" #include "nel/../../src/pacs/collision_mesh_build.h" #include "nel/../../src/pacs/primitive_block.h" #include "../nel_mesh_lib/export_nel.h" #include "../nel_mesh_lib/export_appdata.h" using namespace NLMISC; using namespace NLPACS; // -------------------------------------------------- bool CNelExport::exportCollision (const char *sPath, std::vector &nodes, TimeValue time) { // get list of CMB froms nodes. std::vector > meshBuildList; if(!_ExportNel->createCollisionMeshBuildList(nodes, time, meshBuildList)) return false; // Result to return bool bRet=false; // ULONG SelectDir(HWND Parent, char* Title, char* Path); std::string path = std::string(sPath); if (path.size() == 0 || path[path.size()-1] != '\\' && path[path.size()-1] != '/') path.insert(path.end(), '/'); if (meshBuildList.empty()) return true; for (uint i=0; i &nodes, TimeValue time) { // Build the primitive block NLPACS::CPrimitiveBlock primitiveBlock; if (_ExportNel->buildPrimitiveBlock (time, nodes, primitiveBlock)) { // Open the file COFile file; if (file.open (sPath)) { // Create the XML stream COXml output; // Init if (output.init (&file, "1.0")) { // Serial it primitiveBlock.serial (output); // Ok return true; } else { nlwarning ("Can't init XML stream with file %s", sPath); } } else { nlwarning ("Can't open the file %s for writing", sPath); } } return false; }