diff --git a/Utils/MkActor3d/MkActor3d.cpp b/Utils/MkActor3d/MkActor3d.cpp index 8dd4475c9..56ad2ab20 100644 --- a/Utils/MkActor3d/MkActor3d.cpp +++ b/Utils/MkActor3d/MkActor3d.cpp @@ -105,7 +105,7 @@ void CMkActor3d::Process() { BuildSkin(); FaceList.SetTexBasePath(InPath); - FaceList.SetTexOut(OutFile+".Tex",1,1,1); + FaceList.SetTexOut(OutFile+".Tex",TPageBase,TPageWidth,TPageHeight); FaceList.SetTexDebugOut(OutFile+".Lbm"); FaceList.Process(); @@ -148,20 +148,21 @@ GString OutName=OutFile+".A3d"; fwrite(&FileHdr,1,sizeof(sActor3dHdr),File); // Write Skeleton - FileHdr.NodeData=ftell(File); + FileHdr.BoneCount=Scene.GetPruneTreeSize()-1-1; // Skip Scene & skin + FileHdr.BoneList=(sBone*)ftell(File); WriteBone(1); // Write Tris FileHdr.TriCount=FaceList.GetTriFaceCount(); - FileHdr.TriData=FaceList.WriteTriList(File); + FileHdr.TriList=(sTri*)FaceList.WriteTriList(File); printf("%i Tris\n",FileHdr.TriCount); // Write Quads FileHdr.QuadCount=FaceList.GetQuadFaceCount(); - FileHdr.QuadData=FaceList.WriteQuadList(File); + FileHdr.QuadList=(sQuad*)FaceList.WriteQuadList(File); printf("%i Quads\n",FileHdr.QuadCount); // Write WeightList FileHdr.WeightCount=WeightList.size(); - FileHdr.WeightData=WriteWeightList(); + FileHdr.WeightList=(sWeight*)WriteWeightList(); printf("%i Weight\n",FileHdr.WeightCount); printf("Size=%i\n",ftell(File)); @@ -198,11 +199,14 @@ int ChildCount=ThisNode.GetPruneChildCount(); } //*************************************************************************** + void CMkActor3d::BuildBoneOut(sBone &OutBone,CNode const &InNode) { - OutBone.BoneSize.vx =round(InNode.Pos.x*Scale); - OutBone.BoneSize.vy =round(InNode.Pos.y*Scale); - OutBone.BoneSize.vz =round(InNode.Pos.z*Scale); +Vector3 const &Vtx=InNode.Pos; + + OutBone.BoneSize.vx =round(Vtx.x*Scale); + OutBone.BoneSize.vy =round(Vtx.y*Scale); + OutBone.BoneSize.vz =round(Vtx.z*Scale); OutBone.Idx=InNode.PruneIdx-1; OutBone.Parent=InNode.PruneParentIdx-1; OutBone.WeightCount=InNode.Weights.size(); @@ -217,7 +221,6 @@ void CMkActor3d::BuildWeightOut(sWeight &OutWeight,sGinWeight const &InWeight OutWeight.VtxNo=InWeight.VertNo; } - //*************************************************************************** int CMkActor3d::WriteWeightList() { @@ -227,6 +230,7 @@ int Pos=ftell(File); for (int i=0; i const &NodeAnim=ThisNode.GetAnim(); +int FrameCount=NodeAnim.size(); +vector &Move=ThisAnim.Move; -int CMkAnim3d::ProcessSkel(CScene &Scene,sAnim &ThisAnim,int Idx) + Move.resize(FrameCount); + for (int i=0; i const &NodeAnim=ThisNode.GetAnim(); @@ -99,10 +122,23 @@ int FrameCount=NodeAnim.size(); { sGinAnim const &InFrame=NodeAnim[i]; sQuat ThisFrame; - ThisFrame.vx=round(InFrame.Ang.x*4096); - ThisFrame.vy=round(InFrame.Ang.y*4096); - ThisFrame.vz=round(InFrame.Ang.z*4096); - ThisFrame.vw=round(InFrame.Ang.w*4096); + Quaternion ThisQuat=InFrame.Ang; + +/* if (Idx==1) + { + Matrix4x4 Mtx; + ThisQuat.ToMatrix(Mtx); + Mtx.m_M[0][1]=-Mtx.m_M[0][1]; + Mtx.m_M[1][1]=-Mtx.m_M[1][1]; + Mtx.m_M[2][1]=-Mtx.m_M[2][1]; + Mtx.m_M[3][1]=-Mtx.m_M[3][1]; + Mtx.ToQuaternion(ThisQuat); + } +*/ + ThisFrame.vx=round(ThisQuat.x*4096); + ThisFrame.vy=round(ThisQuat.y*4096); + ThisFrame.vz=round(ThisQuat.z*4096); + ThisFrame.vw=round(ThisQuat.w*4096); FrameList.Idx[i]=QuatList.Add(ThisFrame); QuatCount++; } @@ -111,9 +147,7 @@ int FrameCount=NodeAnim.size(); int ChildCount=ThisNode.GetPruneChildCount(); - for (int Loop=0;Loop const &Files = MyFiles.GetFileInfoVector(); return 0; } -/* -c:\spongebob\graphics\characters\spongebob\sbanim\buttbounce.gin c:\spongebob\graphics\characters\spongebob\sbanim\deathelectric.gin c:\spongebob\graphics\characters\spongebob\sbanim\deathfall.gin c:\spongebob\graphics\characters\spongebob\sbanim\electricshock.gin c:\spongebob\graphics\characters\spongebob\sbanim\fall.gin c:\spongebob\graphics\characters\spongebob\sbanim\fireaim.gin c:\spongebob\graphics\characters\spongebob\sbanim\firerecoill.gin c:\spongebob\graphics\characters\spongebob\sbanim\float.gin c:\spongebob\graphics\characters\spongebob\sbanim\getup.gin c:\spongebob\graphics\characters\spongebob\sbanim\hitground01.gin c:\spongebob\graphics\characters\spongebob\sbanim\hover.gin c:\spongebob\graphics\characters\spongebob\sbanim\idleboots.gin c:\spongebob\graphics\characters\spongebob\sbanim\idlecoral.gin c:\spongebob\graphics\characters\spongebob\sbanim\idlecoral01.gin c:\spongebob\graphics\characters\spongebob\sbanim\idlegeneric01.gin c:\spongebob\graphics\characters\spongebob\sbanim\idlegeneric02.gin c:\spongebob\graphics\characters\spongebob\sbanim\idlegeneric03.gin c:\spongebob\graphics\characters\spongebob\sbanim\idlegeneric04.gin c:\spongebob\graphics\characters\spongebob\sbanim\idlegeneric05.gin c:\spongebob\graphics\characters\spongebob\sbanim\idlelauncher.gin c:\spongebob\graphics\characters\spongebob\sbanim\idlenet.gin -o:\temp\anim.bnk -*/ \ No newline at end of file diff --git a/Utils/MkAnim3d/MkAnim3d.h b/Utils/MkAnim3d/MkAnim3d.h index 38b70ce92..c85aa01a8 100644 --- a/Utils/MkAnim3d/MkAnim3d.h +++ b/Utils/MkAnim3d/MkAnim3d.h @@ -9,7 +9,7 @@ //*************************************************************************** struct sBoneAnim { - vector Quat; +// vector Quat; vector Idx; }; @@ -17,7 +17,9 @@ struct sAnim { int FrameCount; vector BoneAnim; - int FileOfs; + vector Move; + int AnimOfs; + int MoveOfs; }; //*************************************************************************** @@ -33,7 +35,9 @@ public: void Write(GString &Filename); private: - int ProcessSkel(CScene &Scene,sAnim &ThisAnim,int Idx); + int ProcessSkelMove(CScene &Scene,sAnim &ThisAnim,int Idx); + void ProcessSkelAnim(CScene &Scene,sAnim &ThisAnim,int Idx); + int WriteMove(sAnim const &ThisAnim); int WriteAnim(sAnim const &ThisAnim); int WriteQuatTable();