This commit is contained in:
parent
a44030464c
commit
7764a46abd
5 changed files with 38 additions and 18 deletions
|
@ -50,6 +50,9 @@ public:
|
|||
int LayerGetActive();
|
||||
CLayer *LayerGet(int i);
|
||||
|
||||
// Tex Cache
|
||||
CTexCache &GetTexCache() {return(TexCache);}
|
||||
|
||||
|
||||
private:
|
||||
CMapEditView *ParentWindow;
|
||||
|
|
|
@ -15,25 +15,28 @@
|
|||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
int CTexCache::ProcessTexture(char *TexName)
|
||||
int CTexCache::ProcessTexture(char *TexName,char *Path,int Flags)
|
||||
{
|
||||
// TRACE3("%i %s\t%i Tris\n",Id,ThisNode.GetName(),TriCount);
|
||||
int ListSize=TexList.size();
|
||||
|
||||
// Check if Tex exists
|
||||
for (int Count=0;Count<ListSize;Count++)
|
||||
{
|
||||
if (strcmp(TexName,TexList[Count].Name))
|
||||
if (strcmp(TexName,TexList[Count].Name)==0 && TexList[Count].Flags==Flags)
|
||||
{
|
||||
return(TexList[Count].TexID);
|
||||
return(Count);
|
||||
}
|
||||
}
|
||||
sTex NewTex;
|
||||
char Filename[256];
|
||||
strcpy(NewTex.Name,TexName);
|
||||
LoadGLTexture(TexName,NewTex.TexID);
|
||||
strcpy(NewTex.Path,Path);
|
||||
sprintf(Filename,"%s%s",Path,TexName);
|
||||
TRACE1("Loading Texture %s\n",Filename);
|
||||
LoadGLTexture(Filename,NewTex.TexID);
|
||||
NewTex.Flags=Flags;
|
||||
TexList.push_back(NewTex);
|
||||
|
||||
return(NewTex.TexID);
|
||||
//
|
||||
return(Count);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
struct sTex
|
||||
{
|
||||
char Name[256];
|
||||
char Path[256];
|
||||
GLuint TexID;
|
||||
int Flags;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -25,8 +27,9 @@ class CTexCache
|
|||
{
|
||||
public:
|
||||
|
||||
int ProcessTexture(char *TexName);
|
||||
int AddTexture(char *TexName);
|
||||
int ProcessTexture(char *TexName,char *Path,int Flags);
|
||||
sTex &GetTex(int Id) {return(TexList[Id]);}
|
||||
GLuint GetTexGLId(int Id) {return(TexList[Id].TexID);}
|
||||
|
||||
|
||||
std::vector<sTex> TexList;
|
||||
|
|
|
@ -19,8 +19,16 @@
|
|||
/*****************************************************************************/
|
||||
CTileSet::CTileSet(char *_Filename,CCore *Core)
|
||||
{
|
||||
strcpy(Filename,_Filename);
|
||||
Load(Core);
|
||||
char Drive[_MAX_DRIVE];
|
||||
char Dir[_MAX_DIR];
|
||||
char Fname[_MAX_FNAME];
|
||||
char Ext[_MAX_EXT];
|
||||
|
||||
_splitpath(_Filename,Drive,Dir,Fname,Ext);
|
||||
sprintf(Path,"%s%s",Drive,Dir);
|
||||
sprintf(Filename,"%s%s",Fname,Ext);
|
||||
|
||||
Load(Core,_Filename);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -33,11 +41,11 @@ CTileSet::~CTileSet()
|
|||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
int CTileSet::Load(CCore *Core)
|
||||
int CTileSet::Load(CCore *Core,char *_Filename)
|
||||
{
|
||||
CScene Scene;
|
||||
|
||||
Scene.Load(Filename);
|
||||
Scene.Load(_Filename);
|
||||
|
||||
CNode &ThisNode=Scene.GetSceneNode(0);
|
||||
int ChildCount=ThisNode.GetPruneChildCount();
|
||||
|
@ -45,7 +53,7 @@ int ChildCount=ThisNode.GetPruneChildCount();
|
|||
for (int Child=0; Child<ChildCount; Child++)
|
||||
{
|
||||
CTile NewTile;
|
||||
NewTile.Load(Core,Scene,ThisNode.PruneChildList[Child]);
|
||||
NewTile.Load(Core,this,Scene,ThisNode.PruneChildList[Child]);
|
||||
Tile.push_back(NewTile);
|
||||
// AddTileToSet(Scene,ThisNode.PruneChildList[Child]);
|
||||
}
|
||||
|
|
|
@ -24,12 +24,15 @@ class CCore;
|
|||
class CTileSet
|
||||
{
|
||||
public:
|
||||
CTileSet(char *Filename,CCore *Core);
|
||||
CTileSet(char *_Filename,CCore *Core);
|
||||
~CTileSet();
|
||||
|
||||
int Load(CCore *Core);
|
||||
int Load(CCore *Core,char *_Filename);
|
||||
char *GetPath() {return(Path);}
|
||||
char *GetFilename() {return(Filename);}
|
||||
|
||||
private:
|
||||
char Path[256];
|
||||
char Filename[256];
|
||||
std::vector<CTile> Tile;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue