/**********************************/ /*** SpongeBob 3d Actor Creator ***/ /**********************************/ #include "stdio.h" #include #include #include #include #include #include #include "MkActor3d.h" using namespace std; //*************************************************************************** int TPBase=-1,TPWidth=-1,TPHeight=-1; //*************************************************************************** char * CycleCommands(char *String,int Num) { char Text[256],*TextPtr; int Count; if (String[0]=='-' || String[0]=='/') { GString TpStr; switch (String[1]) { // Switches case 'o': OutStr = CheckFileString(String); break; case 'd': DebugOn =true; break; case 's': TpStr= CheckFileString(String); Scale=atof(TpStr); break; case 't': TpStr= CheckFileString(String); TextPtr=Text; strcpy(TextPtr,TpStr); Count=ZeroAndCountCommas(TextPtr); if (Count!=2) GObject::Error(ERR_FATAL,"Problem with option %s\n",String); TPBase=atol(TextPtr); TextPtr+=strlen(TextPtr)+1; TPWidth=atol(TextPtr); TextPtr+=strlen(TextPtr)+1; TPHeight=atol(TextPtr); case 'q': StripLength=4; break; default: GObject::Error(ERR_FATAL,"Unknown switch %s",String); break; } } else { GString UpperName(String); UpperName.Upper(); MyFiles.AddFile(UpperName); } return(String); } //*************************************************************************** //*************************************************************************** //*************************************************************************** CMkActor3d::CMkActor3d(GString const &In,GString const &Out,int TPBase,int TPW,int TPH) { GFName File=In; InFilename=In; InPath=File.Drive(); InPath+=File.Dir(); OutDir=Out; Name=File.File(); // Create Out Filename from inFilename and outdir OutFile=OutDir; OutFile.Append('\\'); OutFile+=File.File(); TPageBase=TPBase; TPageWidth=TPW ; TPageHeight=TPH; } //*************************************************************************** void CMkActor3d::Load() { Scene.Load(InFilename); // Scene.PrintPruneTree(); } //*************************************************************************** void CMkActor3d::Process() { BuildSkin(); FaceList.SetTexBasePath(InPath); FaceList.SetTexOut(GString("\\temp\\Test.tex"),1,1,1); FaceList.SetTexDebugOut(GString("\\temp\\Test.Lbm")); FaceList.Process(); } //*************************************************************************** void CMkActor3d::BuildSkin(int Idx) { CNode &ThisNode=Scene.GetNode(Idx); vector const &NodeTriList = ThisNode.GetTris(); vector const &NodeVtxList = ThisNode.GetPts(); vector const &NodeMatList = ThisNode.GetTriMaterial(); vector const &NodeUVList = ThisNode.GetUVTris(); vector const &SceneTexList= Scene.GetTexList(); vector const &SceneMatList= Scene.GetMaterials(); int TriCount=NodeTriList.size(); for (int T=0; T [ .. ] [ switches.. ]\n"); printf("Switches:\n"); printf(" -o:[FILE] Set output Dir\n"); printf(" -s:nn Set Scaling value\n"); printf(" -t:p,w,h Set TPage No,Width,Height\n"); printf(" -d: Enable Debug output\n"); printf(" -q: Enable Quadding\n"); GObject::Error(ERR_FATAL,ErrStr); } //*************************************************************************** int main (int argc, char *argv[]) { CommandLine(argc,argv,CycleCommands); if (OutStr.Empty()) Usage("No Output File Set\n"); if (TPBase==-1) Usage("No TPage Set\n"); vector const &Files = MyFiles.GetFileInfoVector(); for (int Loop=0; Loop