2013-08-09 06:57:18 +02:00
|
|
|
#ifndef _LC_TEXTURE_H_
|
|
|
|
#define _LC_TEXTURE_H_
|
|
|
|
|
|
|
|
#include "opengl.h"
|
|
|
|
|
2013-08-31 23:58:47 +02:00
|
|
|
#define LC_TEXTURE_WRAPU 0x01
|
|
|
|
#define LC_TEXTURE_WRAPV 0x02
|
|
|
|
#define LC_TEXTURE_MIPMAPS 0x04
|
|
|
|
|
|
|
|
#define LC_TEXTURE_POINT 0x00
|
|
|
|
#define LC_TEXTURE_LINEAR 0x10
|
|
|
|
#define LC_TEXTURE_BILINEAR 0x20
|
|
|
|
#define LC_TEXTURE_TRILINEAR 0x30
|
|
|
|
#define LC_TEXTURE_ANISOTROPIC 0x40
|
|
|
|
#define LC_TEXTURE_FILTER_MASK 0xf0
|
|
|
|
#define LC_TEXTURE_FILTER_SHIFT 4
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
#define LC_TEXTURE_NAME_LEN 256
|
|
|
|
|
|
|
|
class Image;
|
|
|
|
|
|
|
|
class lcTexture
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
lcTexture();
|
|
|
|
~lcTexture();
|
|
|
|
|
2014-08-24 00:56:59 +02:00
|
|
|
void CreateGridTexture();
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
bool Load(const char* FileName, int Flags = 0);
|
|
|
|
bool Load(lcMemFile& File, int Flags = 0);
|
|
|
|
bool Load(Image& image, int Flags);
|
2013-08-31 23:58:47 +02:00
|
|
|
bool Load(Image* images, int NumLevels, int Flags);
|
2013-08-09 06:57:18 +02:00
|
|
|
void Unload();
|
|
|
|
|
|
|
|
int AddRef()
|
|
|
|
{
|
|
|
|
mRefCount++;
|
|
|
|
|
|
|
|
if (mRefCount == 1)
|
|
|
|
Load();
|
|
|
|
|
|
|
|
return mRefCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Release()
|
|
|
|
{
|
|
|
|
mRefCount--;
|
|
|
|
|
|
|
|
if (!mRefCount)
|
|
|
|
Unload();
|
|
|
|
|
|
|
|
return mRefCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mWidth;
|
|
|
|
int mHeight;
|
|
|
|
char mName[LC_TEXTURE_NAME_LEN];
|
|
|
|
GLuint mTexture;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool Load();
|
|
|
|
|
|
|
|
int mRefCount;
|
|
|
|
};
|
|
|
|
|
2014-10-05 07:21:51 +02:00
|
|
|
lcTexture* lcLoadTexture(const QString& FileName, int Flags);
|
|
|
|
void lcReleaseTexture(lcTexture* Texture);
|
|
|
|
|
2014-08-24 00:56:59 +02:00
|
|
|
extern lcTexture* gGridTexture;
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
#endif // _LC_TEXTURE_H_
|