SBSPSS/Utils/MapEdit/TexCache.cpp

43 lines
1.0 KiB
C++
Raw Normal View History

2000-10-27 20:18:30 +02:00
/*********************/
/*** Texture Cache ***/
/*********************/
#include "stdafx.h"
#include "gl3d.h"
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glut.h>
#include <Vector>
#include "TexCache.h"
#include "utils.h"
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
2000-10-27 22:21:39 +02:00
int CTexCache::ProcessTexture(char *TexName,char *Path,int Flags)
2000-10-27 20:18:30 +02:00
{
int ListSize=TexList.size();
// Check if Tex exists
for (int Count=0;Count<ListSize;Count++)
{
2000-10-27 22:21:39 +02:00
if (strcmp(TexName,TexList[Count].Name)==0 && TexList[Count].Flags==Flags)
2000-10-27 20:18:30 +02:00
{
2000-10-27 22:21:39 +02:00
return(Count);
2000-10-27 20:18:30 +02:00
}
}
sTex NewTex;
2000-10-27 22:21:39 +02:00
char Filename[256];
2000-10-27 20:18:30 +02:00
strcpy(NewTex.Name,TexName);
2000-10-27 22:21:39 +02:00
strcpy(NewTex.Path,Path);
sprintf(Filename,"%s%s",Path,TexName);
TRACE1("Loading Texture %s\n",Filename);
LoadGLTexture(Filename,NewTex.TexID);
NewTex.Flags=Flags;
2000-10-27 20:18:30 +02:00
TexList.push_back(NewTex);
2000-10-27 22:21:39 +02:00
return(Count);
2000-10-27 20:18:30 +02:00
}