2000-10-27 20:18:30 +02:00
|
|
|
/*********************/
|
|
|
|
/*** Texture Cache ***/
|
|
|
|
/*********************/
|
|
|
|
|
|
|
|
#ifndef __TEXCACHE_HEADER__
|
|
|
|
#define __TEXCACHE_HEADER__
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "gl3d.h"
|
|
|
|
#include <gl\gl.h>
|
|
|
|
#include <gl\glu.h>
|
|
|
|
#include <gl\glut.h>
|
|
|
|
#include <Vector>
|
2000-11-24 23:34:20 +01:00
|
|
|
#include "Utils.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
|
|
|
|
{
|
|
|
|
char Name[256];
|
2000-10-27 22:21:39 +02:00
|
|
|
char Path[256];
|
2000-10-27 20:18:30 +02:00
|
|
|
GLuint TexID;
|
2000-10-27 22:21:39 +02:00
|
|
|
int Flags;
|
2000-11-22 23:08:47 +01:00
|
|
|
int Width,Height;
|
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-22 23:08:47 +01:00
|
|
|
int GetTexIdx(char *Name,int Flags);
|
|
|
|
|
|
|
|
int ProcessTexture(char *TexName,char *Path,int Flags,sRGBData *RGBData=0);
|
|
|
|
void Purge();
|
|
|
|
|
|
|
|
void LoadBMP(char *Filename,sRGBData &RGBData);
|
|
|
|
void FreeBMP(sRGBData &RGBData);
|
|
|
|
|
|
|
|
void LoadTex(sTex &ThisTex,sRGBData *TexData);
|
|
|
|
|
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
|
|
|
|
|
|
|
std::vector<sTex> TexList;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
#endif
|