Changeset 1559 for GTP/trunk/Lib
- Timestamp:
- 10/03/06 12:35:03 (18 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared/GTGeometry
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMeshStripifier.h
r993 r1559 399 399 void Last_Edge(int *id1, int *id2, int *id3, BOOL save); 400 400 401 void preserve_strip_orientation_with_normal( FILE *output,401 void preserve_strip_orientation_with_normal( 402 402 int vertex1, 403 403 int normal1, … … 407 407 int normal3); 408 408 409 void preserve_strip_orientation_with_texture( FILE *output,409 void preserve_strip_orientation_with_texture( 410 410 int vertex1, 411 411 int texture1, … … 415 415 int texture3); 416 416 417 void preserve_strip_orientation_with_texture_and_normal( FILE *output,417 void preserve_strip_orientation_with_texture_and_normal( 418 418 int vertex1, 419 419 int texture1, … … 426 426 int normal3); 427 427 428 void preserve_strip_orientation( FILE *output,428 void preserve_strip_orientation( 429 429 int vertex1, 430 430 int vertex2, … … 438 438 /** local.h 439 439 */ 440 void Find_StripsEx( FILE *output, int *ties, 441 int tie, int triangulate, 442 int swaps, int *next_id); 443 void SGI_Strip(int num_faces,FILE *output, int ties,int triangulate); 440 void Find_StripsEx(int *ties, int tie, int triangulate, int swaps, int *next_id); 441 void SGI_Strip(int num_faces,int ties,int triangulate); 444 442 445 443 /** outputex.h 446 444 */ 447 void Output_TriEx(int id1, int id2, int id3, FILE *output, 448 int flag,int where); 449 void Extend_BackwardsEx(int face_id, FILE *output, int *ties, 445 void Output_TriEx(int id1, int id2, int id3, int flag,int where); 446 void Extend_BackwardsEx(int face_id, int *ties, 450 447 int tie, int triangulate, 451 448 int swaps,int *next_id); 452 449 void Polygon_OutputEx(P_ADJACENCIES temp,int face_id,int bucket, 453 ListHead *pListHead, FILE *output,450 ListHead *pListHead, 454 451 int *ties, int tie,int triangulate, int swaps, 455 452 int *next_id, int where); … … 460 457 void Build_SGI_Table(int num_faces); 461 458 void Non_Blind_Triangulate( int size,int *index, 462 FILE *output,int next_face_id,459 int next_face_id, 463 460 int face_id,int where, 464 461 int color1,int color2,int color3); … … 472 469 int in_edge1, int in_edge2, 473 470 int size, int *index, 474 FILE *output,int reversed,471 int reversed, 475 472 int face_id, int where, 476 473 int color1, int color2, … … 479 476 void Triangulate( int out_edge1,int out_edge2,int in_edge1, 480 477 int in_edge2,int size,int *index, 481 FILE *output,int reversed,int face_id, int where,478 int reversed,int face_id, int where, 482 479 int color1, int color2,int color3); // static. 483 480 … … 576 573 void Triangulate_PolygonEx( int out_edge1,int out_edge2,int in_edge1, 577 574 int in_edge2,int size,int *index, 578 FILE *fp,int reversed,int face_id,575 int reversed,int face_id, 579 576 int where); 580 577 void Non_Blind_TriangulateEx( int size,int *index, 581 FILE *output,int next_face_id,578 int next_face_id, 582 579 int face_id,int where); 583 580 void Rearrange_IndexEx(int *index, int size); … … 590 587 int in_edge1, int in_edge2, 591 588 int size, int *index, 592 FILE *output,int reversed,589 int reversed, 593 590 int face_id, int where); // static. 594 591 … … 620 617 */ 621 618 void Partial_Triangulate(int size, int *index, 622 FILE *output,int next_face_id,619 int next_face_id, 623 620 int face_id, int *next_id, 624 621 ListHead *pListHead, … … 640 637 int in_edge1, int in_edge2, 641 638 int size, int *index, 642 FILE *fp,int reversed,639 int reversed, 643 640 int face_id, int *next_id, 644 641 ListHead *pListHead, … … 647 644 void P_Triangulate( int out_edge1,int out_edge2,int in_edge1, 648 645 int in_edge2, int size, int *index, 649 FILE *output,int reversed, int face_id,646 int reversed, int face_id, 650 647 int *next_id, ListHead *pListHead, 651 648 P_ADJACENCIES temp,int where); // static. … … 657 654 /** output.h 658 655 */ 659 int Finished(int *swap, FILE *output,int startnewstrip);656 int Finished(int *swap, int startnewstrip); 660 657 void Output_Tri(int id1, int id2, int id3,BOOL end); 661 int Extend_Face(int face_id,int e1,int e2,int *swaps, FILE *bands,658 int Extend_Face(int face_id,int e1,int e2,int *swaps, 662 659 int color1,int color2,int color3,int *vert_norm, 663 660 int normals,int *vert_texture,int texture); … … 665 662 int bucket, ListHead *pListHead, 666 663 BOOL first, int *swaps, 667 FILE *bands, int color1,668 int color 2, int color3,664 int color1, int color2, 665 int color3, 669 666 BOOL global, BOOL end); // static. 670 667 /** free.h … … 679 676 /** newpolve.h 680 677 */ 681 void Find_Bands(int numfaces, FILE *output_file,int *swaps, int *bands,678 void Find_Bands(int numfaces, int *swaps, int *bands, 682 679 int *cost, int *tri, int norms, int *vert_norms, 683 680 int texture, int *vert_texture); … … 698 695 void Mark_Face( PF_FACES temp2, int color1, 699 696 int color2, int color3, 700 FILE *output_file,BOOL end,697 BOOL end, 701 698 int *edge1, int *edge2, 702 699 int *face_id, int norms, … … 709 706 int north,int last_north, 710 707 int orientation,int last_left, 711 FILE *output_file,int color1,708 int color1, 712 709 int color2,int color3, 713 710 BOOL start); // static. … … 715 712 int north,int last_north, 716 713 int orientation,int last_left, 717 FILE *output_file,int color1,714 int color1, 718 715 int color2,int color3, 719 716 BOOL start, int *swaps_added, … … 722 719 /** auxiliar.h 723 720 */ 724 FILE *OpenOutputFile(char *fname);721 // FILE *OpenOutputFile(char *fname); 725 722 void AllocateStruct(int num_faces, 726 723 int num_vert, 727 724 int num_nvert, 728 725 int num_texture); 729 void miReadFile(char *fname, char *file_open, FILE *bands,Geometry::SubMesh *geoSubMesh);726 void miReadFile(char *fname, char *file_open, Geometry::SubMesh *geoSubMesh); 730 727 int stripify( char *fname, 731 728 Geometry::Mesh *geoMesh); -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshStripifier.cpp
r1530 r1559 790 790 791 791 /// preserve_strip_orientation_with_normal: 792 void CustomStripifier::preserve_strip_orientation_with_normal( FILE *output,int vertex1, int normal1, int vertex2, int normal2, int vertex3, int normal3)792 void CustomStripifier::preserve_strip_orientation_with_normal(int vertex1, int normal1, int vertex2, int normal2, int vertex3, int normal3) 793 793 { 794 794 int original_vertex[3]; … … 796 796 find_triangle_orientation(vertex1,vertex2,vertex3, original_vertex); 797 797 798 if ( ( original_vertex[0] == vertex3 && original_vertex[1] == vertex2 && original_vertex[2] == vertex1) ||798 /* if ( ( original_vertex[0] == vertex3 && original_vertex[1] == vertex2 && original_vertex[2] == vertex1) || 799 799 ( original_vertex[0] == vertex2 && original_vertex[1] == vertex1 && original_vertex[2] == vertex3 ) || 800 800 ( original_vertex[0] == vertex1 && original_vertex[1] == vertex3 && original_vertex[2] == vertex2 )) { 801 801 // New Triangle is in an opposite orientation. Add vertex2 to correct it 802 802 fprintf(output," %d//%d",vertex2,normal2); 803 } 803 }*/ 804 804 805 805 } 806 806 807 807 /// preserve_strip_orientation_with_texture: 808 void CustomStripifier::preserve_strip_orientation_with_texture( FILE *output,808 void CustomStripifier::preserve_strip_orientation_with_texture( 809 809 int vertex1, int texture1, 810 810 int vertex2, int texture2, … … 816 816 original_vertex); 817 817 818 if ( ( original_vertex[0] == vertex3 &&818 /* if ( ( original_vertex[0] == vertex3 && 819 819 original_vertex[1] == vertex2 && 820 820 original_vertex[2] == vertex1 ) || … … 825 825 original_vertex[1] == vertex3 && 826 826 original_vertex[2] == vertex2 ) ) { 827 / * New Triangle is in an opposite orientation */828 / * Add vertex2 to correct it */827 // New Triangle is in an opposite orientation 828 // Add vertex2 to correct it 829 829 fprintf(output," %d/%d",vertex2,texture2); 830 } 830 }*/ 831 831 } 832 832 833 833 /// preserve_strip_orientation_with_texture_and_normal: 834 void CustomStripifier::preserve_strip_orientation_with_texture_and_normal( FILE *output,834 void CustomStripifier::preserve_strip_orientation_with_texture_and_normal( 835 835 int vertex1, int texture1, int normal1, 836 836 int vertex2, int texture2, int normal2, … … 842 842 original_vertex); 843 843 844 if ( ( original_vertex[0] == vertex3 &&844 /* if ( ( original_vertex[0] == vertex3 && 845 845 original_vertex[1] == vertex2 && 846 846 original_vertex[2] == vertex1 ) || … … 851 851 original_vertex[1] == vertex3 && 852 852 original_vertex[2] == vertex2 ) ) { 853 / * New Triangle is in an opposite orientation */854 / * Add vertex2 to correct it */853 // New Triangle is in an opposite orientation 854 // Add vertex2 to correct it 855 855 fprintf(output," %d/%d/%d",vertex2,texture2,normal2); 856 } 856 }*/ 857 857 } 858 858 859 859 /// preserve_strip_orientation: 860 void CustomStripifier::preserve_strip_orientation( FILE *output,int vertex1, int vertex2,int vertex3)860 void CustomStripifier::preserve_strip_orientation(int vertex1, int vertex2,int vertex3) 861 861 { 862 862 int original_vertex[3]; … … 874 874 original_vertex[1] == vertex3 && 875 875 original_vertex[2] == vertex2 )) { 876 / * New Triangle is in an opposite orientation */877 / * Add vertex2 to correct it */878 fprintf(output," %d",vertex2);876 // New Triangle is in an opposite orientation 877 // Add vertex2 to correct it 878 // fprintf(output," %d",vertex2); 879 879 mi_vector[num_tiras].push_back(vertex2-1); 880 880 } … … 882 882 883 883 /// Output_TriEx: 884 void CustomStripifier::Output_TriEx(int id1, int id2, int id3, FILE *output, 885 int flag, int where) 884 void CustomStripifier::Output_TriEx(int id1, int id2, int id3, int flag, int where) 886 885 { 887 886 /* We will save everything into a list, rather than output at once, … … 911 910 */ 912 911 { 913 fprintf(output,"\nt");912 // fprintf(output,"\nt"); 914 913 mi_vector_tipo nada; 915 914 mi_vector.push_back(nada); 916 915 num_tiras++; 917 tri = tri + Finished(&swap, output,1);916 tri = tri + Finished(&swap,1); 918 917 total = total + swap; 919 918 strips++; … … 931 930 932 931 /// Extend_BackwardsEx: 933 void CustomStripifier::Extend_BackwardsEx(int face_id, FILE *output,int *ties,932 void CustomStripifier::Extend_BackwardsEx(int face_id, int *ties, 934 933 int tie, int triangulate, 935 934 int swaps,int *next_id) … … 981 980 Last_Edge(&z,&y,&x,1); 982 981 Polygon_OutputEx(temp,temp->face_id,bucket,pListFace, 983 output,ties,tie,triangulate,982 ties,tie,triangulate, 984 983 swaps,next_id,0); 985 984 return; … … 1011 1010 Last_Edge(&z,&y,&x,1); 1012 1011 Polygon_OutputEx(temp,temp->face_id,bucket,pListFace, 1013 output,ties,tie,triangulate,1012 ties,tie,triangulate, 1014 1013 swaps,next_id,0); 1015 1014 return; … … 1028 1027 /// Polygon_OutputEx: 1029 1028 void CustomStripifier::Polygon_OutputEx(P_ADJACENCIES temp,int face_id,int bucket, 1030 ListHead *pListHead, FILE *output,1029 ListHead *pListHead, 1031 1030 int *ties, int tie, 1032 1031 int triangulate, int swaps, … … 1069 1068 } 1070 1069 1071 Output_TriEx(e2,e3,next_face_id, NULL,begin,where);1070 Output_TriEx(e2,e3,next_face_id,begin,where); 1072 1071 if (face_array[temp->face_id].head == pListHead) 1073 1072 face_array[temp->face_id].pfNode = NULL; … … 1098 1097 if (next_face_id == -1) 1099 1098 { 1100 Polygon_OutputEx(temp,face_id,0,pListHead, output,ties,tie,1099 Polygon_OutputEx(temp,face_id,0,pListHead,ties,tie, 1101 1100 triangulate,swaps,next_id,where); 1102 1101 return; … … 1131 1130 else 1132 1131 { 1133 Polygon_OutputEx(temp,face_id,0,pListHead, output,1132 Polygon_OutputEx(temp,face_id,0,pListHead, 1134 1133 ties,tie,triangulate,swaps,next_id,where); 1135 1134 return; … … 1147 1146 { 1148 1147 /* Degenerate triangle just return*/ 1149 Output_TriEx(other1,other2,e3, NULL,begin,where);1148 Output_TriEx(other1,other2,e3,begin,where); 1150 1149 if (face_array[temp->face_id].head == pListHead) 1151 1150 face_array[temp->face_id].pfNode = NULL; … … 1171 1170 have the next polygon id 1172 1171 */ 1173 Output_TriEx(other1,other2,e3, NULL,begin,where);1172 Output_TriEx(other1,other2,e3,begin,where); 1174 1173 if (face_array[temp->face_id].head == pListHead) 1175 1174 face_array[temp->face_id].pfNode = NULL; … … 1189 1188 } 1190 1189 Polygon_OutputEx(lpListInfo,next_face_id,next_bucket, 1191 pListHead, output,ties,tie,1190 pListHead, ties,tie, 1192 1191 triangulate,swaps,next_id,where); 1193 1192 … … 1242 1241 { 1243 1242 /* There is no sequential face to go to, end the strip */ 1244 Polygon_OutputEx(temp,face_id,0,pListHead, output,1243 Polygon_OutputEx(temp,face_id,0,pListHead, 1245 1244 ties,tie,triangulate,swaps,next_id,where); 1246 1245 return; … … 1251 1250 next_face_id = Get_Next_Face(tie,face_id,triangulate); 1252 1251 Non_Blind_TriangulateEx(face->nPolSize,face->pPolygon, 1253 output,next_face_id,face_id,where);1252 next_face_id,face_id,where); 1254 1253 1255 1254 if (face_array[temp->face_id].head == pListHead) … … 1270 1269 next_face_id = Get_Next_Face(tie,face_id,triangulate); 1271 1270 Partial_Triangulate(face->nPolSize,face->pPolygon, 1272 output,next_face_id,face_id,next_id,1271 next_face_id,face_id,next_id, 1273 1272 pListHead,temp,where); 1274 1273 /* Check the next bucket again ,maybe it changed … … 1310 1309 } 1311 1310 Polygon_OutputEx(lpListInfo,next_face_id,next_bucket, 1312 pListHead, output,ties,tie,1311 pListHead, ties,tie, 1313 1312 triangulate,swaps,next_id,where); 1314 1313 } … … 1338 1337 if (Done(next_face_id,&next_bucket) == NULL) 1339 1338 { 1340 Polygon_OutputEx(temp,face_id,0,pListHead, output,ties,tie,1339 Polygon_OutputEx(temp,face_id,0,pListHead,ties,tie, 1341 1340 triangulate,swaps,next_id,where); 1342 1341 /* Because maybe there was more than 2 polygons on the edge */ … … 1349 1348 1350 1349 Non_Blind_TriangulateEx(face->nPolSize,face->pPolygon, 1351 output,next_face_id,face_id,where);1350 next_face_id,face_id,where); 1352 1351 1353 1352 if (face_array[temp->face_id].head == pListHead) … … 1365 1364 } 1366 1365 Polygon_OutputEx(lpListInfo,next_face_id,next_bucket, 1367 pListHead, output,ties,tie,1366 pListHead, ties,tie, 1368 1367 triangulate,swaps,next_id,where); 1369 1368 } … … 1696 1695 int in_edge1, int in_edge2, 1697 1696 int size, int *index, 1698 FILE *output,int reversed,1697 int reversed, 1699 1698 int face_id, int where, 1700 1699 int color1, int color2, … … 1743 1742 Delete_From_List(out_edge2,index,&size); 1744 1743 Triangulate_Polygon(out_edge1,vertex4,in_edge2, 1745 vertex4,size-1,index, output,reversed,face_id,1744 vertex4,size-1,index,reversed,face_id, 1746 1745 where,color1,color2,color3); 1747 1746 memcpy(index,temp,sizeof(int)*size); … … 1780 1779 Delete_From_List(in_edge1,index,&size); 1781 1780 Triangulate_Polygon(out_edge1,out_edge2,in_edge2, 1782 vertex4,size-1,index, output,!reversed,face_id,1781 vertex4,size-1,index,!reversed,face_id, 1783 1782 where,color1,color2,color3); 1784 1783 memcpy(index,temp,sizeof(int)*size); … … 1806 1805 Delete_From_List(in_edge2,index,&size); 1807 1806 Triangulate_Polygon(out_edge1,out_edge2,in_edge1, 1808 vertex4,size-1,index, output,reversed,face_id,1807 vertex4,size-1,index,reversed,face_id, 1809 1808 where,color1,color2,color3); 1810 1809 memcpy(index,temp,sizeof(int)*size); … … 1821 1820 Delete_From_List(in_edge2,index,&size); 1822 1821 Triangulate_Polygon(out_edge1,out_edge2,in_edge1, 1823 vertex4,size-1,index, output,reversed,face_id,1822 vertex4,size-1,index,reversed,face_id, 1824 1823 where,color1,color2,color3); 1825 1824 memcpy(index,temp,sizeof(int)*size); … … 1835 1834 Delete_From_List(in_edge1,index,&size); 1836 1835 Triangulate_Polygon(out_edge1,out_edge2,vertex4, 1837 in_edge2,size-1,index, output,reversed,face_id,1836 in_edge2,size-1,index,reversed,face_id, 1838 1837 where,color1,color2,color3); 1839 1838 memcpy(index,temp,sizeof(int)*size); … … 1854 1853 Delete_From_List(in_edge1,index,&size); 1855 1854 Triangulate_Polygon(out_edge1,out_edge2,in_edge2, 1856 vertex4,size-1,index, output,!reversed,face_id,1855 vertex4,size-1,index,!reversed,face_id, 1857 1856 where,color1,color2,color3); 1858 1857 memcpy(index,temp,sizeof(int)*size); … … 1864 1863 void CustomStripifier::Triangulate(int out_edge1,int out_edge2,int in_edge1, 1865 1864 int in_edge2,int size,int *index, 1866 FILE *output,int reversed,int face_id, int where,1865 int reversed,int face_id, int where, 1867 1866 int color1, int color2,int color3) 1868 1867 { … … 1874 1873 else 1875 1874 Triangulate_Polygon(out_edge1,out_edge2,in_edge1,in_edge2,size, 1876 index, output,reversed,face_id,where,color1,color2,color3);1875 index,reversed,face_id,where,color1,color2,color3); 1877 1876 } 1878 1877 1879 1878 /// Non_Blind_Triangulate: 1880 1879 void CustomStripifier::Non_Blind_Triangulate(int size,int *index, 1881 FILE *output,int next_face_id,int face_id,int where, 1882 int color1,int color2,int color3) 1880 int next_face_id,int face_id,int where,int color1,int color2,int color3) 1883 1881 { 1884 1882 int id1,id2,id3; … … 1908 1906 since we are at the beginning of a strip 1909 1907 */ 1910 Triangulate(nedge1,nedge2,id2,id3,size,index, output,reversed,1908 Triangulate(nedge1,nedge2,id2,id3,size,index,reversed, 1911 1909 face_id, where,color1,color2,color3); 1912 1910 } … … 4090 4088 vertex4 = AdjacentEx(out_edge1,out_edge2,index,size); 4091 4089 vertex5 = Get_Other_Vertex(vertex4,out_edge1,out_edge2,index); 4092 Output_TriEx(vertex5,vertex4,out_edge1, NULL,-1,where);4093 Output_TriEx(vertex4,out_edge1,out_edge2, NULL,-1,where);4090 Output_TriEx(vertex5,vertex4,out_edge1,-1,where); 4091 Output_TriEx(vertex4,out_edge1,out_edge2,-1,where); 4094 4092 return; 4095 4093 } … … 4108 4106 */ 4109 4107 vertex4 = Get_Other_Vertex(in_edge1,in_edge2,out_edge2,index); 4110 Output_TriEx(in_edge1,in_edge2,vertex4, NULL,-1,where);4111 Output_TriEx(vertex4,in_edge2,out_edge2, NULL,-1,where);4108 Output_TriEx(in_edge1,in_edge2,vertex4,-1,where); 4109 Output_TriEx(vertex4,in_edge2,out_edge2,-1,where); 4112 4110 return; 4113 4111 } … … 4126 4124 */ 4127 4125 vertex4 = Get_Other_Vertex(in_edge2,in_edge1,out_edge2,index); 4128 Output_TriEx(in_edge2,in_edge1,vertex4, NULL,-1,where);4129 Output_TriEx(vertex4,in_edge1,out_edge2, NULL,-1,where);4126 Output_TriEx(in_edge2,in_edge1,vertex4,-1,where); 4127 Output_TriEx(vertex4,in_edge1,out_edge2,-1,where); 4130 4128 return; 4131 4129 } … … 4135 4133 { 4136 4134 vertex4 = Get_Other_Vertex(in_edge1,in_edge2,out_edge1,index); 4137 Output_TriEx(in_edge2,in_edge1,vertex4, NULL,-1,where);4138 Output_TriEx(vertex4,in_edge1,out_edge1, NULL,-1,where);4135 Output_TriEx(in_edge2,in_edge1,vertex4,-1,where); 4136 Output_TriEx(vertex4,in_edge1,out_edge1,-1,where); 4139 4137 return; 4140 4138 } … … 4142 4140 { 4143 4141 vertex4 = Get_Other_Vertex(in_edge1,in_edge2,out_edge1,index); 4144 Output_TriEx(in_edge1,in_edge2,vertex4, NULL,-1,where);4145 Output_TriEx(vertex4,in_edge2,out_edge1, NULL,-1,where);4142 Output_TriEx(in_edge1,in_edge2,vertex4,-1,where); 4143 Output_TriEx(vertex4,in_edge2,out_edge1,-1,where); 4146 4144 return; 4147 4145 } … … 4159 4157 And also the output edge, so that we triangulate correctly. 4160 4158 */ 4161 Output_TriEx(in_edge1,in_edge2,out_edge2, NULL,-1,where);4162 Output_TriEx(in_edge2,out_edge2,out_edge1, NULL,-1,where);4159 Output_TriEx(in_edge1,in_edge2,out_edge2,-1,where); 4160 Output_TriEx(in_edge2,out_edge2,out_edge1,-1,where); 4163 4161 } 4164 4162 else … … 4167 4165 be reversed from above. 4168 4166 */ 4169 Output_TriEx(in_edge1,in_edge2,out_edge1, NULL,-1,where);4170 Output_TriEx(in_edge2,out_edge1,out_edge2, NULL,-1,where);4167 Output_TriEx(in_edge1,in_edge2,out_edge1,-1,where); 4168 Output_TriEx(in_edge2,out_edge1,out_edge2,-1,where); 4171 4169 } 4172 4170 return; … … 4178 4176 int in_edge1, int in_edge2, 4179 4177 int size, int *index, 4180 FILE *fp,int reversed,4178 int reversed, 4181 4179 int face_id, int where) 4182 4180 { … … 4224 4222 Triangulate_PolygonEx(out_edge1,vertex4,in_edge2, 4225 4223 vertex4,size-1,index, 4226 fp,reversed,face_id,where);4224 reversed,face_id,where); 4227 4225 memcpy(index,temp,sizeof(int)*size); 4228 4226 /* Lastly do the triangle that comes out the output 4229 4227 edge. 4230 4228 */ 4231 Output_TriEx(vertex4,out_edge1,out_edge2, NULL,-1,where);4229 Output_TriEx(vertex4,out_edge1,out_edge2,-1,where); 4232 4230 return; 4233 4231 } … … 4252 4250 */ 4253 4251 vertex4 = AdjacentEx(in_edge2,in_edge1,index,size); 4254 Output_TriEx(in_edge1,in_edge2,vertex4, NULL,-1,where);4252 Output_TriEx(in_edge1,in_edge2,vertex4,-1,where); 4255 4253 /* Create a new edgelist without the triangle that 4256 4254 was just outputted. … … 4260 4258 Delete_From_ListEx(in_edge1,index,size); 4261 4259 Triangulate_PolygonEx(out_edge1,out_edge2,in_edge2, 4262 vertex4,size-1,index, fp,4260 vertex4,size-1,index, 4263 4261 !reversed,face_id,where); 4264 4262 memcpy(index,temp,sizeof(int)*size); … … 4275 4273 /* Get vertex adjacent to in_edge2, but is not in_edge1 */ 4276 4274 vertex4 = AdjacentEx(in_edge1,in_edge2,index,size); 4277 Output_TriEx(in_edge1,in_edge2,vertex4, fp,-1,where);4275 Output_TriEx(in_edge1,in_edge2,vertex4,-1,where); 4278 4276 /* Since that triangle goes out of the polygon (the 4279 4277 output edge of it), we can make our new input edge … … 4286 4284 Delete_From_ListEx(in_edge2,index,size); 4287 4285 Triangulate_PolygonEx(out_edge1,out_edge2,in_edge1, 4288 vertex4,size-1,index, fp,4286 vertex4,size-1,index, 4289 4287 reversed,face_id,where); 4290 4288 memcpy(index,temp,sizeof(int)*size); … … 4296 4294 /* Get vertex adjacent to in_edge2, but is not in_edge1 */ 4297 4295 vertex4 = AdjacentEx(in_edge1,in_edge2,index,size); 4298 Output_TriEx(in_edge2,in_edge1,vertex4, fp,-1,where);4296 Output_TriEx(in_edge2,in_edge1,vertex4,-1,where); 4299 4297 temp = (int *) malloc(sizeof(int) * size); 4300 4298 memcpy(temp,index,sizeof(int)*size); 4301 4299 Delete_From_ListEx(in_edge2,index,size); 4302 4300 Triangulate_PolygonEx(out_edge1,out_edge2,in_edge1, 4303 vertex4,size-1,index, fp,4301 vertex4,size-1,index, 4304 4302 reversed,face_id,where); 4305 4303 memcpy(index,temp,sizeof(int)*size); … … 4310 4308 /* Get vertex adjacent to in_edge2, but is not in_edge1 */ 4311 4309 vertex4 = AdjacentEx(in_edge2,in_edge1,index,size); 4312 Output_TriEx(in_edge1,in_edge2,vertex4, fp,-1,where);4310 Output_TriEx(in_edge1,in_edge2,vertex4,-1,where); 4313 4311 temp = (int *) malloc(sizeof(int) * size); 4314 4312 memcpy(temp,index,sizeof(int)*size); 4315 4313 Delete_From_ListEx(in_edge1,index,size); 4316 4314 Triangulate_PolygonEx(out_edge1,out_edge2,vertex4, 4317 in_edge2,size-1,index, fp,4315 in_edge2,size-1,index, 4318 4316 reversed,face_id,where); 4319 4317 memcpy(index,temp,sizeof(int)*size); … … 4329 4327 { 4330 4328 vertex4 = AdjacentEx(in_edge2,in_edge1,index,size); 4331 Output_TriEx(in_edge1,in_edge2,vertex4, fp,-1,where);4329 Output_TriEx(in_edge1,in_edge2,vertex4,-1,where); 4332 4330 temp = (int *) malloc(sizeof(int) * size); 4333 4331 memcpy(temp,index,sizeof(int)*size); 4334 4332 Delete_From_ListEx(in_edge1,index,size); 4335 4333 Triangulate_PolygonEx(out_edge1,out_edge2,in_edge2, 4336 vertex4,size-1,index, fp,4334 vertex4,size-1,index, 4337 4335 !reversed,face_id,where); 4338 4336 memcpy(index,temp,sizeof(int)*size); … … 4344 4342 void CustomStripifier::TriangulateEx(int out_edge1,int out_edge2,int in_edge1, 4345 4343 int in_edge2,int size,int *index, 4346 FILE *output,int reversed,int face_id, int where)4344 int reversed,int face_id, int where) 4347 4345 { 4348 4346 /* We have the info we need to triangulate a polygon */ … … 4353 4351 else 4354 4352 Triangulate_PolygonEx(out_edge1,out_edge2,in_edge1,in_edge2,size, 4355 index, output,reversed,face_id,where);4353 index,reversed,face_id,where); 4356 4354 } 4357 4355 4358 4356 /// Non_Blind_TriangulateEx: 4359 4357 void CustomStripifier::Non_Blind_TriangulateEx(int size,int *index, 4360 FILE *output,int next_face_id,int face_id,int where)4358 int next_face_id,int face_id,int where) 4361 4359 { 4362 4360 int id1,id2,id3; … … 4386 4384 since we are at the beginning of a strip 4387 4385 */ 4388 TriangulateEx(nedge1,nedge2,id2,id3,size,index, output,reversed,4386 TriangulateEx(nedge1,nedge2,id2,id3,size,index,reversed, 4389 4387 face_id, where); 4390 4388 } … … 4511 4509 if (( (!begin) && (*(index) == e2) ) || (begin)) 4512 4510 { 4513 Output_TriEx(*(index+0),*(index+1),*(index+size-1), NULL,-1,where);4511 Output_TriEx(*(index+0),*(index+1),*(index+size-1),-1,where); 4514 4512 /* If we have a quad, (chances are yes), then we know that 4515 4513 we can just add one diagonal and be done. (divide the … … 4518 4516 if (size == 4) 4519 4517 { 4520 Output_TriEx(*(index+1),*(index+size-1),*(index+2), NULL,-1,where);4518 Output_TriEx(*(index+1),*(index+size-1),*(index+2),-1,where); 4521 4519 return; 4522 4520 } … … 4527 4525 else if (!begin) 4528 4526 { 4529 Output_TriEx(*(index+1),*(index+0),*(index+size-1), NULL,-1,where);4527 Output_TriEx(*(index+1),*(index+0),*(index+size-1),-1,where); 4530 4528 if (size == 4) 4531 4529 { 4532 Output_TriEx(*(index+0),*(index+size-1),*(index+2), NULL,-1,where);4530 Output_TriEx(*(index+0),*(index+size-1),*(index+2),-1,where); 4533 4531 return; 4534 4532 } 4535 Output_TriEx(*(index+0),*(index+size-1),*(index+2), NULL,-1,where);4533 Output_TriEx(*(index+0),*(index+size-1),*(index+2),-1,where); 4536 4534 increasing = 2; 4537 4535 mode = 0; … … 4550 4548 { 4551 4549 Output_TriEx(*(index+increasing),*(index+decreasing), 4552 *(index+increasing+1), NULL,-1,where);4550 *(index+increasing+1),-1,where); 4553 4551 increasing++; 4554 4552 } … … 4556 4554 { 4557 4555 Output_TriEx(*(index+decreasing),*(index+increasing), 4558 *(index+decreasing-1), NULL,-1,where);4556 *(index+decreasing-1),-1,where); 4559 4557 decreasing--; 4560 4558 } … … 5107 5105 5108 5106 /// Find_StripsEx: 5109 void CustomStripifier::Find_StripsEx( FILE *output,int *ties,5107 void CustomStripifier::Find_StripsEx(int *ties, 5110 5108 int tie, int triangulate, 5111 5109 int swaps,int *next_id) … … 5142 5140 } 5143 5141 5144 Polygon_OutputEx(temp,temp->face_id,bucket,pListHead, output,ties,tie,triangulate,swaps,next_id,1);5142 Polygon_OutputEx(temp,temp->face_id,bucket,pListHead,ties,tie,triangulate,swaps,next_id,1); 5145 5143 /* Try to extend backwards, if the starting polygon in the 5146 5144 strip had 2 or more adjacencies to begin with 5147 5145 */ 5148 5146 if (bucket >= 2) 5149 Extend_BackwardsEx(temp->face_id, output,ties,tie, triangulate,swaps,next_id);5147 Extend_BackwardsEx(temp->face_id,ties,tie, triangulate,swaps,next_id); 5150 5148 5151 5149 break; … … 5162 5160 else 5163 5161 { 5164 Output_TriEx(-1,-2,-3, output,-10,1);5162 Output_TriEx(-1,-2,-3,-10,1); 5165 5163 Last_Edge(&dummy,&dummy,&dummy,1); 5166 5164 cont++; … … 5171 5169 5172 5170 /// SGI_Strip: 5173 void CustomStripifier::SGI_Strip(int num_faces, 5174 FILE *output, 5175 int ties, 5176 int triangulate) 5171 void CustomStripifier::SGI_Strip(int num_faces, int ties, int triangulate) 5177 5172 { 5178 5173 int next_id = -1,t=0; … … 5203 5198 */ 5204 5199 5205 Find_StripsEx( output,&t,ties,triangulate,ON,&next_id);5200 Find_StripsEx(&t,ties,triangulate,ON,&next_id); 5206 5201 5207 5202 } … … 5241 5236 vertex4 = AdjacentEx(out_edge1,out_edge2,index,size); 5242 5237 vertex5 = Get_Other_Vertex(vertex4,out_edge1,out_edge2,index); 5243 Output_TriEx(vertex5,vertex4,out_edge1, NULL,-1,where);5244 Output_TriEx(vertex4,out_edge1,out_edge2, NULL,-1,where);5238 Output_TriEx(vertex5,vertex4,out_edge1,-1,where); 5239 Output_TriEx(vertex4,out_edge1,out_edge2,-1,where); 5245 5240 dummy = Update_AdjacenciesEx(face_id, &dummy, &dummy,&dummy,&dummy); 5246 5241 … … 5263 5258 */ 5264 5259 vertex4 = Get_Other_Vertex(in_edge1,in_edge2,out_edge2,index); 5265 Output_TriEx(in_edge1,in_edge2,out_edge2, NULL,-1,where);5260 Output_TriEx(in_edge1,in_edge2,out_edge2,-1,where); 5266 5261 /* Now we have a triangle used, and a triangle that is 5267 5262 left for later. … … 5299 5294 */ 5300 5295 vertex4 = Get_Other_Vertex(in_edge1,in_edge2,out_edge2,index); 5301 Output_TriEx(in_edge2,in_edge1,out_edge2, NULL,-1,where);5296 Output_TriEx(in_edge2,in_edge1,out_edge2,-1,where); 5302 5297 /* Now we have a triangle used, and a triangle that is 5303 5298 left for later. … … 5327 5322 { 5328 5323 vertex4 = Get_Other_Vertex(in_edge1,in_edge2,out_edge1,index); 5329 Output_TriEx(in_edge2,in_edge1,out_edge1, NULL,-1,where);5324 Output_TriEx(in_edge2,in_edge1,out_edge1,-1,where); 5330 5325 /* Now we have a triangle used, and a triangle that is 5331 5326 left for later. … … 5353 5348 { 5354 5349 vertex4 = Get_Other_Vertex(in_edge1,in_edge2,out_edge1,index); 5355 Output_TriEx(in_edge1,in_edge2,out_edge1, NULL,-1,where);5350 Output_TriEx(in_edge1,in_edge2,out_edge1,-1,where); 5356 5351 /* Now we have a triangle used, and a triangle that is 5357 5352 left for later. … … 5391 5386 correctly. Does not need partial. 5392 5387 */ 5393 Output_TriEx(in_edge1,in_edge2,out_edge2, NULL,-1,where);5394 Output_TriEx(in_edge2,out_edge2,out_edge1, NULL,-1,where);5388 Output_TriEx(in_edge1,in_edge2,out_edge2,-1,where); 5389 Output_TriEx(in_edge2,out_edge2,out_edge1,-1,where); 5395 5390 dummy = Update_AdjacenciesEx(face_id, &dummy, &dummy,&dummy,&dummy); 5396 5391 … … 5404 5399 be reversed from above. 5405 5400 */ 5406 Output_TriEx(in_edge1,in_edge2,out_edge1, NULL,-1,where);5407 Output_TriEx(in_edge2,out_edge1,out_edge2, NULL,-1,where);5401 Output_TriEx(in_edge1,in_edge2,out_edge1,-1,where); 5402 Output_TriEx(in_edge2,out_edge1,out_edge2,-1,where); 5408 5403 dummy = Update_AdjacenciesEx(face_id, &dummy, &dummy,&dummy,&dummy); 5409 5404 … … 5420 5415 int in_edge1, int in_edge2, 5421 5416 int size, int *index, 5422 FILE *fp,int reversed,5417 int reversed, 5423 5418 int face_id, int *next_id, 5424 5419 ListHead *pListHead, … … 5463 5458 */ 5464 5459 Triangulate_PolygonEx(vertex4,out_edge1,in_edge2, 5465 vertex4,size-1,index, fp,5460 vertex4,size-1,index, 5466 5461 reversed,face_id, 5467 5462 where); … … 5470 5465 edge. 5471 5466 */ 5472 Output_TriEx(vertex4,out_edge1,out_edge2, NULL,-1,where);5467 Output_TriEx(vertex4,out_edge1,out_edge2,-1,where); 5473 5468 /* We were able to do the whole polygon, now we 5474 5469 can delete the whole thing from our data structure. … … 5490 5485 if (in_edge2 == out_edge1) 5491 5486 { 5492 Output_TriEx(in_edge1,out_edge1,out_edge2, NULL,-1,where);5487 Output_TriEx(in_edge1,out_edge1,out_edge2,-1,where); 5493 5488 5494 5489 /* Now delete the adjacencies by one for all the faces … … 5525 5520 { 5526 5521 /* Get vertex adjacent to in_edge2, but is not in_edge1 */ 5527 Output_TriEx(in_edge2,in_edge1,out_edge2, NULL,-1,where);5522 Output_TriEx(in_edge2,in_edge1,out_edge2,-1,where); 5528 5523 5529 5524 /* Now delete the adjacencies by one for all the faces … … 5555 5550 else if (in_edge1 == out_edge2) 5556 5551 { 5557 Output_TriEx(in_edge2,in_edge1,out_edge1, NULL,-1,where);5552 Output_TriEx(in_edge2,in_edge1,out_edge1,-1,where); 5558 5553 5559 5554 /* Now delete the adjacencies by one for all the faces … … 5583 5578 else if (in_edge2 == out_edge2) 5584 5579 { 5585 Output_TriEx(in_edge1,in_edge2,out_edge1, NULL,-1,where);5580 Output_TriEx(in_edge1,in_edge2,out_edge1,-1,where); 5586 5581 5587 5582 /* Now delete the adjacencies by one for all the faces … … 5620 5615 { 5621 5616 vertex4 = AdjacentEx(in_edge2,in_edge1,index,size); 5622 Output_TriEx(in_edge1,in_edge2,vertex4, NULL,-1,where);5617 Output_TriEx(in_edge1,in_edge2,vertex4,-1,where); 5623 5618 5624 5619 /* Now delete the adjacencies by one for all the faces … … 5660 5655 5661 5656 P_Triangulate_Polygon(out_edge1,out_edge2,in_edge2, 5662 vertex4,size-1,index, fp,!reversed,5657 vertex4,size-1,index,!reversed, 5663 5658 face_id,next_id,pListHead,temp2,where); 5664 5659 } … … 5666 5661 { 5667 5662 vertex4 = AdjacentEx(in_edge1,in_edge2,index,size); 5668 Output_TriEx(in_edge2,in_edge1,vertex4, NULL,-1,where);5663 Output_TriEx(in_edge2,in_edge1,vertex4,-1,where); 5669 5664 5670 5665 /* Now delete the adjacencies by one for all the faces … … 5707 5702 5708 5703 P_Triangulate_Polygon(out_edge1,out_edge2,vertex4, 5709 in_edge1,size-1,index, fp,!reversed,5704 in_edge1,size-1,index,!reversed, 5710 5705 face_id,next_id,pListHead,temp2,where); 5711 5706 } … … 5717 5712 void CustomStripifier::P_Triangulate( int out_edge1,int out_edge2,int in_edge1, 5718 5713 int in_edge2, int size, int *index, 5719 FILE *output,int reversed, int face_id,5714 int reversed, int face_id, 5720 5715 int *next_id, ListHead *pListHead, 5721 5716 P_ADJACENCIES temp,int where) … … 5728 5723 else 5729 5724 P_Triangulate_Polygon(out_edge1,out_edge2,in_edge1,in_edge2,size, 5730 index, output,reversed,face_id,next_id,5725 index,reversed,face_id,next_id, 5731 5726 pListHead,temp,where); 5732 5727 } 5733 5728 5734 5729 void CustomStripifier::Partial_Triangulate(int size,int *index, 5735 FILE *output,int next_face_id,int face_id,5730 int next_face_id,int face_id, 5736 5731 int *next_id,ListHead *pListHead, 5737 5732 P_ADJACENCIES temp, int where) … … 5768 5763 5769 5764 /* Do the triangulation */ 5770 P_Triangulate(nedge1,nedge2,id2,id3,size,index, output,reversed,5765 P_Triangulate(nedge1,nedge2,id2,id3,size,index,reversed, 5771 5766 face_id,next_id,pListHead,temp,where); 5772 5767 } … … 5789 5784 if (vertex4 == output1) 5790 5785 { 5791 Output_TriEx(in_edge2,in_edge1,output1, NULL,-1,where);5786 Output_TriEx(in_edge2,in_edge1,output1,-1,where); 5792 5787 /* Now delete the adjacencies by one for all the faces 5793 5788 that are adjacent to the triangle that we just outputted. … … 5809 5804 else if (vertex5 == output1) 5810 5805 { 5811 Output_TriEx(in_edge1,in_edge2,vertex5, NULL,-1,where);5806 Output_TriEx(in_edge1,in_edge2,vertex5,-1,where); 5812 5807 /* Now delete the adjacencies by one for all the faces 5813 5808 that are adjacent to the triangle that we just outputted. … … 5868 5863 5869 5864 /// Finished: 5870 int CustomStripifier::Finished(int *swap, FILE *output,int startnewstrip)5865 int CustomStripifier::Finished(int *swap, int startnewstrip) 5871 5866 { 5872 5867 /* We have finished all the triangles, now is time to output to … … 5907 5902 if ((norm) && (!cptexture)) { 5908 5903 if (startnewstrip && orient) // If we want to keep orientation 5909 preserve_strip_orientation_with_normal( output,temp3->face_id+1,vn[temp3->face_id]+1,5904 preserve_strip_orientation_with_normal(temp3->face_id+1,vn[temp3->face_id]+1, 5910 5905 temp2->face_id+1,vn[temp2->face_id]+1, temp1->face_id+1,vn[temp1->face_id]+1); 5911 5906 5912 fprintf(output," %d//%d %d//%d %d//%d", temp3->face_id+1,vn[temp3->face_id]+1,5913 temp2->face_id+1,vn[temp2->face_id]+1, temp1->face_id+1,vn[temp1->face_id]+1); 5907 /* fprintf(output," %d//%d %d//%d %d//%d", temp3->face_id+1,vn[temp3->face_id]+1, 5908 temp2->face_id+1,vn[temp2->face_id]+1, temp1->face_id+1,vn[temp1->face_id]+1);*/ 5914 5909 } 5915 5910 else if ((cptexture) && (!norm)) { 5916 5911 if (startnewstrip && orient) /* If we want to keep orientation */ 5917 preserve_strip_orientation_with_texture( output,temp3->face_id+1,vt[temp3->face_id]+1,5912 preserve_strip_orientation_with_texture(temp3->face_id+1,vt[temp3->face_id]+1, 5918 5913 temp2->face_id+1,vt[temp2->face_id]+1, temp1->face_id+1,vt[temp1->face_id]+1); 5919 5914 5920 fprintf(output," %d/%d %d/%d %d/%d", temp3->face_id+1,vt[temp3->face_id]+1,5921 temp2->face_id+1,vt[temp2->face_id]+1, temp1->face_id+1,vt[temp1->face_id]+1); 5915 /* fprintf(output," %d/%d %d/%d %d/%d", temp3->face_id+1,vt[temp3->face_id]+1, 5916 temp2->face_id+1,vt[temp2->face_id]+1, temp1->face_id+1,vt[temp1->face_id]+1);*/ 5922 5917 } 5923 5918 else if ((cptexture)&& (norm)) { 5924 5919 if (startnewstrip && orient) /* If we want to keep orientation */ 5925 preserve_strip_orientation_with_texture_and_normal( output,temp3->face_id+1,vt[temp3->face_id]+1,vn[temp3->face_id]+1,5920 preserve_strip_orientation_with_texture_and_normal(temp3->face_id+1,vt[temp3->face_id]+1,vn[temp3->face_id]+1, 5926 5921 temp2->face_id+1,vt[temp2->face_id]+1,vn[temp2->face_id]+1, temp1->face_id+1,vt[temp1->face_id]+1,vn[temp1->face_id]+1); 5927 5922 5928 fprintf(output," %d/%d/%d %d/%d/%d %d/%d/%d", temp3->face_id+1,vt[temp3->face_id]+1,vn[temp3->face_id]+1,5929 temp2->face_id+1,vt[temp2->face_id]+1,vn[temp2->face_id]+1, temp1->face_id+1,vt[temp1->face_id]+1,vn[temp1->face_id]+1); 5923 /* fprintf(output," %d/%d/%d %d/%d/%d %d/%d/%d", temp3->face_id+1,vt[temp3->face_id]+1,vn[temp3->face_id]+1, 5924 temp2->face_id+1,vt[temp2->face_id]+1,vn[temp2->face_id]+1, temp1->face_id+1,vt[temp1->face_id]+1,vn[temp1->face_id]+1);*/ 5930 5925 } 5931 5926 else 5932 5927 { 5933 5928 if (startnewstrip && orient) /* If we want to keep orientation */ 5934 preserve_strip_orientation( output,temp3->face_id+1,temp2->face_id+1,temp1->face_id+1);5935 5936 fprintf(output," %d %d %d", temp3->face_id+1,temp2->face_id+1,temp1->face_id+1);5929 preserve_strip_orientation(temp3->face_id+1,temp2->face_id+1,temp1->face_id+1); 5930 5931 // fprintf(output," %d %d %d", temp3->face_id+1,temp2->face_id+1,temp1->face_id+1); 5937 5932 mi_vector[num_tiras].push_back(temp3->face_id); 5938 5933 mi_vector[num_tiras].push_back(temp2->face_id); … … 6003 5998 */ 6004 5999 if (orient && startnewstrip) // If we want to keep orientation 6005 preserve_strip_orientation( output,vertex1+1,other1+1,other2+1);6000 preserve_strip_orientation(vertex1+1,other1+1,other2+1); 6006 6001 6007 fprintf(output," %d %d %d",vertex1+1,other1+1,other2+1);6002 // fprintf(output," %d %d %d",vertex1+1,other1+1,other2+1); 6008 6003 mi_vector[num_tiras].push_back(vertex1); 6009 6004 mi_vector[num_tiras].push_back(other1); … … 6024 6019 { 6025 6020 // If we used partial we might have a break in the middle of a strip 6026 fprintf(output,"\nt");6021 // fprintf(output,"\nt"); 6027 6022 startnewstrip = 1; 6028 6023 mi_vector_tipo nada; … … 6054 6049 if ((!norm) && (!cptexture)) 6055 6050 { 6056 fprintf(output," %d",id[index]+1);6051 // fprintf(output," %d",id[index]+1); 6057 6052 mi_vector[num_tiras].push_back(id[index]); 6058 6053 } 6059 else if ((norm) && (!cptexture))6054 /* else if ((norm) && (!cptexture)) 6060 6055 fprintf(output," %d//%d",id[index]+1,vn[id[index]]+1); 6061 6056 else if ((!norm) && (cptexture)) 6062 6057 fprintf(output," %d/%d",id[index]+1,vt[id[index]]+1); 6063 6058 else 6064 fprintf(output," %d/%d/%d", id[index]+1,vt[id[index]]+1,vn[id[index]]+1); 6059 fprintf(output," %d/%d/%d", id[index]+1,vt[id[index]]+1,vn[id[index]]+1);*/ 6065 6060 6066 6061 index = !index; … … 6072 6067 if ((!norm) && (!cptexture)) 6073 6068 { 6074 fprintf(output,"\nq %d",vertex2+1);6069 // fprintf(output,"\nq %d",vertex2+1); 6075 6070 mi_vector[num_tiras].push_back(vertex2); 6076 6071 } 6077 else if ((norm) && (!cptexture))6072 /* else if ((norm) && (!cptexture)) 6078 6073 fprintf(output,"\nq %d//%d",vertex2+1,vn[vertex2]+1); 6079 6074 else if ((!norm) && (cptexture)) … … 6081 6076 else 6082 6077 fprintf(output,"\nq %d/%d/%d",vertex2+1,vt[vertex2]+1,vn[vertex2]+1); 6083 6078 */ 6084 6079 id[index] = vertex2; index = !index; 6085 6080 … … 6093 6088 if ((text) && (vt[vertex2]==0)) 6094 6089 { 6095 if (cptexture)6096 fprintf(output,"\nq"); 6090 /* if (cptexture) 6091 fprintf(output,"\nq");*/ 6097 6092 cptexture = FALSE; 6098 6093 } … … 6100 6095 if ((!norm) && (!cptexture)) 6101 6096 { 6102 fprintf(output," %d",vertex2+1);6097 // fprintf(output," %d",vertex2+1); 6103 6098 mi_vector[num_tiras].push_back(vertex2); 6104 6099 } 6105 else if ((norm) && (!cptexture))6100 /* else if ((norm) && (!cptexture)) 6106 6101 fprintf(output," %d//%d",vertex2+1,vn[vertex2]+1); 6107 6102 else if ((!norm) && (cptexture)) … … 6109 6104 else 6110 6105 fprintf(output," %d/%d/%d",vertex2+1,vt[vertex2]+1,vn[vertex2]+1); 6111 6106 */ 6112 6107 Free_Strips(); 6113 6108 return (num/3); … … 6145 6140 int bucket, ListHead *pListHead, 6146 6141 BOOL first, int *swaps, 6147 FILE *bands,int color1,6142 int color1, 6148 6143 int color2, int color3, 6149 6144 BOOL global, BOOL end) … … 6184 6179 return 0; 6185 6180 else 6186 return (Finished(swaps, bands,0));6181 return (Finished(swaps,0)); 6187 6182 } 6188 6183 … … 6212 6207 face_array[temp->face_id].pfNode = NULL; 6213 6208 RemoveList(pListHead,(PLISTINFO) temp); 6214 return (Finished(swaps, bands,0));6209 return (Finished(swaps,0)); 6215 6210 } 6216 6211 … … 6240 6235 face_array[temp->face_id].pfNode = NULL; 6241 6236 RemoveList(pListHead,(PLISTINFO) temp); 6242 return (Finished(swaps, bands,0));6237 return (Finished(swaps,0)); 6243 6238 } 6244 6239 … … 6290 6285 face_array[temp->face_id].pfNode = NULL; 6291 6286 RemoveList(pListHead,(PLISTINFO) temp); 6292 return (Finished(swaps, bands,0));6287 return (Finished(swaps,0)); 6293 6288 } 6294 6289 … … 6311 6306 find an adj polygon */ 6312 6307 if (next_face_id == -1) 6313 return (Finished(swaps, bands,0));6308 return (Finished(swaps,0)); 6314 6309 6315 6310 if (Done(next_face_id,&next_bucket) == NULL) … … 6328 6323 } 6329 6324 return (Polygon_Output(lpListInfo,next_face_id,next_bucket, 6330 pListHead, FALSE, swaps, bands,6325 pListHead, FALSE, swaps, 6331 6326 color1,color2,color3,global,end)); 6332 6327 … … 6357 6352 /* We will be at the beginning of the next strip. */ 6358 6353 face->nPolSize = 1; 6359 return (Finished(swaps, bands,0));6354 return (Finished(swaps,0)); 6360 6355 } 6361 6356 … … 6405 6400 /* We will be at the beginning of the next strip. */ 6406 6401 face->nPolSize = 1; 6407 return (Finished(swaps, bands,0));6402 return (Finished(swaps,0)); 6408 6403 } 6409 6404 … … 6415 6410 6416 6411 Non_Blind_Triangulate(face->nPolSize,face->pPolygon, 6417 bands,next_face_id,face_id,1,6412 next_face_id,face_id,1, 6418 6413 color1,color2,color3); 6419 6414 … … 6432 6427 } 6433 6428 return (Polygon_Output(lpListInfo,next_face_id,next_bucket, 6434 pListHead, FALSE, swaps, bands,6429 pListHead, FALSE, swaps, 6435 6430 color1,color2,color3,global,end)); 6436 6431 } … … 6444 6439 int e2, 6445 6440 int *swaps, 6446 FILE *bands,6447 6441 int color1, 6448 6442 int color2, … … 6485 6479 /* Find a strip extending from the patch and return the cost */ 6486 6480 return (Polygon_Output(lpListInfo,face_id,next_bucket,pListHead,TRUE,swaps, 6487 bands,color1,color2,color3,TRUE,TRUE));6481 color1,color2,color3,TRUE,TRUE)); 6488 6482 } 6489 6483 … … 7027 7021 void CustomStripifier::Mark_Face( PF_FACES temp2, int color1, 7028 7022 int color2, int color3, 7029 FILE *output_file,BOOL end,7023 BOOL end, 7030 7024 int *edge1, int *edge2, 7031 7025 int *face_id, int norms, … … 7120 7114 if ((!norms) && (!cptexture)) 7121 7115 { 7122 fprintf(output_file,"\nt");7116 // fprintf(output_file,"\nt"); 7123 7117 if (orient) /* If we want to preserve normal orientation */ 7124 preserve_strip_orientation( output_file,x+1,y+1,saved[1]+1);7118 preserve_strip_orientation(x+1,y+1,saved[1]+1); 7125 7119 7126 fprintf(output_file," %d %d %d",x+1,y+1,saved[1]+1);7127 fprintf(output_file," %d",saved[0]+1);7120 // fprintf(output_file," %d %d %d",x+1,y+1,saved[1]+1); 7121 // fprintf(output_file," %d",saved[0]+1); 7128 7122 } 7129 7123 else if ((norms) && (!cptexture)) 7130 7124 { 7131 fprintf(output_file,"\nt");7125 // fprintf(output_file,"\nt"); 7132 7126 if (orient) /* If we want to preserve normal orientation */ 7133 preserve_strip_orientation_with_normal( output_file,7127 preserve_strip_orientation_with_normal( 7134 7128 x+1,vn[x] +1, 7135 7129 y+1,vn[y] +1, 7136 7130 saved[1]+1,vn[saved[1]]+1); 7137 7131 7138 fprintf(output_file," %d//%d %d//%d %d//%d",7132 /* fprintf(output_file," %d//%d %d//%d %d//%d", 7139 7133 x+1,vn[x] +1, 7140 7134 y+1,vn[y] +1, 7141 7135 saved[1]+1,vn[saved[1]]+1); 7142 fprintf(output_file," %d//%d",saved[0]+1,vn[saved[0]]+1); 7136 fprintf(output_file," %d//%d",saved[0]+1,vn[saved[0]]+1);*/ 7143 7137 } 7144 7138 else if ((cptexture) && (!norms)) 7145 7139 { 7146 fprintf(output_file,"\nt");7147 if (orient) /* If we want to preserve normal orientation */7148 preserve_strip_orientation_with_texture( output_file,7140 // fprintf(output_file,"\nt"); 7141 if (orient) 7142 preserve_strip_orientation_with_texture( 7149 7143 x+1,vt[x] +1, 7150 7144 y+1,vt[y] +1, 7151 7145 saved[1]+1,vt[saved[1]]+1); 7152 7146 7153 fprintf(output_file," %d/%d %d/%d %d/%d",7147 /* fprintf(output_file," %d/%d %d/%d %d/%d", 7154 7148 x+1,vt[x] +1, 7155 7149 y+1,vt[y] +1, 7156 7150 saved[1]+1,vt[saved[1]]+1); 7157 7151 7158 fprintf(output_file," %d//%d",saved[0]+1,vt[saved[0]]+1); 7152 fprintf(output_file," %d//%d",saved[0]+1,vt[saved[0]]+1);*/ 7159 7153 } 7160 7154 else 7161 7155 { 7162 fprintf(output_file,"\nt");7163 if (orient) /* If we want to preserve normal orientation */7164 preserve_strip_orientation_with_texture_and_normal( output_file,7156 // fprintf(output_file,"\nt"); 7157 if (orient) 7158 preserve_strip_orientation_with_texture_and_normal( 7165 7159 x+1,vt[x]+1,vn[x] +1, 7166 7160 y+1,vt[y]+1,vn[y] +1, 7167 7161 saved[1]+1,vt[saved[1]]+1,vn[saved[1]]+1); 7168 7162 7169 fprintf(output_file," %d/%d/%d %d/%d/%d %d/%d/%d",7163 /* fprintf(output_file," %d/%d/%d %d/%d/%d %d/%d/%d", 7170 7164 x+1,vt[x]+1,vn[x] +1, 7171 7165 y+1,vt[y]+1,vn[y] +1, … … 7173 7167 7174 7168 fprintf(output_file," %d/%d/%d", 7175 saved[0]+1,vt[saved[0]]+1,vn[saved[0]]+1); 7169 saved[0]+1,vt[saved[0]]+1,vn[saved[0]]+1);*/ 7176 7170 } 7177 7171 … … 7184 7178 if ((texture) && ( (vt[x] == 0) || (vt[y]==0))) 7185 7179 { 7186 if (cptexture)7187 fprintf(output_file,"\nq"); 7180 /* if (cptexture) 7181 fprintf(output_file,"\nq");*/ 7188 7182 cptexture = FALSE; 7189 7183 } 7190 7184 if ((!norms) && (!cptexture)) 7191 7185 { 7192 fprintf(output_file," %d",x+1);7193 fprintf(output_file," %d",y+1);7186 // fprintf(output_file," %d",x+1); 7187 // fprintf(output_file," %d",y+1); 7194 7188 } 7195 7189 else if ((norms) && (!cptexture)) 7196 7190 { 7197 fprintf(output_file," %d//%d",x+1,vn[x]+1);7198 fprintf(output_file," %d//%d",y+1,vn[y]+1);7191 // fprintf(output_file," %d//%d",x+1,vn[x]+1); 7192 // fprintf(output_file," %d//%d",y+1,vn[y]+1); 7199 7193 } 7200 7194 else if ((cptexture) && (!norms)) 7201 7195 { 7202 fprintf(output_file," %d/%d",x+1,vt[x]+1);7203 fprintf(output_file," %d/%d",y+1,vt[y]+1);7196 // fprintf(output_file," %d/%d",x+1,vt[x]+1); 7197 // fprintf(output_file," %d/%d",y+1,vt[y]+1); 7204 7198 } 7205 7199 else 7206 7200 { 7207 fprintf(output_file," %d/%d/%d",x+1,vt[x]+1,vn[x]+1);7208 fprintf(output_file," %d/%d/%d",y+1,vt[y]+1,vn[y]+1);7201 // fprintf(output_file," %d/%d/%d",x+1,vt[x]+1,vn[x]+1); 7202 // fprintf(output_file," %d/%d/%d",y+1,vt[y]+1,vn[y]+1); 7209 7203 } 7210 7204 … … 7224 7218 if ((!norms) && (!texture)) 7225 7219 { 7226 fprintf(output_file,"\nq %d",x+1);7227 fprintf(output_file," %d",y+1);7220 // fprintf(output_file,"\nq %d",x+1); 7221 // fprintf(output_file," %d",y+1); 7228 7222 } 7229 7223 else if ((norms) && (!texture)) 7230 7224 { 7231 fprintf(output_file,"\nq %d//%d",x+1,vn[x]+1);7232 fprintf(output_file," %d//%d" ,y+1,vn[y]+1);7225 // fprintf(output_file,"\nq %d//%d",x+1,vn[x]+1); 7226 // fprintf(output_file," %d//%d" ,y+1,vn[y]+1); 7233 7227 } 7234 7228 else if ((texture) && (!norms)) 7235 7229 { 7236 fprintf(output_file,"\nq %d/%d",x+1,vt[x]+1);7237 fprintf(output_file," %d/%d",y+1,vt[y]+1);7230 // fprintf(output_file,"\nq %d/%d",x+1,vt[x]+1); 7231 // fprintf(output_file," %d/%d",y+1,vt[y]+1); 7238 7232 } 7239 7233 else 7240 7234 { 7241 fprintf(output_file,"\nq %d/%d/%d",x+1,vt[x]+1,vn[x]+1);7242 fprintf(output_file," %d/%d/%d",y+1,vt[y]+1,vn[y]+1);7235 // fprintf(output_file,"\nq %d/%d/%d",x+1,vt[x]+1,vn[x]+1); 7236 // fprintf(output_file," %d/%d/%d",y+1,vt[y]+1,vn[y]+1); 7243 7237 } 7244 7238 … … 7543 7537 int north,int last_north, 7544 7538 int orientation,int last_left, 7545 FILE *output_file,int color1,7539 int color1, 7546 7540 int color2,int color3, 7547 7541 BOOL start) … … 7593 7587 if (start) 7594 7588 Reset_Max(temp2,face_id,orientation,last_left,north,last_north, 7595 output_file,color1,color2,color3,FALSE);7589 color1,color2,color3,FALSE); 7596 7590 7597 7591 face_id = nextvert; … … 7679 7673 } 7680 7674 if (start) 7681 Reset_Max(temp2,face_id,orientation,last_left,north,last_north, output_file,7675 Reset_Max(temp2,face_id,orientation,last_left,north,last_north, 7682 7676 color1,color2,color3,FALSE); 7683 7677 else if (nextvert != -1) … … 7690 7684 int north,int last_north, 7691 7685 int orientation,int last_left, 7692 FILE *output_file,int color1,7686 int color1, 7693 7687 int color2,int color3, 7694 7688 BOOL start, int *swaps_added, … … 7744 7738 if (start) 7745 7739 tris += Peel_Max(temp2,face_id,orientation,last_left,north,last_north, 7746 output_file,color1,color2,color3,FALSE,swaps_added,7740 color1,color2,color3,FALSE,swaps_added, 7747 7741 norms,texture); 7748 7742 else 7749 Mark_Face(temp2,color1,color2,color3, output_file,FALSE,7743 Mark_Face(temp2,color1,color2,color3,FALSE, 7750 7744 &dummy,&dummy,&face_id,norms,texture); 7751 7745 … … 7828 7822 if (start) 7829 7823 tris += Peel_Max(temp2,face_id,orientation,last_left,north,last_north, 7830 output_file,color1,color2,color3,FALSE,swaps_added,7824 color1,color2,color3,FALSE,swaps_added, 7831 7825 norms,texture); 7832 7826 else 7833 Mark_Face(temp2,color1,color2,color3, output_file,FALSE,7827 Mark_Face(temp2,color1,color2,color3,FALSE, 7834 7828 &dummy,&dummy,&face_id,norms,texture);/* do the last face */ 7835 7829 … … 7837 7831 7838 7832 /* Get the edge that we came out on the last strip of the patch */ 7839 Mark_Face(NULL,0,0,0, output_file,TRUE,&end1,&end2,&last_id,norms,texture);7840 tris += Extend_Face(last_id,end1,end2,&s, output_file,color1,color2,color3,7833 Mark_Face(NULL,0,0,0,TRUE,&end1,&end2,&last_id,norms,texture); 7834 tris += Extend_Face(last_id,end1,end2,&s,color1,color2,color3, 7841 7835 vn,norms,vt,texture); 7842 7836 *swaps_added = *swaps_added + s; … … 7845 7839 7846 7840 /// Find_Bands: 7847 void CustomStripifier::Find_Bands(int numfaces, FILE *output_file, 7848 int *swaps, int *bands, 7841 void CustomStripifier::Find_Bands(int numfaces, int *swaps, int *bands, 7849 7842 int *cost, int *tri, 7850 7843 int norms, int *vert_norms, … … 7960 7953 { 7961 7954 total_tri += Peel_Max(temp,face_id,0,last_north,3,last_left, 7962 output_file,color1,color2,color3,TRUE,7955 color1,color2,color3,TRUE, 7963 7956 &s,norms,texture); 7964 7957 Reset_Max(temp,face_id,0,last_north,3,last_left, 7965 output_file,color1,color2,color3,TRUE);7958 color1,color2,color3,TRUE); 7966 7959 total_swaps += s; 7967 7960 } … … 7970 7963 reversed = TRUE; 7971 7964 total_tri += Peel_Max(temp,face_id,3,last_left,0,last_north, 7972 output_file,color1,color2,color3,TRUE,7965 color1,color2,color3,TRUE, 7973 7966 &s,norms,texture); 7974 Reset_Max(temp,face_id,3,last_left,0,last_north, output_file,7967 Reset_Max(temp,face_id,3,last_left,0,last_north, 7975 7968 color1,color2,color3,TRUE); 7976 7969 reversed = FALSE; … … 7980 7973 7981 7974 /* Get the edge that we came out on the last strip of the patch */ 7982 Mark_Face(NULL,0,0,0, NULL,TRUE,&end1,&end2,&last_id,norms,texture);7983 total_tri += Extend_Face(last_id,end1,end2,&s, output_file,7975 Mark_Face(NULL,0,0,0,TRUE,&end1,&end2,&last_id,norms,texture); 7976 total_tri += Extend_Face(last_id,end1,end2,&s, 7984 7977 color1,color2,color3,vn,norms,vt,texture); 7985 total_swaps += s; 7986 7978 total_swaps += s; 7987 7979 } 7988 7980 else … … 7991 7983 { 7992 7984 total_tri += Peel_Max(temp,face_id,2,last_north,1,last_left, 7993 output_file,color1,color2,color3,TRUE,7985 color1,color2,color3,TRUE, 7994 7986 &s,norms,texture); 7995 Reset_Max(temp,face_id,2,last_north,1,last_left, output_file,7987 Reset_Max(temp,face_id,2,last_north,1,last_left, 7996 7988 color1,color2,color3,TRUE); 7997 7989 total_swaps += s; … … 8001 7993 reversed = TRUE; 8002 7994 total_tri += Peel_Max(temp,face_id,1,last_left,2,last_north, 8003 output_file,color1,color2,color3,TRUE,7995 color1,color2,color3,TRUE, 8004 7996 &s,norms,texture); 8005 Reset_Max(temp,face_id,1,last_left,2,last_north, output_file,7997 Reset_Max(temp,face_id,1,last_left,2,last_north, 8006 7998 color1,color2,color3,TRUE); 8007 7999 reversed = FALSE; … … 8010 8002 8011 8003 /* Get the edge that we came out on on the patch */ 8012 Mark_Face(NULL,0,0,0, NULL,TRUE,&end1,&end2,&last_id,norms,texture);8013 total_tri += Extend_Face(last_id,end1,end2,&s, output_file,8004 Mark_Face(NULL,0,0,0,TRUE,&end1,&end2,&last_id,norms,texture); 8005 total_tri += Extend_Face(last_id,end1,end2,&s, 8014 8006 color1,color2,color3,vn,norms,vt,texture); 8015 8007 total_swaps += s; … … 8115 8107 } 8116 8108 8117 / // OpenOutputFile:8109 /*/// OpenOutputFile: 8118 8110 FILE * CustomStripifier::OpenOutputFile(char *fname) 8119 8111 { … … 8142 8134 8143 8135 return bands; 8144 } 8136 }*/ 8145 8137 8146 8138 /// AllocateStruct: Reserves memory for structures. … … 8188 8180 8189 8181 /// miReadFile: Loads the object in memory. 8190 void CustomStripifier::miReadFile(char *fname, char *file_open, FILE *bands,Geometry::SubMesh *geoSubMesh)8182 void CustomStripifier::miReadFile(char *fname, char *file_open, Geometry::SubMesh *geoSubMesh) 8191 8183 { 8192 8184 int face_id = 0; … … 8244 8236 BOOL quads = FALSE; 8245 8237 BOOL oddStrip; 8246 FILE *bands;8238 // FILE *bands; 8247 8239 char *file_open; 8248 8240 int i; … … 8316 8308 8317 8309 // Open the output file. 8318 bands = OpenOutputFile(fname);8310 // bands = OpenOutputFile(fname); 8319 8311 8320 8312 // 2006-02-14. … … 8338 8330 8339 8331 // Load the object into memory. 8340 miReadFile(fname,file_open, bands,geoSubMesh);8332 miReadFile(fname,file_open,geoSubMesh); 8341 8333 8342 8334 // 2006-02-14. … … 8389 8381 //----------------------- 8390 8382 8391 SGI_Strip(num_faces, bands,t,tr);8383 SGI_Strip(num_faces,t,tr); 8392 8384 8393 8385 // 2006-02-14. … … 8400 8392 8401 8393 // Get the total cost. 8402 Output_TriEx(-1,-2,-3, NULL,-20,cost);8394 Output_TriEx(-1,-2,-3,-20,cost); 8403 8395 8404 8396 End_Face_Struct(num_faces); 8405 8397 End_Edge_Struct(num_vert); 8406 fclose(bands);8407 8398 8408 8399 // 2006-02-14.
Note: See TracChangeset
for help on using the changeset viewer.