2013-06-23 07:49:34 +00:00
|
|
|
|
|
|
|
#ifndef __GLTEXTURE_H
|
|
|
|
#define __GLTEXTURE_H
|
|
|
|
|
2014-05-11 19:47:54 +00:00
|
|
|
#ifdef LoadImage
|
|
|
|
#undef LoadImage
|
|
|
|
#endif
|
|
|
|
|
2013-06-23 07:49:34 +00:00
|
|
|
#define SHADED_TEXTURE -1
|
|
|
|
#define DIRECT_PALETTE -2
|
|
|
|
|
|
|
|
#include "tarray.h"
|
|
|
|
|
|
|
|
class FCanvasTexture;
|
|
|
|
class AActor;
|
|
|
|
|
2014-05-11 17:44:19 +00:00
|
|
|
// For error catching while changing parameters.
|
|
|
|
enum EInvalid
|
|
|
|
{
|
|
|
|
Invalid = 0
|
|
|
|
};
|
|
|
|
|
2013-06-23 07:49:34 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GLT_CLAMPX=1,
|
|
|
|
GLT_CLAMPY=2
|
|
|
|
};
|
|
|
|
|
|
|
|
class FHardwareTexture
|
|
|
|
{
|
2014-08-22 21:50:38 +00:00
|
|
|
public:
|
2013-06-23 07:49:34 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MAX_TEXTURES = 16
|
|
|
|
};
|
|
|
|
|
2014-08-22 21:50:38 +00:00
|
|
|
private:
|
2013-06-23 07:49:34 +00:00
|
|
|
struct TranslatedTexture
|
|
|
|
{
|
|
|
|
unsigned int glTexID;
|
|
|
|
int translation;
|
2014-08-22 21:50:38 +00:00
|
|
|
bool mipmapped;
|
|
|
|
|
|
|
|
void Delete();
|
2013-06-23 07:49:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
static unsigned int lastbound[MAX_TEXTURES];
|
|
|
|
static int lastactivetexture;
|
|
|
|
static int max_texturesize;
|
|
|
|
|
|
|
|
static int GetTexDimension(int value);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
short texwidth, texheight;
|
|
|
|
bool forcenocompression;
|
|
|
|
|
2014-08-22 21:50:38 +00:00
|
|
|
TranslatedTexture glDefTex;
|
|
|
|
TArray<TranslatedTexture> glTex_Translated;
|
2013-06-23 07:49:34 +00:00
|
|
|
unsigned int glDepthID; // only used by camera textures
|
|
|
|
|
2014-08-22 21:50:38 +00:00
|
|
|
TranslatedTexture * GetTexID(int translation);
|
2013-06-23 07:49:34 +00:00
|
|
|
|
|
|
|
int GetDepthBuffer();
|
2014-04-15 09:59:41 +00:00
|
|
|
void Resize(int width, int height, unsigned char *src_data, unsigned char *dst_data);
|
2013-06-23 07:49:34 +00:00
|
|
|
|
|
|
|
public:
|
2014-08-22 21:50:38 +00:00
|
|
|
FHardwareTexture(int w, int h, bool nocompress);
|
2013-06-23 07:49:34 +00:00
|
|
|
~FHardwareTexture();
|
|
|
|
|
|
|
|
static void Unbind(int texunit);
|
|
|
|
static void UnbindAll();
|
|
|
|
|
|
|
|
void BindToFrameBuffer();
|
|
|
|
|
2014-09-09 11:21:36 +00:00
|
|
|
unsigned int Bind(int texunit, int translation, bool needmipmap);
|
|
|
|
unsigned int CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation);
|
2013-06-23 07:49:34 +00:00
|
|
|
|
|
|
|
void Clean(bool all);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|