| 564 | } |
| 565 | |
| 566 | int main(int argc, char* argv[]) { |
| 567 | #ifdef _MODEL_TOOL_GFX |
| 568 | return GFXMain(argc, argv); |
| 569 | #endif |
| 570 | |
| 571 | std::string input; |
| 572 | std::string extenstion = "OBJ"; |
| 573 | std::string output; |
| 574 | |
| 575 | if (!setupArgs(argc, argv, input, extenstion, output)) { |
| 576 | return 1; |
| 577 | } |
| 578 | |
| 579 | CModel model; |
| 580 | |
| 581 | if (TextUtils::tolower(extenstion) == "obj") { |
| 582 | readOBJ(model, input); |
| 583 | } |
| 584 | else if (TextUtils::tolower(extenstion) == "bsp") { |
| 585 | Quake3Level level; |
| 586 | level.loadFromFile(input.c_str()); |
| 587 | level.dumpToModel(model); |
| 588 | } |
| 589 | else if (TextUtils::tolower(extenstion) == "diconf") { |
| 590 | DrawInfoConfig config; |
| 591 | DrawInfoMeshes meshes; |
| 592 | parseDrawInfoConfig(config, input); |
| 593 | buildDrawInfoMeshesFromConfig(config, meshes); |
| 594 | |
| 595 | writeDrawInfoBZW(meshes, output); |
| 596 | |
| 597 | if (!meshes.valid()) { |
| 598 | printf("no valid meshes written from %s\n", input.c_str()); |
| 599 | } |
| 600 | else { |
| 601 | printf("%s file %s converted to BZW as %s\n", extenstion.c_str(), input.c_str(), output.c_str()); |
| 602 | } |
| 603 | return 0; |
| 604 | } |
| 605 | else { |
| 606 | printf("unknown input format\n"); |
| 607 | return 2; |
| 608 | } |
| 609 | |
| 610 | if (useGroundShift) { |
| 611 | model.pushAboveAxis(eZAxis); |
| 612 | } |
| 613 | |
| 614 | if (model.meshes.size() > 0) { |
| 615 | writeBZW(model, output); |
| 616 | printf("%s file %s converted to BZW as %s\n", extenstion.c_str(), input.c_str(), output.c_str()); |
| 617 | } |
| 618 | else { |
| 619 | printf("no valid meshes written from %s\n", input.c_str()); |
| 620 | } |
| 621 | |
| 622 | return 0; |
| 623 | } |
nothing calls this directly
no test coverage detected