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();
|
int LayerGetActive();
|
||||||
CLayer *LayerGet(int i);
|
CLayer *LayerGet(int i);
|
||||||
|
|
||||||
|
// Tex Cache
|
||||||
|
CTexCache &GetTexCache() {return(TexCache);}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMapEditView *ParentWindow;
|
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();
|
int ListSize=TexList.size();
|
||||||
|
|
||||||
// Check if Tex exists
|
// Check if Tex exists
|
||||||
for (int Count=0;Count<ListSize;Count++)
|
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;
|
sTex NewTex;
|
||||||
|
char Filename[256];
|
||||||
strcpy(NewTex.Name,TexName);
|
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);
|
TexList.push_back(NewTex);
|
||||||
|
|
||||||
return(NewTex.TexID);
|
return(Count);
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
struct sTex
|
struct sTex
|
||||||
{
|
{
|
||||||
char Name[256];
|
char Name[256];
|
||||||
|
char Path[256];
|
||||||
GLuint TexID;
|
GLuint TexID;
|
||||||
|
int Flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -25,8 +27,9 @@ class CTexCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int ProcessTexture(char *TexName);
|
int ProcessTexture(char *TexName,char *Path,int Flags);
|
||||||
int AddTexture(char *TexName);
|
sTex &GetTex(int Id) {return(TexList[Id]);}
|
||||||
|
GLuint GetTexGLId(int Id) {return(TexList[Id].TexID);}
|
||||||
|
|
||||||
|
|
||||||
std::vector<sTex> TexList;
|
std::vector<sTex> TexList;
|
||||||
|
|
|
@ -19,8 +19,16 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CTileSet::CTileSet(char *_Filename,CCore *Core)
|
CTileSet::CTileSet(char *_Filename,CCore *Core)
|
||||||
{
|
{
|
||||||
strcpy(Filename,_Filename);
|
char Drive[_MAX_DRIVE];
|
||||||
Load(Core);
|
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;
|
CScene Scene;
|
||||||
|
|
||||||
Scene.Load(Filename);
|
Scene.Load(_Filename);
|
||||||
|
|
||||||
CNode &ThisNode=Scene.GetSceneNode(0);
|
CNode &ThisNode=Scene.GetSceneNode(0);
|
||||||
int ChildCount=ThisNode.GetPruneChildCount();
|
int ChildCount=ThisNode.GetPruneChildCount();
|
||||||
|
@ -45,7 +53,7 @@ int ChildCount=ThisNode.GetPruneChildCount();
|
||||||
for (int Child=0; Child<ChildCount; Child++)
|
for (int Child=0; Child<ChildCount; Child++)
|
||||||
{
|
{
|
||||||
CTile NewTile;
|
CTile NewTile;
|
||||||
NewTile.Load(Core,Scene,ThisNode.PruneChildList[Child]);
|
NewTile.Load(Core,this,Scene,ThisNode.PruneChildList[Child]);
|
||||||
Tile.push_back(NewTile);
|
Tile.push_back(NewTile);
|
||||||
// AddTileToSet(Scene,ThisNode.PruneChildList[Child]);
|
// AddTileToSet(Scene,ThisNode.PruneChildList[Child]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,12 +24,15 @@ class CCore;
|
||||||
class CTileSet
|
class CTileSet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CTileSet(char *Filename,CCore *Core);
|
CTileSet(char *_Filename,CCore *Core);
|
||||||
~CTileSet();
|
~CTileSet();
|
||||||
|
|
||||||
int Load(CCore *Core);
|
int Load(CCore *Core,char *_Filename);
|
||||||
|
char *GetPath() {return(Path);}
|
||||||
|
char *GetFilename() {return(Filename);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
char Path[256];
|
||||||
char Filename[256];
|
char Filename[256];
|
||||||
std::vector<CTile> Tile;
|
std::vector<CTile> Tile;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue