• R/O
  • SSH
  • HTTPS

vima19: Commit


Commit MetaInfo

Revision276 (tree)
Zeit2021-10-15 03:48:14
Autorhgtterry

Log Message

Equity15 141021 Ogre XML Exporter

Ändern Zusammenfassung

Diff

--- Anim19_OSDN/VM_TXMLExport.cpp (revision 275)
+++ Anim19_OSDN/VM_TXMLExport.cpp (revision 276)
@@ -735,34 +735,18 @@
735735 return 0;
736736 }
737737
738- fprintf(WritePolyFile, "%s\n","<mesh>");
739- fprintf(WritePolyFile,"%s\n"," <submeshes>");
738+ fprintf(WritePolyFile, "%s\n", "<mesh>");
739+ fprintf(WritePolyFile, "%s\n", " <submeshes>");
740740
741- //if(C_Render->SelectedTexture==-1)
742- //{
743- //
741+ int Count = 0;
742+ while (Count < App->CL_Vm_Model->GroupCount)
743+ {
744+ RenderToXML(Count);
745+ WriteNewXML(Count);
746+ Count++;
747+ }
744748
745- //// int texturecount=geBody_GetMaterialCount(At->ActorDef_Memory->Body);
746- // int texturecount=Texture[0]->UsedTextureCount;
747- // int Count=0;
748- // while (Count<texturecount)
749- // {
750- // TextureNum=Count;
751- // RenderToXML();
752- // WriteNewXML();
753- // Count++;
754- // }
755- //
756- //}
757- //else
758- //{
759- //
760- // TextureNum=C_Render->SelectedTexture;
761- RenderToXML();
762- // WriteNewXML();
763- //}
764749
765-
766750 fprintf(WritePolyFile, "%s\n"," </submeshes>");
767751 if(DoSkell==1)
768752 {
@@ -773,122 +757,97 @@
773757
774758 fclose(WritePolyFile);
775759
776-
777- //C_ProgBar->Nudge();
778-
779760 //WriteScript(LTextureFormat);
780761 //if(DoSkell==1)
781762 //{
782763 // WriteSkellFile();
783764 //}
784- //C_ProgBar->Nudge();
765+
785766
786- //C_ProgBar->SetMainText("Converting XML File to .skeleton");
787- //C_ProgBar->Nudge();
788-
789- //C_ProgBar->Nudge();
790- //if(S_XMLStore[0])
791- //{
792- // delete S_XMLStore[0];
793- // S_XMLStore[0]=NULL;
794- //
795- //}
767+ if(S_XMLStore[0])
768+ {
769+ delete S_XMLStore[0];
770+ S_XMLStore[0]=NULL;
771+
772+ }
796773 //remove("OgreXMLConverter.log");
797- //C_ProgBar->Nudge();
798-
799- //C_ProgBar->Close();
800- //strcpy(AnswerText,"Your Actor has been converted to the XML Ogre Format");
801- //App->Say("Converted");
774+
775+ App->Say("Converted");
802776 return 1;
803777 }
804778 // *************************************************************************
805779 // * RenderToXML *
806780 // *************************************************************************
807-bool VM_XMLExport::RenderToXML()
781+bool VM_XMLExport::RenderToXML(int GroupIndex)
808782 {
783+ int FaceCount = 0;
784+ int XMLCount=0;
785+ int Face=0;
786+
787+ int A = 0;
788+ int B = 0;
789+ int C = 0;
809790
810- //int PolyCount=At->ActorDef_Memory->Body->SkinFaces[GE_BODY_HIGHEST_LOD].FaceCount;
811- //const geBody_Triangle *SF;
812- //const geBody_XSkinVertex *SN;
791+ while (FaceCount < App->CL_Vm_Model->S_MeshGroup[GroupIndex]->GroupFaceCount)
792+ {
793+ A = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Face_Data[FaceCount].a;
794+ B = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Face_Data[FaceCount].b;
795+ C = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Face_Data[FaceCount].c;
813796
814- //SF=At->ActorDef_Memory->Body->SkinFaces[GE_BODY_HIGHEST_LOD].FaceArray;
815- //SN=At->ActorDef_Memory->Body->XSkinVertexArray;
797+ // first vector in face and vertic + normal and uv
798+ S_XMLStore[0]->XMLvertex[XMLCount].x = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->vertex_Data[A].x;
799+ S_XMLStore[0]->XMLvertex[XMLCount].y = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->vertex_Data[A].y;
800+ S_XMLStore[0]->XMLvertex[XMLCount].z = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->vertex_Data[A].z;
816801
817- //int Count=0;
818- //int MatIndex;
819- //int XMLCount=0;
820- //int Face=0;
821- //int ClockTime=0;
802+ S_XMLStore[0]->mapcoord[XMLCount].u = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->MapCord_Data[A].u;
803+ S_XMLStore[0]->mapcoord[XMLCount].v = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->MapCord_Data[A].v;
822804
823- //while (Count<PolyCount)
824- //{
825- // ClockTime++;
826- // if (ClockTime==100)
827- // {
828- // C_ProgBar->Nudge();
829- // ClockTime=0;
805+ S_XMLStore[0]->XMLnormal[XMLCount].x = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Normal_Data[A].x;
806+ S_XMLStore[0]->XMLnormal[XMLCount].y = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Normal_Data[A].y;
807+ S_XMLStore[0]->XMLnormal[XMLCount].z = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Normal_Data[A].z;
830808
831- // }
832- // MatIndex=At->ActorDef_Memory->Body->SkinFaces[GE_BODY_HIGHEST_LOD].FaceArray[Count].MaterialIndex;
833- //
834- // if(MatIndex==TextureNum)
835- // {
836- //
837- // // first vector in face and vertic + normal and uv
838- // S_XMLStore[0]->XMLvertex[XMLCount].x=cube.vertex[ cube.polygon[Count].a ].x;
839- // S_XMLStore[0]->XMLvertex[XMLCount].y=cube.vertex[ cube.polygon[Count].a ].y;
840- // S_XMLStore[0]->XMLvertex[XMLCount].z=cube.vertex[ cube.polygon[Count].a ].z;
841- //
842- // S_XMLStore[0]->mapcoord[XMLCount].u=cube.mapcoord[ cube.polygon[Count].a].u;
843- // S_XMLStore[0]->mapcoord[XMLCount].v=cube.mapcoord[ cube.polygon[Count].a].v;
844- //
845- // S_XMLStore[0]->XMLnormal[XMLCount].x=cube.normal[SF[Count].NormalIndex[0]].x;
846- // S_XMLStore[0]->XMLnormal[XMLCount].y=cube.normal[SF[Count].NormalIndex[0]].y;
847- // S_XMLStore[0]->XMLnormal[XMLCount].z=cube.normal[SF[Count].NormalIndex[0]].z;
809+ S_XMLStore[0]->BoneIndex[XMLCount] = 0;// SN[cube.polygon[Count].a].BoneIndex;
810+ S_XMLStore[0]->XMLpolygon[Face].a = XMLCount;
811+ XMLCount++;
848812
849- // S_XMLStore[0]->BoneIndex[XMLCount]=SN[cube.polygon[Count].a].BoneIndex;
850- // S_XMLStore[0]->XMLpolygon[Face].a=XMLCount;
851- // XMLCount++;
813+ // second vector in face and vertic + normal and uv
814+ S_XMLStore[0]->XMLvertex[XMLCount].x = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->vertex_Data[B].x;
815+ S_XMLStore[0]->XMLvertex[XMLCount].y = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->vertex_Data[B].y;
816+ S_XMLStore[0]->XMLvertex[XMLCount].z = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->vertex_Data[B].z;
852817
853- // // second vector in face and vertic + normal and uv
854- // S_XMLStore[0]->XMLvertex[XMLCount].x=cube.vertex[ cube.polygon[Count].b ].x;
855- // S_XMLStore[0]->XMLvertex[XMLCount].y=cube.vertex[ cube.polygon[Count].b ].y;
856- // S_XMLStore[0]->XMLvertex[XMLCount].z=cube.vertex[ cube.polygon[Count].b ].z;
857- //
858- // S_XMLStore[0]->mapcoord[XMLCount].u=cube.mapcoord[ cube.polygon[Count].b].u;
859- // S_XMLStore[0]->mapcoord[XMLCount].v=cube.mapcoord[ cube.polygon[Count].b].v;
860- //
861- // S_XMLStore[0]->XMLnormal[XMLCount].x=cube.normal[SF[Count].NormalIndex[1]].x;
862- // S_XMLStore[0]->XMLnormal[XMLCount].y=cube.normal[SF[Count].NormalIndex[1]].y;
863- // S_XMLStore[0]->XMLnormal[XMLCount].z=cube.normal[SF[Count].NormalIndex[1]].z;
864- //
865- // S_XMLStore[0]->BoneIndex[XMLCount]=SN[cube.polygon[Count].b].BoneIndex;
866- // S_XMLStore[0]->XMLpolygon[Face].b=XMLCount;
867- // XMLCount++;
818+ S_XMLStore[0]->mapcoord[XMLCount].u = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->MapCord_Data[B].u;
819+ S_XMLStore[0]->mapcoord[XMLCount].v = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->MapCord_Data[B].v;
868820
869- // // third vector in face and vertic + normal and uv
870- // S_XMLStore[0]->XMLvertex[XMLCount].x=cube.vertex[ cube.polygon[Count].c ].x;
871- // S_XMLStore[0]->XMLvertex[XMLCount].y=cube.vertex[ cube.polygon[Count].c ].y;
872- // S_XMLStore[0]->XMLvertex[XMLCount].z=cube.vertex[ cube.polygon[Count].c ].z;
873- //
874- // S_XMLStore[0]->mapcoord[XMLCount].u=cube.mapcoord[ cube.polygon[Count].c].u;
875- // S_XMLStore[0]->mapcoord[XMLCount].v=cube.mapcoord[ cube.polygon[Count].c].v;
876- //
877- // S_XMLStore[0]->XMLnormal[XMLCount].x=cube.normal[SF[Count].NormalIndex[2]].x;
878- // S_XMLStore[0]->XMLnormal[XMLCount].y=cube.normal[SF[Count].NormalIndex[2]].y;
879- // S_XMLStore[0]->XMLnormal[XMLCount].z=cube.normal[SF[Count].NormalIndex[2]].z;
821+ S_XMLStore[0]->XMLnormal[XMLCount].x = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Normal_Data[B].x;
822+ S_XMLStore[0]->XMLnormal[XMLCount].y = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Normal_Data[B].y;
823+ S_XMLStore[0]->XMLnormal[XMLCount].z = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Normal_Data[B].z;
880824
881- // S_XMLStore[0]->BoneIndex[XMLCount]=SN[cube.polygon[Count].c].BoneIndex;
882- // S_XMLStore[0]->XMLpolygon[Face].c=XMLCount;
883- // XMLCount++;
884- // Face++;
885- //
886- // }
887- // Count++;
888- //
889- //}
890- // S_XMLStore[0]->SXMLCount=XMLCount;
825+ S_XMLStore[0]->BoneIndex[XMLCount] = 0;// SN[cube.polygon[Count].a].BoneIndex;
826+ S_XMLStore[0]->XMLpolygon[Face].b = XMLCount;
827+ XMLCount++;
891828
829+ // third vector in face and vertic + normal and uv
830+ S_XMLStore[0]->XMLvertex[XMLCount].x = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->vertex_Data[C].x;
831+ S_XMLStore[0]->XMLvertex[XMLCount].y = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->vertex_Data[C].y;
832+ S_XMLStore[0]->XMLvertex[XMLCount].z = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->vertex_Data[C].z;
833+
834+ S_XMLStore[0]->mapcoord[XMLCount].u = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->MapCord_Data[C].u;
835+ S_XMLStore[0]->mapcoord[XMLCount].v = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->MapCord_Data[C].v;
836+
837+ S_XMLStore[0]->XMLnormal[XMLCount].x = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Normal_Data[C].x;
838+ S_XMLStore[0]->XMLnormal[XMLCount].y = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Normal_Data[C].y;
839+ S_XMLStore[0]->XMLnormal[XMLCount].z = App->CL_Vm_Model->S_MeshGroup[GroupIndex]->Normal_Data[C].z;
840+
841+ S_XMLStore[0]->BoneIndex[XMLCount] = 0;// SN[cube.polygon[Count].a].BoneIndex;
842+ S_XMLStore[0]->XMLpolygon[Face].c = XMLCount;
843+ XMLCount++;
844+ Face++;
845+
846+ FaceCount++;
847+ }
848+
849+ S_XMLStore[0]->SXMLCount = XMLCount;
850+
892851 return 1;
893852 }
894853
@@ -895,29 +854,13 @@
895854 // *************************************************************************
896855 // * WriteNewXML *
897856 // *************************************************************************
898-bool VM_XMLExport::WriteNewXML()
857+bool VM_XMLExport::WriteNewXML(int GroupIndex)
899858 {
900-
859+ WriteSubMesh(GroupIndex);
901860
902-// int NewCount=S_XMLStore[0]->SXMLCount;
903-// int PolyCount=S_XMLStore[0]->SXMLCount;
904-// int VertCount=S_XMLStore[0]->SXMLCount;
905-// int Count=0;
906-// int a=0;
907-// int b=0;
908-// int c=0;
909-//
910-// WriteSubMesh();
911-//if (DoSkell==1)
912-//{
913-//
914-//}
915-//else
916-//{
917-// fprintf(WritePolyFile, "%s\n"," </vertexbuffer>");
918-// fprintf(WritePolyFile, "%s\n"," </geometry>");
919-//}
920-// fprintf(WritePolyFile, "%s\n"," </submesh>");
861+ fprintf(WritePolyFile, "%s\n"," </vertexbuffer>");
862+ fprintf(WritePolyFile, "%s\n"," </geometry>");
863+ fprintf(WritePolyFile, "%s\n"," </submesh>");
921864
922865 return 1;
923866 }
@@ -925,87 +868,78 @@
925868 // *************************************************************************
926869 // * WriteSubMesh *
927870 // *************************************************************************
928-bool VM_XMLExport::WriteSubMesh()
871+bool VM_XMLExport::WriteSubMesh(int GroupIndex)
929872 {
930-// float x=0;
931-// float y=0;
932-// float z=0;
933-//
934-// int a=0;
935-// int b=0;
936-// int c=0;
937-//
938-// geBitmap* Bitmap;
939-// float R,G,B=0;
940-// const char *MatName;
941-//
942-// float V=0;
943-// int NewCount=S_XMLStore[0]->SXMLCount;
944-// int PolyCount=S_XMLStore[0]->SXMLCount/3;
945-// int VertCount=S_XMLStore[0]->SXMLCount;
946-// int Count=0;
947-//
948-//
949-// C_ProgBar->SetMainText("Writing XML Mesh File");
950-// //------------------------------- texture
951-//
952-// char SubMesh[256];
953-// strcpy(SubMesh," <submesh material=\"");
954-//
955-// geBody_GetMaterial(At->ActorDef_Memory->Body,TextureNum,&MatName,&Bitmap,&R,&G,&B);
956-//
957-//
958-// fprintf(WritePolyFile,"%s%s%s %s\n",SubMesh,MatName,"\" usesharedvertices=\"false\"","use32bitindexes=\"false\" operationtype=\"triangle_list\">");
959-//
960-// //------------------------------- PolyGons
961-// fprintf(WritePolyFile, "%s%i%s\n"," <faces count=\"",PolyCount,"\">");
962-//
963-// while (Count<NewCount/3)
964-// {
965-// a =S_XMLStore[0]->XMLpolygon[Count].a;
966-// b =S_XMLStore[0]->XMLpolygon[Count].b;
967-// c =S_XMLStore[0]->XMLpolygon[Count].c;
968-//
969-// fprintf(WritePolyFile, "%s%i%s%i%s%i%s\n"," <face v1=\"",a,"\" v2=\"",b,"\" v3=\"",c,"\" />");
970-// Count++;
971-// }
972-//
973-// fprintf(WritePolyFile, "%s\n"," </faces>");
974-//
975-// //------------------------------- Vertices
976-// fprintf(WritePolyFile, "%s%i%s\n"," <geometry vertexcount=\"",VertCount,"\">");
977-// fprintf(WritePolyFile, "%s\n"," <vertexbuffer positions=\"true\" normals=\"true\" texture_coord_dimensions_0=\"2\" texture_coords=\"1\">");
978-//
979-// Count=0;
980-// while (Count<NewCount)
981-// {
982-// // AnimateProgressBar();
983-// fprintf(WritePolyFile, "%s\n"," <vertex>");
984-// x=S_XMLStore[0]->XMLvertex[Count].x;
985-// y=S_XMLStore[0]->XMLvertex[Count].y;
986-// z=S_XMLStore[0]->XMLvertex[Count].z;
987-//
988-// u=S_XMLStore[0]->mapcoord[Count].u;
989-// V=S_XMLStore[0]->mapcoord[Count].v;
990-//
991-// v=1-V; // Swop V From RF to Ogre format
992-//
993-// nx=S_XMLStore[0]->XMLnormal[Count].x;
994-// ny=S_XMLStore[0]->XMLnormal[Count].y;
995-// nz=S_XMLStore[0]->XMLnormal[Count].z;
996-//
997-// fprintf(WritePolyFile, "%s%f%s%f%s%f%s\n"," <position x=\"",x,"\" y=\"",y,"\" z=\"",z,"\" />");
998-// fprintf(WritePolyFile, "%s%f%s%f%s%f%s\n"," <normal x=\"",nx,"\" y=\"",ny,"\" z=\"",nz,"\" />");
999-// fprintf(WritePolyFile, "%s%f%s%f%s\n"," <texcoord u=\"",u,"\" v=\"",v,"\" />");
1000-//
1001-// fprintf(WritePolyFile, "%s\n"," </vertex>");
1002-// Count++;
1003-//
1004-// }
1005-//if (DoSkell==1)
1006-//{
1007-// WriteBoneAssigenment();
1008-//}
873+ float x=0;
874+ float y=0;
875+ float z=0;
876+
877+ int a=0;
878+ int b=0;
879+ int c=0;
880+
881+ char MatName[256];
882+
883+ float V=0;
884+ int NewCount=S_XMLStore[0]->SXMLCount;
885+ int PolyCount=S_XMLStore[0]->SXMLCount/3;
886+ int VertCount=S_XMLStore[0]->SXMLCount;
887+ int Count=0;
888+
889+
890+ //------------------------------- texture
891+
892+ char SubMesh[256];
893+ strcpy(SubMesh," <submesh material=\"");
894+ strcpy(MatName,App->CL_Vm_Model->S_MeshGroup[GroupIndex]->MaterialName);
895+
896+ fprintf(WritePolyFile,"%s%s%s %s\n",SubMesh,MatName,"\" usesharedvertices=\"false\"","use32bitindexes=\"false\" operationtype=\"triangle_list\">");
897+
898+ //------------------------------- PolyGons
899+ fprintf(WritePolyFile, "%s%i%s\n"," <faces count=\"",PolyCount,"\">");
900+
901+ while (Count<NewCount/3)
902+ {
903+ a =S_XMLStore[0]->XMLpolygon[Count].a;
904+ b =S_XMLStore[0]->XMLpolygon[Count].b;
905+ c =S_XMLStore[0]->XMLpolygon[Count].c;
906+
907+ fprintf(WritePolyFile, "%s%i%s%i%s%i%s\n"," <face v1=\"",a,"\" v2=\"",b,"\" v3=\"",c,"\" />");
908+ Count++;
909+ }
910+
911+ fprintf(WritePolyFile, "%s\n"," </faces>");
912+
913+ //------------------------------- Vertices
914+ fprintf(WritePolyFile, "%s%i%s\n"," <geometry vertexcount=\"",VertCount,"\">");
915+ fprintf(WritePolyFile, "%s\n"," <vertexbuffer positions=\"true\" normals=\"true\" texture_coord_dimensions_0=\"2\" texture_coords=\"1\">");
916+
917+ Count=0;
918+ while (Count<NewCount)
919+ {
920+ fprintf(WritePolyFile, "%s\n"," <vertex>");
921+ x=S_XMLStore[0]->XMLvertex[Count].x;
922+ y=S_XMLStore[0]->XMLvertex[Count].y;
923+ z=S_XMLStore[0]->XMLvertex[Count].z;
924+
925+ u=S_XMLStore[0]->mapcoord[Count].u;
926+ V=S_XMLStore[0]->mapcoord[Count].v;
927+
928+ v=1-V; // Swop V From RF to Ogre format
929+
930+ nx=S_XMLStore[0]->XMLnormal[Count].x;
931+ ny=S_XMLStore[0]->XMLnormal[Count].y;
932+ nz=S_XMLStore[0]->XMLnormal[Count].z;
933+
934+ fprintf(WritePolyFile, "%s%f%s%f%s%f%s\n"," <position x=\"",x,"\" y=\"",y,"\" z=\"",z,"\" />");
935+ fprintf(WritePolyFile, "%s%f%s%f%s%f%s\n"," <normal x=\"",nx,"\" y=\"",ny,"\" z=\"",nz,"\" />");
936+ fprintf(WritePolyFile, "%s%f%s%f%s\n"," <texcoord u=\"",u,"\" v=\"",v,"\" />");
937+
938+ fprintf(WritePolyFile, "%s\n"," </vertex>");
939+ Count++;
940+
941+ }
942+
1009943 return 1;
1010944 }
1011945
--- Anim19_OSDN/VM_TXMLExport.h (revision 275)
+++ Anim19_OSDN/VM_TXMLExport.h (revision 276)
@@ -32,10 +32,10 @@
3232 bool GetBoneMatrix(int Count);
3333 bool WriteHiracy();
3434 bool CreateHiracyLists();
35-bool RenderToXML();
35+bool RenderToXML(int GroupIndex);
3636 bool CreateDirectory();
37-bool WriteNewXML();
38-bool WriteSubMesh();
37+bool WriteNewXML(int GroupIndex);
38+bool WriteSubMesh(int GroupIndex);
3939 bool WriteSkellFile();
4040 bool DirectoryControl();
4141 bool CreateDirectoryMesh();
Show on old repository browser