SBSPSS/Utils/MapEdit/TexCache.h

67 lines
1.5 KiB
C
Raw Normal View History

2000-10-27 20:18:30 +02:00
/*********************/
/*** Texture Cache ***/
/*********************/
#ifndef __TEXCACHE_HEADER__
#define __TEXCACHE_HEADER__
#include "stdafx.h"
#include <gl\gl.h>
#include <gl\glu.h>
#include <Vector>
2000-11-24 23:34:20 +01:00
#include "Utils.h"
2000-11-30 23:17:55 +01:00
#include "List.h"
2000-10-27 20:18:30 +02:00
2000-11-22 23:08:47 +01:00
struct sRGBData
{
int Width;
int Height;
2000-11-24 23:34:20 +01:00
u8 *RGB;
2000-11-22 23:08:47 +01:00
};
2000-10-27 20:18:30 +02:00
struct sTex
{
2000-11-30 23:17:55 +01:00
char Filename[_MAX_PATH];
2000-10-27 20:18:30 +02:00
GLuint TexID;
2000-10-27 22:21:39 +02:00
int Flags;
2000-11-30 23:17:55 +01:00
int TexWidth,TexHeight;
float dW,dH;
2000-12-29 23:20:38 +01:00
bool Loaded;
2000-11-30 23:17:55 +01:00
2000-12-29 23:20:38 +01:00
bool operator==(sTex const &v1) {return (!strcmp(Filename,v1.Filename) && Flags==v1.Flags);}
2000-10-27 20:18:30 +02:00
};
2000-11-28 00:07:07 +01:00
const RGBQUAD BlankRGB={255,0,255};
2000-10-27 20:18:30 +02:00
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
class CTexCache
{
public:
2000-11-30 23:17:55 +01:00
int GetTexIdx(sTex &Tex) {return(TexList.Find(Tex));}
int GetTexIdx(char *Filename,int Flags);
2000-11-22 23:08:47 +01:00
2000-11-30 23:17:55 +01:00
int ProcessTexture(char *Path,int Flags,sRGBData *RGBData=0);
2000-11-22 23:08:47 +01:00
void Purge();
2001-01-03 23:11:13 +01:00
bool LoadBMP(char *Filename,sRGBData &RGBData);
2000-11-22 23:08:47 +01:00
void FreeBMP(sRGBData &RGBData);
2000-11-30 23:17:55 +01:00
void FixBMP(sRGBData &RGBData);
2000-12-29 23:20:38 +01:00
bool IsSizeOk(int Size);
2000-11-30 23:17:55 +01:00
int AlignSize(int Size);
2000-11-22 23:08:47 +01:00
void LoadTex(sTex &ThisTex,sRGBData *TexData);
2000-11-30 23:17:55 +01:00
2000-11-22 23:08:47 +01:00
2000-10-27 22:21:39 +02:00
sTex &GetTex(int Id) {return(TexList[Id]);}
GLuint GetTexGLId(int Id) {return(TexList[Id].TexID);}
2000-10-27 20:18:30 +02:00
2000-11-30 23:17:55 +01:00
CList<sTex> TexList;
2000-10-27 20:18:30 +02:00
};
/*****************************************************************************/
#endif