From 770ae68e66266cccfae63cf07518d6bfa0dfd105 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Mon, 7 Jun 2010 01:51:25 +0200 Subject: * Rename vmap_assembler.cpp to VMapAssembler.cpp. --HG-- branch : trunk --- src/tools/vmap3_assembler/CMakeLists.txt | 4 +- src/tools/vmap3_assembler/VMapAssembler.cpp | 120 +++++++++++++++++++++++++++ src/tools/vmap3_assembler/splitConfig.txt | 21 ----- src/tools/vmap3_assembler/vmap_assembler.cpp | 120 --------------------------- 4 files changed, 122 insertions(+), 143 deletions(-) create mode 100644 src/tools/vmap3_assembler/VMapAssembler.cpp delete mode 100644 src/tools/vmap3_assembler/splitConfig.txt delete mode 100644 src/tools/vmap3_assembler/vmap_assembler.cpp (limited to 'src') diff --git a/src/tools/vmap3_assembler/CMakeLists.txt b/src/tools/vmap3_assembler/CMakeLists.txt index fd4994b67ed..42f9a972a25 100644 --- a/src/tools/vmap3_assembler/CMakeLists.txt +++ b/src/tools/vmap3_assembler/CMakeLists.txt @@ -67,7 +67,7 @@ add_library(g3dlite ../../dep/src/g3dlite/AABox.cpp ) add_library(vmap - ../../src/shared/vmap/BIH.cpp + ../../src/shared/vmap/BoundingIntervalHierarchy.cpp ../../src/shared/vmap/VMapManager2.cpp ../../src/shared/vmap/MapTree.cpp ../../src/shared/vmap/TileAssembler.cpp @@ -77,7 +77,7 @@ add_library(vmap target_link_libraries(vmap g3dlite z) -add_executable(vmap_assembler vmap_assembler.cpp) +add_executable(vmap_assembler VMapAssembler.cpp) target_link_libraries(vmap_assembler vmap) # add_executable(vmap_test coordinate_test.cpp) diff --git a/src/tools/vmap3_assembler/VMapAssembler.cpp b/src/tools/vmap3_assembler/VMapAssembler.cpp new file mode 100644 index 00000000000..6666b54356c --- /dev/null +++ b/src/tools/vmap3_assembler/VMapAssembler.cpp @@ -0,0 +1,120 @@ +#include +#include +#include + +#include "TileAssembler.h" + +//======================================================= +// remove last return or LF and tailing SPACE +// remove all char after a # + +void chompAndTrim(std::string& str) +{ + for(unsigned int i=0;i0) { + char lc = str[str.length()-1]; + if(lc == '\r' || lc == '\n' || lc == ' ') { + str = str.substr(0,str.length()-1); + } else { + break; + } + } +} + +//======================================================= +/** +This callback method is called for each model found in the dir file. +return true if it should be included in the vmap +*/ +bool modelNameFilter(char *pName) +{ +#if 0 + bool result; + result = !Wildcard::wildcardfit("*bush[0-9]*", pName); + if(result) result = !Wildcard::wildcardfit("*shrub[0-9]*", pName); + if(result) result = !Wildcard::wildcardfit("*_Bushes_*", pName); + if(result) result = !Wildcard::wildcardfit("*_Bush_*", pName); + if(!result) { + printf("%s",pName); + } +#endif + return true; +} + +//======================================================= +/** +File contains map names that should be split into tiles +A '#' at the beginning of a line defines a comment +*/ + +/* bool readConfigFile(char *pConffile, VMAP::TileAssembler* pTa) +{ + bool result = false; + char buffer[501]; + FILE *cf = fopen(pConffile, "rb"); + if(cf) { + while(fgets(buffer, 500, cf)) { + std::string name = std::string(buffer); + size_t pos = name.find_first_not_of(' '); + name = name.substr(pos); + chompAndTrim(name); // just to be sure + if(name[0] != '#' && name.size() >0) { // comment? + unsigned int mapId = atoi(name.c_str()); + pTa->addWorldAreaMapId(mapId); + } + } + fclose(cf); + result = true; + } + return(result); +} */ +//======================================================= +int main(int argc, char* argv[]) +{ + if(argc != 3 && argc != 4) + { + printf("\nusage: %s [config file name]\n", argv[0]); + return 1; + } + + char *src = argv[1]; + char *dest = argv[2]; + char *conffile = NULL; + if(argc >= 4) + conffile = argv[3]; + + VMAP::TileAssembler* ta = new VMAP::TileAssembler(std::string(src), std::string(dest)); + ta->setModelNameFilterMethod(modelNameFilter); + + /* + All the names in the list are considered to be world maps or huge instances. + These maps will be spilt into tiles in the vmap assemble process + */ + /* if(conffile != NULL) + { + if(!readConfigFile(conffile, ta)) + { + printf("Can not open file config file: %s\n", conffile); + delete ta; + return 1; + } + } */ + + if(!ta->convertWorld2()) + { + printf("exit with errors\n"); + delete ta; + return 1; + } + + delete ta; + printf("Ok, all done\n"); + return 0; +} diff --git a/src/tools/vmap3_assembler/splitConfig.txt b/src/tools/vmap3_assembler/splitConfig.txt deleted file mode 100644 index 8d217b8e967..00000000000 --- a/src/tools/vmap3_assembler/splitConfig.txt +++ /dev/null @@ -1,21 +0,0 @@ -# list of map names - -509 #AhnQiraj -469 #BlackwingLair -189 #MonasteryInstances -030 #PVPZone01 -037 #PVPZone02 -033 #Shadowfang -533 #Stratholme Raid -209 #TanarisInstance -309 #Zul'gurub -560 #HillsbradPast -534 #HyjalPast -532 #Karazahn -543 #HellfireRampart -568 #ZulAman -564 #BlackTemple -574 #UtgardeKeep -575 #UtgardePinnacle -609 #EbonHold -628 #IsleOfConquest \ No newline at end of file diff --git a/src/tools/vmap3_assembler/vmap_assembler.cpp b/src/tools/vmap3_assembler/vmap_assembler.cpp deleted file mode 100644 index 6666b54356c..00000000000 --- a/src/tools/vmap3_assembler/vmap_assembler.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include -#include -#include - -#include "TileAssembler.h" - -//======================================================= -// remove last return or LF and tailing SPACE -// remove all char after a # - -void chompAndTrim(std::string& str) -{ - for(unsigned int i=0;i0) { - char lc = str[str.length()-1]; - if(lc == '\r' || lc == '\n' || lc == ' ') { - str = str.substr(0,str.length()-1); - } else { - break; - } - } -} - -//======================================================= -/** -This callback method is called for each model found in the dir file. -return true if it should be included in the vmap -*/ -bool modelNameFilter(char *pName) -{ -#if 0 - bool result; - result = !Wildcard::wildcardfit("*bush[0-9]*", pName); - if(result) result = !Wildcard::wildcardfit("*shrub[0-9]*", pName); - if(result) result = !Wildcard::wildcardfit("*_Bushes_*", pName); - if(result) result = !Wildcard::wildcardfit("*_Bush_*", pName); - if(!result) { - printf("%s",pName); - } -#endif - return true; -} - -//======================================================= -/** -File contains map names that should be split into tiles -A '#' at the beginning of a line defines a comment -*/ - -/* bool readConfigFile(char *pConffile, VMAP::TileAssembler* pTa) -{ - bool result = false; - char buffer[501]; - FILE *cf = fopen(pConffile, "rb"); - if(cf) { - while(fgets(buffer, 500, cf)) { - std::string name = std::string(buffer); - size_t pos = name.find_first_not_of(' '); - name = name.substr(pos); - chompAndTrim(name); // just to be sure - if(name[0] != '#' && name.size() >0) { // comment? - unsigned int mapId = atoi(name.c_str()); - pTa->addWorldAreaMapId(mapId); - } - } - fclose(cf); - result = true; - } - return(result); -} */ -//======================================================= -int main(int argc, char* argv[]) -{ - if(argc != 3 && argc != 4) - { - printf("\nusage: %s [config file name]\n", argv[0]); - return 1; - } - - char *src = argv[1]; - char *dest = argv[2]; - char *conffile = NULL; - if(argc >= 4) - conffile = argv[3]; - - VMAP::TileAssembler* ta = new VMAP::TileAssembler(std::string(src), std::string(dest)); - ta->setModelNameFilterMethod(modelNameFilter); - - /* - All the names in the list are considered to be world maps or huge instances. - These maps will be spilt into tiles in the vmap assemble process - */ - /* if(conffile != NULL) - { - if(!readConfigFile(conffile, ta)) - { - printf("Can not open file config file: %s\n", conffile); - delete ta; - return 1; - } - } */ - - if(!ta->convertWorld2()) - { - printf("exit with errors\n"); - delete ta; - return 1; - } - - delete ta; - printf("Ok, all done\n"); - return 0; -} -- cgit v1.2.3