This commit is contained in:
parent
24aee8e424
commit
136ae1483b
@ -42,7 +42,7 @@ RSC=rc.exe
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# 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 RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -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();
|
||||
// FaceList.resize(ListSize+1);
|
||||
@ -104,7 +104,7 @@ CFace F;
|
||||
|
||||
F.TexName=Tex;
|
||||
F.Mat = -1;
|
||||
return(AddFace(F));
|
||||
return(AddFace(F,ProcessTexFlag));
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
@ -174,7 +174,7 @@ CFace &F = FaceList[ListSize];
|
||||
F.Mat = Face.Mat;
|
||||
F.Normal = crossProduct( F.vtx[0], F.vtx[1], F.vtx[2] );
|
||||
F.Avail = true;
|
||||
F.ID=ID=0;
|
||||
F.ID=ID;
|
||||
return(F);
|
||||
}
|
||||
|
||||
@ -243,12 +243,83 @@ int FaceCount=FaceList.size();
|
||||
//***************************************************************************
|
||||
//***************************************************************************
|
||||
//***************************************************************************
|
||||
/*
|
||||
void CFaceStore::SetupUV(CFace const &In, sTri &Out)
|
||||
{
|
||||
vector<sTexOutInfo> &TexInfo=TexGrab->GetTexInfo();
|
||||
sTexOutInfo &ThisTex=TexInfo[In.Mat];
|
||||
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 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.uv2[0] = (ThisTex.u + H) - round(In.uvs[2].v * H);
|
||||
Out.uv2[1] = (ThisTex.v + W) - round(In.uvs[2].u * W);
|
||||
ASSERT(0==1);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
// W=ThisTex.OrigW-1;
|
||||
// H=ThisTex.OrigH-1;
|
||||
if (ThisTex.w!=ThisTex.OrigW) printf("WW");
|
||||
if (ThisTex.h!=ThisTex.OrigH) printf("HH");
|
||||
/*
|
||||
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.Clut=ThisTex.Clut;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//***************************************************************************
|
||||
void CFaceStore::SetupUV(CFace const &In, sQuad &Out)
|
||||
{
|
||||
@ -347,7 +445,6 @@ int FaceCount=TriFaceList.size();
|
||||
OutFace.P0=InFace.pts[0];
|
||||
OutFace.P1=InFace.pts[1];
|
||||
OutFace.P2=InFace.pts[2];
|
||||
|
||||
// Materials and other shit
|
||||
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);
|
||||
|
||||
for (int i=0; i<ListSize; i++)
|
||||
{
|
||||
sTri ThisTri=OutTriList[i];
|
||||
sTri ThisTri=List[i];
|
||||
fwrite(&ThisTri,1,sizeof(sTri),File);
|
||||
}
|
||||
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);
|
||||
|
||||
for (int i=0; i<ListSize; i++)
|
||||
{
|
||||
sQuad &ThisQuad=OutQuadList[i];
|
||||
sQuad &ThisQuad=List[i];
|
||||
fwrite(&ThisQuad,1,sizeof(sQuad),File);
|
||||
}
|
||||
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);
|
||||
|
||||
for (int i=0; i<ListSize; i++)
|
||||
{
|
||||
sVtx ThisVtx=OutVtxList[i];
|
||||
if (Mul)
|
||||
{
|
||||
ThisVtx.vx*=Mul->vx;
|
||||
ThisVtx.vy*=Mul->vy;
|
||||
ThisVtx.vz*=Mul->vz;
|
||||
}
|
||||
sVtx &ThisVtx=List[i];
|
||||
fwrite(&ThisVtx,1,sizeof(sVtx),File);
|
||||
}
|
||||
return(Pos);
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
CFaceStore(int Max) {MaxStrip=Max;TexGrab=&FaceStoreTexGrab;}
|
||||
~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);
|
||||
void AddFaces(vector<CFace>&Faces,bool TexFlag=true);
|
||||
void AddFaces(CFaceStore &Faces,bool TexFlag=true);
|
||||
@ -111,9 +111,14 @@ public:
|
||||
|
||||
void ProcessTextures();
|
||||
void Process();
|
||||
int WriteTriList(FILE *File);
|
||||
int WriteQuadList(FILE *File);
|
||||
int WriteVtxList(FILE *File,sVtx *Mul=0);
|
||||
|
||||
int WriteTriList(FILE *File) {return(WriteTriList(File,OutTriList));}
|
||||
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);}
|
||||
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# 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 RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# 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 RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# 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 RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# 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 RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -399,7 +399,9 @@ GString CurrDir;
|
||||
ThisInfo.w=Frm.GetWidth();
|
||||
ThisInfo.h=Frm.GetHeight();
|
||||
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);
|
||||
MyFileInfo=NewMyFileInfo;
|
||||
|
||||
OrigW=Fr.GetWidth();
|
||||
OrigH=Fr.GetHeight();
|
||||
|
||||
GFName MyName(MyFileInfo.GetFileName());
|
||||
GString TempName=MyName.File();
|
||||
|
@ -52,6 +52,7 @@ struct sTexOutInfo
|
||||
bool Rotated;
|
||||
int u,v,w,h;
|
||||
int XOfs,YOfs;
|
||||
int OrigW,OrigH;
|
||||
};
|
||||
|
||||
/* Encapsulates a file and all the infomation parkgrab needs to process it
|
||||
@ -83,6 +84,8 @@ class FileInfo
|
||||
ForceOffsets=Fi.ForceOffsets;
|
||||
XOff=Fi.XOff;
|
||||
YOff=Fi.YOff;
|
||||
XOff1=Fi.XOff1;
|
||||
YOff1=Fi.YOff1;
|
||||
ShrinkToFit=Fi.ShrinkToFit;
|
||||
m_allocateAs16Bit=Fi.m_allocateAs16Bit;
|
||||
MemFrame=Fi.MemFrame;
|
||||
@ -186,6 +189,15 @@ class FileInfo
|
||||
{
|
||||
return(YOff);
|
||||
}
|
||||
int GetXOff1(void) const
|
||||
{
|
||||
return(XOff1);
|
||||
}
|
||||
|
||||
int GetYOff1(void) const
|
||||
{
|
||||
return(YOff1);
|
||||
}
|
||||
|
||||
bool getAllocateAs16Bit(void) const
|
||||
{return(m_allocateAs16Bit);}
|
||||
@ -217,6 +229,7 @@ class FileInfo
|
||||
bool m_allocateAs16Bit;
|
||||
|
||||
int XOff,YOff;
|
||||
int XOff1,YOff1;
|
||||
|
||||
Frame *MemFrame;
|
||||
};
|
||||
@ -463,6 +476,9 @@ public:
|
||||
|
||||
int getY(void) {return(Y);}
|
||||
|
||||
int GetOrigW() {return(OrigW);}
|
||||
int GetOrigH() {return(OrigH);}
|
||||
|
||||
int getW(void)
|
||||
{
|
||||
if (MyFileInfo.GetMoveUVs() && Width && !MyFileInfo.getAllocateAs16Bit())
|
||||
@ -494,6 +510,8 @@ protected:
|
||||
PalIndex=NewFrame.PalIndex;
|
||||
MyFileInfo=NewFrame.MyFileInfo;
|
||||
MyRect=NewFrame.MyRect;
|
||||
OrigW=NewFrame.OrigW;
|
||||
OrigH=NewFrame.OrigH;
|
||||
}
|
||||
|
||||
|
||||
@ -507,6 +525,7 @@ protected:
|
||||
int PalIndex;
|
||||
FileInfo MyFileInfo;
|
||||
TPRect MyRect;
|
||||
int OrigW,OrigH;
|
||||
};
|
||||
|
||||
/* A collection of sprites
|
||||
|
@ -332,6 +332,26 @@ int ColFlags=Flags >> PC_TILE_FLAG_COLLISION_SHIFT;
|
||||
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()
|
||||
{
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
|
||||
void Purge();
|
||||
void Render(int Flags,bool Render3d);
|
||||
void RenderInvalid();
|
||||
|
||||
int GetElemWidth() {return(ElemWidth);}
|
||||
int GetElemHeight() {return(ElemHeight);}
|
||||
@ -116,6 +117,7 @@ const char *GetName() {return(Name);}
|
||||
int GetBrowserWidth() {return(ElemBrowserWidth);}
|
||||
|
||||
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]);}
|
||||
void Purge();
|
||||
bool IsValid(int No);
|
||||
|
@ -138,6 +138,19 @@ GString SavePath;
|
||||
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()
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
const char *GetSetName(int Set) {return(SetList[Set].GetName());}
|
||||
const char *GetSetFilename(int Set) {return(SetList[Set].GetFilename());}
|
||||
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
|
||||
void DeleteCurrent();
|
||||
|
@ -109,7 +109,6 @@ int i,ListSize;
|
||||
if (OutStr.Empty()) Usage("No Output File Set\n");
|
||||
vector<GString> const &Files = MyFiles.GetFileInfoVector();
|
||||
|
||||
|
||||
for (i=0; i<Files.size(); i++)
|
||||
{
|
||||
ActorList.push_back(CMkActor3d(Files[i]));
|
||||
@ -124,7 +123,7 @@ vector<GString> const &Files = MyFiles.GetFileInfoVector();
|
||||
ActorList[i].ActorProcess();
|
||||
ActorList[i].AnimLoad();
|
||||
}
|
||||
CMkActor3d::TexProcess();
|
||||
CMkActor3d::TexGrab.Process();
|
||||
|
||||
for (i=0; i<ListSize; i++)
|
||||
{
|
||||
@ -146,6 +145,7 @@ GFName File=UpperName;
|
||||
InFilename=UpperName;
|
||||
InPath=File.Drive();
|
||||
InPath+=File.Dir();
|
||||
InPath.Append('\\');
|
||||
Name=File.File();
|
||||
}
|
||||
|
||||
@ -167,6 +167,7 @@ GString IncName;
|
||||
TexGrab.DontOutputBoxes(true);
|
||||
TexGrab.AllowRotate(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());
|
||||
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();
|
||||
|
||||
BoneCount=Skel.size();
|
||||
FaceList.SetTexGrab(TexGrab);
|
||||
|
||||
for (int i=0; i<ListSize; i++)
|
||||
{
|
||||
@ -320,7 +324,9 @@ int ListSize=Skel.size();
|
||||
|
||||
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;
|
||||
}
|
||||
@ -344,8 +350,6 @@ int ListSize=Skel.size();
|
||||
//***************************************************************************
|
||||
void CMkActor3d::ActorProcess()
|
||||
{
|
||||
FaceList.SetTexGrab(TexGrab);
|
||||
|
||||
ProcessSkel(1,-1);
|
||||
BuildSkelOut();
|
||||
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()
|
||||
{
|
||||
GString OutName=OutFile+".A3d";
|
||||
@ -390,7 +417,11 @@ GString OutName=OutFile+".A3d";
|
||||
printf("Q:%i\t",FileHdr.QuadCount);
|
||||
// Write VtxList
|
||||
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);
|
||||
|
||||
// Write TexList
|
||||
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# 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 RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
CMkActor3d(GString const &In);
|
||||
|
||||
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 ActorProcess();
|
||||
@ -48,6 +48,8 @@ static void TexProcess() {TexGrab.Process();}
|
||||
void AnimLoad();
|
||||
void AnimWrite();
|
||||
|
||||
static CTexGrab TexGrab;
|
||||
|
||||
private:
|
||||
void ReadScript(const char *Filename,vector<GString> &List);
|
||||
|
||||
@ -70,7 +72,6 @@ private:
|
||||
|
||||
std::vector<GString> InTexList;
|
||||
std::vector<GString> InAnimList;
|
||||
static CTexGrab TexGrab;
|
||||
|
||||
/*Anim*/
|
||||
void AnimWriteInclude();
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user