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
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ETranslation
|
|
|
|
{
|
|
|
|
TRANS_Alpha = INT_MAX
|
|
|
|
};
|
|
|
|
|
2013-06-23 07:49:34 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GLT_CLAMPX=1,
|
|
|
|
GLT_CLAMPY=2
|
|
|
|
};
|
|
|
|
|
|
|
|
class FHardwareTexture
|
|
|
|
{
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
MAX_TEXTURES = 16
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TranslatedTexture
|
|
|
|
{
|
|
|
|
unsigned int glTexID;
|
|
|
|
int translation;
|
2014-05-11 17:44:19 +00:00
|
|
|
//int cm;
|
2013-06-23 07:49:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
static unsigned int lastbound[MAX_TEXTURES];
|
|
|
|
static int lastactivetexture;
|
|
|
|
static bool supportsNonPower2;
|
|
|
|
static int max_texturesize;
|
|
|
|
|
|
|
|
static int GetTexDimension(int value);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
short texwidth, texheight;
|
|
|
|
//float scalexfac, scaleyfac;
|
|
|
|
bool mipmap;
|
|
|
|
BYTE clampmode;
|
|
|
|
bool forcenofiltering;
|
|
|
|
bool forcenocompression;
|
|
|
|
|
2014-05-11 17:44:19 +00:00
|
|
|
unsigned glDefTexID;
|
2013-06-23 07:49:34 +00:00
|
|
|
TArray<TranslatedTexture> glTexID_Translated;
|
|
|
|
unsigned int glDepthID; // only used by camera textures
|
|
|
|
|
|
|
|
void LoadImage(unsigned char * buffer,int w, int h, unsigned int & glTexID,int wrapparam, bool alphatexture, int texunit);
|
2014-05-11 17:44:19 +00:00
|
|
|
unsigned * GetTexID(int translation);
|
2013-06-23 07:49:34 +00:00
|
|
|
|
|
|
|
int GetDepthBuffer();
|
|
|
|
void DeleteTexture(unsigned int texid);
|
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:
|
|
|
|
FHardwareTexture(int w, int h, bool mip, bool wrap, bool nofilter, bool nocompress);
|
|
|
|
~FHardwareTexture();
|
|
|
|
|
|
|
|
static void Unbind(int texunit);
|
|
|
|
static void UnbindAll();
|
|
|
|
|
|
|
|
void BindToFrameBuffer();
|
|
|
|
|
2014-05-11 17:44:19 +00:00
|
|
|
unsigned int Bind(int texunit, int translation=0, bool alphatexture = false);
|
|
|
|
unsigned int CreateTexture(unsigned char * buffer, int w, int h,bool wrap, int texunit, int translation=0, bool alphatexture = false);
|
2013-06-23 07:49:34 +00:00
|
|
|
void Resize(int _width, int _height) ;
|
|
|
|
|
|
|
|
void Clean(bool all);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|