leocad/common/lc_texture.h

54 lines
746 B
C
Raw Normal View History

2012-10-11 23:55:55 +00:00
#ifndef _LC_TEXTURE_H_
#define _LC_TEXTURE_H_
#include "opengl.h"
2012-10-12 18:21:45 +00:00
#define LC_TEXTURE_WRAPU 0x01
#define LC_TEXTURE_WRAPV 0x02
#define LC_TEXTURE_MIPMAPS 0x04
2012-10-11 23:55:55 +00:00
2012-11-08 04:05:52 +00:00
#define LC_TEXTURE_NAME_LEN 256
2012-10-11 23:55:55 +00:00
class lcTexture
{
public:
lcTexture();
~lcTexture();
2012-10-12 18:21:45 +00:00
bool Load(const char* FileName, int Flags = 0);
bool Load(lcFile& File, int Flags = 0);
2012-10-11 23:55:55 +00:00
void Unload();
int AddRef()
{
mRefCount++;
if (mRefCount == 1)
Load();
return mRefCount;
}
int Release()
{
mRefCount--;
if (!mRefCount)
Unload();
return mRefCount;
}
2012-10-12 18:21:45 +00:00
int mWidth;
int mHeight;
2012-11-08 04:05:52 +00:00
char mName[LC_TEXTURE_NAME_LEN];
2012-10-11 23:55:55 +00:00
GLuint mTexture;
2012-10-16 00:43:52 +00:00
protected:
bool Load();
2012-10-11 23:55:55 +00:00
int mRefCount;
};
#endif // _LC_TEXTURE_H_