This commit is contained in:
Daveo 2001-03-12 17:11:40 +00:00
parent 24aee8e424
commit 136ae1483b
17 changed files with 232 additions and 46 deletions

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Target_Dir "" # PROP Target_Dir ""
MTL=midl.exe MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\glib" /I "..\ginlib" /I "..\maths" /I "..\texgrab" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "..\glib" /I "..\ginlib" /I "..\maths" /I "..\texgrab" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -82,7 +82,7 @@ inline bool uvaprox( sUV &uv0, sUV &uv1 )
} }
//*************************************************************************** //***************************************************************************
CFace &CFaceStore::AddFace(vector<Vector3> const &P, const sGinTri &T, const sUVTri &uv,GString const &Tex,int ID) CFace &CFaceStore::AddFace(vector<Vector3> const &P, const sGinTri &T, const sUVTri &uv,GString const &Tex,int ID,bool ProcessTexFlag )
{ {
//int ListSize = FaceList.size(); //int ListSize = FaceList.size();
// FaceList.resize(ListSize+1); // FaceList.resize(ListSize+1);
@ -104,7 +104,7 @@ CFace F;
F.TexName=Tex; F.TexName=Tex;
F.Mat = -1; F.Mat = -1;
return(AddFace(F)); return(AddFace(F,ProcessTexFlag));
} }
//*************************************************************************** //***************************************************************************
@ -174,7 +174,7 @@ CFace &F = FaceList[ListSize];
F.Mat = Face.Mat; F.Mat = Face.Mat;
F.Normal = crossProduct( F.vtx[0], F.vtx[1], F.vtx[2] ); F.Normal = crossProduct( F.vtx[0], F.vtx[1], F.vtx[2] );
F.Avail = true; F.Avail = true;
F.ID=ID=0; F.ID=ID;
return(F); return(F);
} }
@ -243,12 +243,83 @@ int FaceCount=FaceList.size();
//*************************************************************************** //***************************************************************************
//*************************************************************************** //***************************************************************************
//*************************************************************************** //***************************************************************************
/*
void CFaceStore::SetupUV(CFace const &In, sTri &Out) void CFaceStore::SetupUV(CFace const &In, sTri &Out)
{ {
vector<sTexOutInfo> &TexInfo=TexGrab->GetTexInfo(); vector<sTexOutInfo> &TexInfo=TexGrab->GetTexInfo();
sTexOutInfo &ThisTex=TexInfo[In.Mat]; sTexOutInfo &ThisTex=TexInfo[In.Mat];
ASSERT(In.Mat<TexInfo.size()); ASSERT(In.Mat<TexInfo.size());
// Uses orig tex size to make sure mapping is corrent on 'shrunk' textures :o)
int W = ThisTex.OrigW - 1;
int H = ThisTex.OrigH - 1;
int XOfs=0,YOfs=0;
int uv0[2];
int uv1[2];
int uv2[2];
if (ThisTex.Rotated)
{
// uv0[0] = (ThisTex.u + H) - round(In.uvs[0].v * H);
// uv0[1] = (ThisTex.v + W) - round(In.uvs[0].u * W);
// uv1[0] = (ThisTex.u + H) - round(In.uvs[1].v * H);
// uv1[1] = (ThisTex.v + W) - round(In.uvs[1].u * W);
// uv2[0] = (ThisTex.u + H) - round(In.uvs[2].v * H);
// uv2[1] = (ThisTex.v + W) - round(In.uvs[2].u * W);
uv0[0] = (ThisTex.u ) - round(In.uvs[0].v * H);
uv0[1] = (ThisTex.v ) - round(In.uvs[0].u * W);
uv1[0] = (ThisTex.u ) - round(In.uvs[1].v * H);
uv1[1] = (ThisTex.v ) - round(In.uvs[1].u * W);
uv2[0] = (ThisTex.u ) - round(In.uvs[2].v * H);
uv2[1] = (ThisTex.v ) - round(In.uvs[2].u * W);
XOfs=H-((ThisTex.OrigW-ThisTex.h));
YOfs= +((ThisTex.OrigH-ThisTex.w)-W);
ASSERT(!"");
}
else
{
W=ThisTex.w-1;
H=ThisTex.h-1;
// Out.uv0[0] = (ThisTex.u)+ round(In.uvs[0].u * W);
// Out.uv0[1] = (ThisTex.v + H) - round(In.uvs[0].v * H);
// Out.uv1[0] = (ThisTex.u)+ round(In.uvs[1].u * W);
// Out.uv1[1] = (ThisTex.v + H) - round(In.uvs[1].v * H);
// Out.uv2[0] = (ThisTex.u)+ round(In.uvs[2].u * W);
// Out.uv2[1] = (ThisTex.v + H) - round(In.uvs[2].v * H);
uv0[0] = (ThisTex.u) + round(In.uvs[0].u * W);
uv0[1] = (ThisTex.v) - round(In.uvs[0].v * H);
uv1[0] = (ThisTex.u) + round(In.uvs[1].u * W);
uv1[1] = (ThisTex.v) - round(In.uvs[1].v * H);
uv2[0] = (ThisTex.u) + round(In.uvs[2].u * W);
uv2[1] = (ThisTex.v) - round(In.uvs[2].v * H);
XOfs=(ThisTex.OrigW-ThisTex.w);
YOfs=(ThisTex.OrigH-ThisTex.h)-H;
XOfs=0;
YOfs=0;
}
Out.uv0[0]=uv0[0]-XOfs; Out.uv0[1]=uv0[1]-YOfs;
Out.uv1[0]=uv1[0]-XOfs; Out.uv1[1]=uv1[1]-YOfs;
Out.uv2[0]=uv2[0]-XOfs; Out.uv2[1]=uv2[1]-YOfs;
Out.TPage=ThisTex.Tpage;
Out.Clut=ThisTex.Clut;
}
*/
void CFaceStore::SetupUV(CFace const &In, sTri &Out)
{
vector<sTexOutInfo> &TexInfo=TexGrab->GetTexInfo();
sTexOutInfo &ThisTex=TexInfo[In.Mat];
ASSERT(In.Mat<TexInfo.size());
int uv0[2],uv1[2],uv2[2];
int XOfs=0,YOfs=0;
int W = ThisTex.w - 1; int W = ThisTex.w - 1;
int H = ThisTex.h - 1; int H = ThisTex.h - 1;
@ -260,21 +331,48 @@ int H = ThisTex.h - 1;
Out.uv1[1] = (ThisTex.v + W) - round(In.uvs[1].u * W); Out.uv1[1] = (ThisTex.v + W) - round(In.uvs[1].u * W);
Out.uv2[0] = (ThisTex.u + H) - round(In.uvs[2].v * H); Out.uv2[0] = (ThisTex.u + H) - round(In.uvs[2].v * H);
Out.uv2[1] = (ThisTex.v + W) - round(In.uvs[2].u * W); Out.uv2[1] = (ThisTex.v + W) - round(In.uvs[2].u * W);
ASSERT(0==1);
} }
else else
{ {
Out.uv0[0] = (ThisTex.u)+ round(In.uvs[0].u * W); // W=ThisTex.OrigW-1;
Out.uv0[1] = (ThisTex.v + H) - round(In.uvs[0].v * H); // H=ThisTex.OrigH-1;
Out.uv1[0] = (ThisTex.u)+ round(In.uvs[1].u * W); if (ThisTex.w!=ThisTex.OrigW) printf("WW");
Out.uv1[1] = (ThisTex.v + H) - round(In.uvs[1].v * H); if (ThisTex.h!=ThisTex.OrigH) printf("HH");
Out.uv2[0] = (ThisTex.u)+ round(In.uvs[2].u * W); /*
Out.uv2[1] = (ThisTex.v + H) - round(In.uvs[2].v * H); uv0[0] = (ThisTex.u)+ round(In.uvs[0].u * W);
uv0[1] = (ThisTex.v + H) - round(In.uvs[0].v * H);
uv1[0] = (ThisTex.u)+ round(In.uvs[1].u * W);
uv1[1] = (ThisTex.v + H) - round(In.uvs[1].v * H);
uv2[0] = (ThisTex.u)+ round(In.uvs[2].u * W);
uv2[1] = (ThisTex.v + H) - round(In.uvs[2].v * H);
*/
int U=ThisTex.u;
int V=ThisTex.v+H;
uv0[0] = U + round(In.uvs[0].u * W);
uv0[1] = V - round(In.uvs[0].v * H);
uv1[0] = U + round(In.uvs[1].u * W);
uv1[1] = V - round(In.uvs[1].v * H);
uv2[0] = U + round(In.uvs[2].u * W);
uv2[1] = V - round(In.uvs[2].v * H);
// XOfs=(ThisTex.OrigW-ThisTex.w);
// XOfs=ThisTex.XOfs;
// YOfs=H-(ThisTex.OrigH-ThisTex.h);
// YOfs=H;
} }
Out.uv0[0]=(uv0[0]-XOfs); Out.uv0[1]=(uv0[1]-YOfs);
Out.uv1[0]=(uv1[0]-XOfs); Out.uv1[1]=(uv1[1]-YOfs);
Out.uv2[0]=(uv2[0]-XOfs); Out.uv2[1]=(uv2[1]-YOfs);
Out.TPage=ThisTex.Tpage; Out.TPage=ThisTex.Tpage;
Out.Clut=ThisTex.Clut; Out.Clut=ThisTex.Clut;
} }
//*************************************************************************** //***************************************************************************
void CFaceStore::SetupUV(CFace const &In, sQuad &Out) void CFaceStore::SetupUV(CFace const &In, sQuad &Out)
{ {
@ -347,7 +445,6 @@ int FaceCount=TriFaceList.size();
OutFace.P0=InFace.pts[0]; OutFace.P0=InFace.pts[0];
OutFace.P1=InFace.pts[1]; OutFace.P1=InFace.pts[1];
OutFace.P2=InFace.pts[2]; OutFace.P2=InFace.pts[2];
// Materials and other shit // Materials and other shit
SetupUV(InFace,OutFace); SetupUV(InFace,OutFace);
} }
@ -379,48 +476,42 @@ int FaceCount=QuadFaceList.size();
//*************************************************************************** //***************************************************************************
//*************************************************************************** //***************************************************************************
//*************************************************************************** //***************************************************************************
int CFaceStore::WriteTriList(FILE *File) int CFaceStore::WriteTriList(FILE *File,vector<sTri> &List)
{ {
int ListSize=OutTriList.size(); int ListSize=List.size();
int Pos=ftell(File); int Pos=ftell(File);
for (int i=0; i<ListSize; i++) for (int i=0; i<ListSize; i++)
{ {
sTri ThisTri=OutTriList[i]; sTri ThisTri=List[i];
fwrite(&ThisTri,1,sizeof(sTri),File); fwrite(&ThisTri,1,sizeof(sTri),File);
} }
return(Pos); return(Pos);
} }
//*************************************************************************** //***************************************************************************
int CFaceStore::WriteQuadList(FILE *File) int CFaceStore::WriteQuadList(FILE *File,vector<sQuad> &List)
{ {
int ListSize=OutQuadList.size(); int ListSize=List.size();
int Pos=ftell(File); int Pos=ftell(File);
for (int i=0; i<ListSize; i++) for (int i=0; i<ListSize; i++)
{ {
sQuad &ThisQuad=OutQuadList[i]; sQuad &ThisQuad=List[i];
fwrite(&ThisQuad,1,sizeof(sQuad),File); fwrite(&ThisQuad,1,sizeof(sQuad),File);
} }
return(Pos); return(Pos);
} }
//*************************************************************************** //***************************************************************************
int CFaceStore::WriteVtxList(FILE *File,sVtx *Mul) int CFaceStore::WriteVtxList(FILE *File,vector<sVtx> &List)
{ {
int ListSize=OutVtxList.size(); int ListSize=List.size();
int Pos=ftell(File); int Pos=ftell(File);
for (int i=0; i<ListSize; i++) for (int i=0; i<ListSize; i++)
{ {
sVtx ThisVtx=OutVtxList[i]; sVtx &ThisVtx=List[i];
if (Mul)
{
ThisVtx.vx*=Mul->vx;
ThisVtx.vy*=Mul->vy;
ThisVtx.vz*=Mul->vz;
}
fwrite(&ThisVtx,1,sizeof(sVtx),File); fwrite(&ThisVtx,1,sizeof(sVtx),File);
} }
return(Pos); return(Pos);

View File

@ -86,7 +86,7 @@ public:
CFaceStore(int Max) {MaxStrip=Max;TexGrab=&FaceStoreTexGrab;} CFaceStore(int Max) {MaxStrip=Max;TexGrab=&FaceStoreTexGrab;}
~CFaceStore(){}; ~CFaceStore(){};
CFace &AddFace(vector<Vector3> const &P, const sGinTri &T, const sUVTri &uv,GString const &Tex,int ID=0); CFace &AddFace(vector<Vector3> const &P, const sGinTri &T, const sUVTri &uv,GString const &Tex,int ID=0,bool ProcessTexFlag=false);
CFace &AddFace(CFace &F,bool TexFlag=true); CFace &AddFace(CFace &F,bool TexFlag=true);
void AddFaces(vector<CFace>&Faces,bool TexFlag=true); void AddFaces(vector<CFace>&Faces,bool TexFlag=true);
void AddFaces(CFaceStore &Faces,bool TexFlag=true); void AddFaces(CFaceStore &Faces,bool TexFlag=true);
@ -111,9 +111,14 @@ public:
void ProcessTextures(); void ProcessTextures();
void Process(); void Process();
int WriteTriList(FILE *File);
int WriteQuadList(FILE *File); int WriteTriList(FILE *File) {return(WriteTriList(File,OutTriList));}
int WriteVtxList(FILE *File,sVtx *Mul=0); int WriteQuadList(FILE *File) {return(WriteQuadList(File,OutQuadList));}
int WriteVtxList(FILE *File) {return(WriteVtxList(File,OutVtxList));}
int WriteTriList(FILE *File,vector<sTri> &List);
int WriteQuadList(FILE *File,vector<sQuad> &List);
int WriteVtxList(FILE *File,vector<sVtx> &List);
vector<CFace> const &GetFaceList() {return(FaceList);} vector<CFace> const &GetFaceList() {return(FaceList);}

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Target_Dir "" # PROP Target_Dir ""
MTL=midl.exe MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FR"Release/" /Fp"Release/Glib.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c # ADD CPP /nologo /G6 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FR"Release/" /Fp"Release/Glib.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Target_Dir "" # PROP Target_Dir ""
MTL=midl.exe MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\glib" /I "..\maths" /I "..\davelib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "..\glib" /I "..\maths" /I "..\davelib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Target_Dir "" # PROP Target_Dir ""
MTL=midl.exe MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /G6 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Target_Dir "" # PROP Target_Dir ""
MTL=midl.exe MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\glib" /I "..\ginlib" /I "..\maths" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "..\glib" /I "..\ginlib" /I "..\maths" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -399,7 +399,9 @@ GString CurrDir;
ThisInfo.w=Frm.GetWidth(); ThisInfo.w=Frm.GetWidth();
ThisInfo.h=Frm.GetHeight(); ThisInfo.h=Frm.GetHeight();
ThisInfo.XOfs=Frm.GetX(); ThisInfo.XOfs=Frm.GetX();
ThisInfo.XOfs=Frm.GetY(); ThisInfo.YOfs=Frm.GetY();
ThisInfo.OrigW=Frm.GetOrigW();
ThisInfo.OrigH=Frm.GetOrigH();
} }
} }
@ -847,6 +849,8 @@ void SprFrame::SetFrameAndInfo(Frame const & Fr,FileInfo const & NewMyFileInfo,i
Frame::CopyFrame(Fr); Frame::CopyFrame(Fr);
MyFileInfo=NewMyFileInfo; MyFileInfo=NewMyFileInfo;
OrigW=Fr.GetWidth();
OrigH=Fr.GetHeight();
GFName MyName(MyFileInfo.GetFileName()); GFName MyName(MyFileInfo.GetFileName());
GString TempName=MyName.File(); GString TempName=MyName.File();

View File

@ -52,6 +52,7 @@ struct sTexOutInfo
bool Rotated; bool Rotated;
int u,v,w,h; int u,v,w,h;
int XOfs,YOfs; int XOfs,YOfs;
int OrigW,OrigH;
}; };
/* Encapsulates a file and all the infomation parkgrab needs to process it /* Encapsulates a file and all the infomation parkgrab needs to process it
@ -83,6 +84,8 @@ class FileInfo
ForceOffsets=Fi.ForceOffsets; ForceOffsets=Fi.ForceOffsets;
XOff=Fi.XOff; XOff=Fi.XOff;
YOff=Fi.YOff; YOff=Fi.YOff;
XOff1=Fi.XOff1;
YOff1=Fi.YOff1;
ShrinkToFit=Fi.ShrinkToFit; ShrinkToFit=Fi.ShrinkToFit;
m_allocateAs16Bit=Fi.m_allocateAs16Bit; m_allocateAs16Bit=Fi.m_allocateAs16Bit;
MemFrame=Fi.MemFrame; MemFrame=Fi.MemFrame;
@ -186,6 +189,15 @@ class FileInfo
{ {
return(YOff); return(YOff);
} }
int GetXOff1(void) const
{
return(XOff1);
}
int GetYOff1(void) const
{
return(YOff1);
}
bool getAllocateAs16Bit(void) const bool getAllocateAs16Bit(void) const
{return(m_allocateAs16Bit);} {return(m_allocateAs16Bit);}
@ -217,6 +229,7 @@ class FileInfo
bool m_allocateAs16Bit; bool m_allocateAs16Bit;
int XOff,YOff; int XOff,YOff;
int XOff1,YOff1;
Frame *MemFrame; Frame *MemFrame;
}; };
@ -463,6 +476,9 @@ public:
int getY(void) {return(Y);} int getY(void) {return(Y);}
int GetOrigW() {return(OrigW);}
int GetOrigH() {return(OrigH);}
int getW(void) int getW(void)
{ {
if (MyFileInfo.GetMoveUVs() && Width && !MyFileInfo.getAllocateAs16Bit()) if (MyFileInfo.GetMoveUVs() && Width && !MyFileInfo.getAllocateAs16Bit())
@ -494,6 +510,8 @@ protected:
PalIndex=NewFrame.PalIndex; PalIndex=NewFrame.PalIndex;
MyFileInfo=NewFrame.MyFileInfo; MyFileInfo=NewFrame.MyFileInfo;
MyRect=NewFrame.MyRect; MyRect=NewFrame.MyRect;
OrigW=NewFrame.OrigW;
OrigH=NewFrame.OrigH;
} }
@ -507,6 +525,7 @@ protected:
int PalIndex; int PalIndex;
FileInfo MyFileInfo; FileInfo MyFileInfo;
TPRect MyRect; TPRect MyRect;
int OrigW,OrigH;
}; };
/* A collection of sprites /* A collection of sprites

View File

@ -332,6 +332,26 @@ int ColFlags=Flags >> PC_TILE_FLAG_COLLISION_SHIFT;
glPopMatrix(); glPopMatrix();
} }
/*****************************************************************************/
void CElem::RenderInvalid()
{
float X0=0;
float X1=UnitWidth;
float Y0=0;
float Y1=UnitHeight;
glBindTexture(GL_TEXTURE_2D, 0);
glBegin(GL_LINES);
glColor4f(1,1,1,1);
glVertex3f( X0,Y0,0);
glVertex3f( X1,Y1,0);
glVertex3f( X1,Y0,0);
glVertex3f( X0,Y1,0);
glEnd();
}
/*****************************************************************************/ /*****************************************************************************/
void CElem::Purge() void CElem::Purge()
{ {

View File

@ -47,6 +47,7 @@ public:
void Purge(); void Purge();
void Render(int Flags,bool Render3d); void Render(int Flags,bool Render3d);
void RenderInvalid();
int GetElemWidth() {return(ElemWidth);} int GetElemWidth() {return(ElemWidth);}
int GetElemHeight() {return(ElemHeight);} int GetElemHeight() {return(ElemHeight);}
@ -116,6 +117,7 @@ const char *GetName() {return(Name);}
int GetBrowserWidth() {return(ElemBrowserWidth);} int GetBrowserWidth() {return(ElemBrowserWidth);}
void RenderElem(int Elem,int Flags,bool Render3d) {ElemList[Elem].Render(Flags,Render3d);} void RenderElem(int Elem,int Flags,bool Render3d) {ElemList[Elem].Render(Flags,Render3d);}
void RenderInvalid() {ElemList[0].RenderInvalid();}
CElem &GetElem(int No) {return(ElemList[No]);} CElem &GetElem(int No) {return(ElemList[No]);}
void Purge(); void Purge();
bool IsValid(int No); bool IsValid(int No);

View File

@ -138,6 +138,19 @@ GString SavePath;
CElemBank::Save(File); CElemBank::Save(File);
} }
/*****************************************************************************/
void CTileBank::RenderTile(int Set,int Elem,int Flags,bool Is3d)
{
if (IsValid(Set,Elem))
{
SetList[Set].RenderElem(Elem,Flags,Is3d);
}
else
{
SetList[0].RenderInvalid();
}
}
/*****************************************************************************/ /*****************************************************************************/
void CTileBank::DeleteCurrent() void CTileBank::DeleteCurrent()
{ {

View File

@ -69,7 +69,7 @@ public:
const char *GetSetName(int Set) {return(SetList[Set].GetName());} const char *GetSetName(int Set) {return(SetList[Set].GetName());}
const char *GetSetFilename(int Set) {return(SetList[Set].GetFilename());} const char *GetSetFilename(int Set) {return(SetList[Set].GetFilename());}
CElem &GetTile(int Set,int Tile) {return(SetList[Set].GetElem(Tile));} CElem &GetTile(int Set,int Tile) {return(SetList[Set].GetElem(Tile));}
void RenderTile(int Set,int Elem,int Flags,bool Is3d) {SetList[Set].RenderElem(Elem,Flags,Is3d);} void RenderTile(int Set,int Elem,int Flags,bool Is3d);
// Local // Local
void DeleteCurrent(); void DeleteCurrent();

View File

@ -109,7 +109,6 @@ int i,ListSize;
if (OutStr.Empty()) Usage("No Output File Set\n"); if (OutStr.Empty()) Usage("No Output File Set\n");
vector<GString> const &Files = MyFiles.GetFileInfoVector(); vector<GString> const &Files = MyFiles.GetFileInfoVector();
for (i=0; i<Files.size(); i++) for (i=0; i<Files.size(); i++)
{ {
ActorList.push_back(CMkActor3d(Files[i])); ActorList.push_back(CMkActor3d(Files[i]));
@ -124,7 +123,7 @@ vector<GString> const &Files = MyFiles.GetFileInfoVector();
ActorList[i].ActorProcess(); ActorList[i].ActorProcess();
ActorList[i].AnimLoad(); ActorList[i].AnimLoad();
} }
CMkActor3d::TexProcess(); CMkActor3d::TexGrab.Process();
for (i=0; i<ListSize; i++) for (i=0; i<ListSize; i++)
{ {
@ -146,6 +145,7 @@ GFName File=UpperName;
InFilename=UpperName; InFilename=UpperName;
InPath=File.Drive(); InPath=File.Drive();
InPath+=File.Dir(); InPath+=File.Dir();
InPath.Append('\\');
Name=File.File(); Name=File.File();
} }
@ -167,6 +167,7 @@ GString IncName;
TexGrab.DontOutputBoxes(true); TexGrab.DontOutputBoxes(true);
TexGrab.AllowRotate(true); TexGrab.AllowRotate(true);
TexGrab.FileRecursion(true); TexGrab.FileRecursion(true);
} }
//*************************************************************************** //***************************************************************************
@ -291,7 +292,9 @@ Matrix4x4 PMtx=ParentNode.Mtx;
if (Mat>SceneTexList.size()) GObject::Error(ERR_FATAL,"Crap Material ID, wanted %i, only have %i\n",Mat,SceneTexList.size()); if (Mat>SceneTexList.size()) GObject::Error(ERR_FATAL,"Crap Material ID, wanted %i, only have %i\n",Mat,SceneTexList.size());
GString TexName=InPath+SceneTexList[Mat]; GString TexName=InPath+SceneTexList[Mat];
ParentBone.FaceList.AddFace( VtxList, NodeTriList[T], NodeUVList[T], TexName); Scale*=16;;
ParentBone.FaceList.AddFace( VtxList, NodeTriList[T], NodeUVList[T], TexName,0,false);
Scale/=16;;
} }
} }
@ -306,6 +309,7 @@ void CMkActor3d::BuildSkelOut()
int ListSize=Skel.size(); int ListSize=Skel.size();
BoneCount=Skel.size(); BoneCount=Skel.size();
FaceList.SetTexGrab(TexGrab);
for (int i=0; i<ListSize; i++) for (int i=0; i<ListSize; i++)
{ {
@ -320,7 +324,9 @@ int ListSize=Skel.size();
for (int F=0; F<FaceListSize; F++) for (int F=0; F<FaceListSize; F++)
{ {
FaceList.AddFace(ThisBone.FaceList[F]); Scale*=16;
FaceList.AddFace(ThisBone.FaceList[F],true);
Scale/=16;
} }
ThisBone.Bone.VtxCount=FaceList.GetVtxCount()-VtxStart; ThisBone.Bone.VtxCount=FaceList.GetVtxCount()-VtxStart;
} }
@ -344,8 +350,6 @@ int ListSize=Skel.size();
//*************************************************************************** //***************************************************************************
void CMkActor3d::ActorProcess() void CMkActor3d::ActorProcess()
{ {
FaceList.SetTexGrab(TexGrab);
ProcessSkel(1,-1); ProcessSkel(1,-1);
BuildSkelOut(); BuildSkelOut();
printf("%s has %i bones\n",Name,BoneCount); printf("%s has %i bones\n",Name,BoneCount);
@ -363,6 +367,29 @@ int ListSize=InTexList.size();
//*************************************************************************** //***************************************************************************
//***************************************************************************
void Rescale(vector<sVtx> const &InList,vector<sVtx> &OutList)
{
int i,ListSize=InList.size();
int S=16;
OutList.resize(ListSize);
if (!ListSize) return;
printf("Rescale Factor %i\n",S);
for (i=0; i<ListSize;i++)
{
sVtx const &In=InList[i];
sVtx &Out=OutList[i];
Out.vx=In.vx/S;
Out.vy=In.vy/S;
Out.vz=In.vz/S;
}
}
//***************************************************************************
void CMkActor3d::ActorWrite() void CMkActor3d::ActorWrite()
{ {
GString OutName=OutFile+".A3d"; GString OutName=OutFile+".A3d";
@ -390,7 +417,11 @@ GString OutName=OutFile+".A3d";
printf("Q:%i\t",FileHdr.QuadCount); printf("Q:%i\t",FileHdr.QuadCount);
// Write VtxList // Write VtxList
FileHdr.VtxCount=FaceList.GetVtxCount(); FileHdr.VtxCount=FaceList.GetVtxCount();
FileHdr.VtxList=(sVtx*)FaceList.WriteVtxList(File); // FileHdr.VtxList=(sVtx*)FaceList.WriteVtxList(File);
vector<sVtx> VtxList;
Rescale(FaceList.GetVtxList(),VtxList);
FileHdr.VtxList=(sVtx*)FaceList.WriteVtxList(File,VtxList);
printf("V:%i\t",FileHdr.VtxCount); printf("V:%i\t",FileHdr.VtxCount);
// Write TexList // Write TexList

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\libs\glib" /I "..\libs\maths" /I "..\libs\davelib" /I "..\libs\ginlib" /I "..\libs\texgrab" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c # ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "..\libs\glib" /I "..\libs\maths" /I "..\libs\davelib" /I "..\libs\ginlib" /I "..\libs\texgrab" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe

View File

@ -39,7 +39,7 @@ public:
CMkActor3d(GString const &In); CMkActor3d(GString const &In);
static void SetTPData(const char *Name,int TPBase,int TPW,int TPH); static void SetTPData(const char *Name,int TPBase,int TPW,int TPH);
static void TexProcess() {TexGrab.Process();} //static void TexProcess() {TexGrab.Process();}
void ActorLoad(); void ActorLoad();
void ActorProcess(); void ActorProcess();
@ -48,6 +48,8 @@ static void TexProcess() {TexGrab.Process();}
void AnimLoad(); void AnimLoad();
void AnimWrite(); void AnimWrite();
static CTexGrab TexGrab;
private: private:
void ReadScript(const char *Filename,vector<GString> &List); void ReadScript(const char *Filename,vector<GString> &List);
@ -70,7 +72,6 @@ private:
std::vector<GString> InTexList; std::vector<GString> InTexList;
std::vector<GString> InAnimList; std::vector<GString> InAnimList;
static CTexGrab TexGrab;
/*Anim*/ /*Anim*/
void AnimWriteInclude(); void AnimWriteInclude();

Binary file not shown.