- Timestamp:
- 04/30/07 08:16:31 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshLoader.cpp
r2127 r2341 14 14 #include <cctype> 15 15 #include <map> 16 #include "GeoLodStripsLibrary.h" 17 #include "GeoLodStripsConstructor.h" 16 18 17 19 using namespace Geometry; … … 165 167 unsigned short headerID; 166 168 size_t i; 167 //float aux;168 169 size_t k; 169 170 bool found; … … 462 463 } 463 464 464 465 465 if (idx32bit) 466 466 { … … 561 561 } 562 562 } 563 564 563 } 565 564 … … 597 596 598 597 jumpChunk(f); 599 600 598 } 601 599 } … … 606 604 void GeoMeshLoader::readSubMeshNameTable(FILE *f, Mesh *geoMesh) 607 605 { 608 unsigned short chunkID; 609 unsigned short subMeshIndex; 610 char string[255]; 611 606 unsigned short chunkID; 607 unsigned short subMeshIndex; 608 char string[255]; 609 610 if (!feof(f)) 611 { 612 chunkID = readChunk(f); 613 614 while (!feof(f) && (chunkID == M_SUBMESH_NAME_TABLE_ELEMENT)) 615 { 616 // Debug. 617 cout << " M_SUBMESH_NAME_TABLE_ELEMENT" 618 << endl; 619 620 // Read in the index of the submesh. 621 fread(&subMeshIndex,sizeof(unsigned short),1,f); 622 623 // Read in the String and map it to its index. 624 fgets(string,255,f); 625 626 string[strlen(string) - 1] = '\0'; 627 628 // Gets the submesh name. 629 strcpy(geoMesh->mSubMesh[subMeshIndex].mName,string); 630 631 cout << "--> SubMesh " 632 << subMeshIndex 633 << ": " 634 << string 635 << endl; 636 637 // If we're not end of file get the next chunk ID. 638 if (!feof(f)) 639 { 640 chunkID = readChunk(f); 641 } 642 } 612 643 if (!feof(f)) 613 644 { 614 chunkID = readChunk(f); 615 616 while (!feof(f) && (chunkID == M_SUBMESH_NAME_TABLE_ELEMENT )) 617 { 618 // Debug. 619 cout << " M_SUBMESH_NAME_TABLE_ELEMENT" 620 << endl; 621 622 // Read in the index of the submesh. 623 fread(&subMeshIndex,sizeof(unsigned short),1,f); 624 625 // Read in the String and map it to its index. 626 fgets(string,255,f); 627 628 // If we're not end of file get the next chunk ID. 629 if (!feof(f)) 630 { 631 chunkID = readChunk(f); 632 } 633 } 634 if (!feof(f)) 635 { 636 // Backpedal back to start of chunk. 637 fseek(f,-(long)CHUNK_OVERHEAD_SIZE,1); 638 } 639 } 645 // Backpedal back to start of chunk. 646 fseek(f,-(long)CHUNK_OVERHEAD_SIZE,1); 647 } 648 } 640 649 } 641 650 … … 643 652 // Read a mesh file. 644 653 //------------------------------------------------------------------------- 645 646 #include "GeoLodStripsLibrary.h"647 #include "GeoLodStripsConstructor.h"648 649 654 void GeoMeshLoader::readMesh(FILE *f, Mesh *geoMesh, int option) 650 655 { … … 667 672 chunkID = readChunk(f); 668 673 669 while(!feof(f) && 670 (chunkID == M_GEOMETRY || 671 chunkID == M_SUBMESH || 672 chunkID == M_MESH_SKELETON_LINK || 673 chunkID == M_MESH_BONE_ASSIGNMENT || 674 chunkID == M_MESH_LOD || 675 chunkID == M_MESH_BOUNDS || 676 chunkID == M_SUBMESH_NAME_TABLE || 677 chunkID == M_EDGE_LISTS || 678 chunkID == 0xabcd || 679 chunkID == 0xdcba)) 674 while (!feof(f) && 675 (chunkID == M_GEOMETRY || 676 chunkID == M_SUBMESH || 677 chunkID == M_MESH_SKELETON_LINK || 678 chunkID == M_MESH_BONE_ASSIGNMENT || 679 chunkID == M_MESH_LOD || 680 chunkID == M_MESH_BOUNDS || 681 chunkID == M_SUBMESH_NAME_TABLE || 682 chunkID == M_EDGE_LISTS || 683 chunkID == M_LODSTRIPS || 684 chunkID == M_LODTREES || 685 chunkID == M_POSES || 686 chunkID == M_ANIMATIONS)) 680 687 { 681 688 switch(chunkID) 682 689 { 683 case 0xabcd:690 case M_LODSTRIPS: 684 691 685 692 // Debug. … … 741 748 break; 742 749 743 case 0xdcba: 750 case M_LODTREES: 751 744 752 cout << "LODTREES_Chunk" << endl; 745 753 treesimpseq = new Geometry::TreeSimplificationSequence; … … 761 769 break; 762 770 763 764 771 case M_GEOMETRY: 765 772 … … 792 799 cout << " M_MESH_SKELETON_LINK " 793 800 << endl; 794 795 801 796 802 readSkeletonLink(f, geoMesh, option); … … 799 805 800 806 case M_MESH_BONE_ASSIGNMENT: 801 802 // Debug.803 //cout << " M_MESH_BONE_ASSIGNMENT "804 // << endl;805 807 806 808 readMeshBoneAssignment(f, geoMesh, option); … … 823 825 << endl; 824 826 825 //jumpChunk(f);826 827 readMeshBounds(f, geoMesh, option); 827 828 break; … … 844 845 jumpChunk(f); 845 846 break; 847 848 case M_POSES: 849 850 // Debug. 851 cout << " M_POSES " 852 << endl; 853 854 jumpChunk(f); 855 break; 856 857 case M_ANIMATIONS: 858 859 // Debug. 860 cout << " M_ANIMATIONS " 861 << endl; 862 863 jumpChunk(f); 864 break; 846 865 } 847 866 … … 866 885 } 867 886 } 868 869 } 870 887 } 871 888 872 889 //------------------------------------------------------------------------- … … 879 896 size_t strip_count; 880 897 size_t tailIndex; 881 //size_t tail;882 898 883 899 head_found = false; … … 1476 1492 { 1477 1493 fgets(geoMesh->mSkeletonName,255,f); 1494 1495 geoMesh->mSkeletonName[strlen(geoMesh->mSkeletonName) - 1] = '\0'; 1478 1496 1479 1497 geoMesh->hasSkeleton = true;
Note: See TracChangeset
for help on using the changeset viewer.