2019-09-17 17:03:42 +00:00
|
|
|
|
|
|
|
#ifndef __GLTEXTURE_H
|
|
|
|
#define __GLTEXTURE_H
|
|
|
|
|
2019-10-05 19:59:03 +00:00
|
|
|
class FBitmap;
|
2019-10-06 07:31:36 +00:00
|
|
|
class FTexture;
|
2019-09-17 17:03:42 +00:00
|
|
|
|
2019-10-06 08:19:51 +00:00
|
|
|
#include "tarray.h"
|
|
|
|
|
2019-09-17 17:03:42 +00:00
|
|
|
class FHardwareTexture //: public IHardwareTexture
|
|
|
|
{
|
|
|
|
public:
|
2019-10-19 21:14:36 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
Indexed,
|
|
|
|
TrueColor,
|
|
|
|
HighColor, // 16 bit - Can be used to save space in memory constrained scenarios at the cost of visual accuracy.
|
|
|
|
Brightmap, // This can be stored as RGBA2 to save space, it also doesn't really need a mipmap.
|
|
|
|
};
|
2019-09-17 17:03:42 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2019-09-18 18:44:21 +00:00
|
|
|
int mSampler = 0;
|
2019-09-17 17:03:42 +00:00
|
|
|
unsigned int glTexID = 0;
|
2019-10-19 21:14:36 +00:00
|
|
|
int internalType = TrueColor;
|
2019-09-17 17:03:42 +00:00
|
|
|
bool mipmapped = true;
|
|
|
|
int mWidth = 0, mHeight = 0;
|
2019-10-06 07:31:36 +00:00
|
|
|
int colorId = 0;
|
2019-11-09 22:58:26 +00:00
|
|
|
uint32_t allocated = 0;
|
2019-09-17 17:03:42 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
~FHardwareTexture();
|
|
|
|
|
|
|
|
//bool BindOrCreate(FTexture *tex, int texunit, int clampmode, int translation, int flags);
|
|
|
|
|
2019-10-19 21:14:36 +00:00
|
|
|
unsigned int CreateTexture(int w, int h, bool type, bool mipmapped) = delete;
|
|
|
|
unsigned int CreateTexture(int w, int h, int type, bool mipmapped);
|
2019-10-19 08:21:07 +00:00
|
|
|
unsigned int LoadTexture(const unsigned char * buffer);
|
|
|
|
unsigned int LoadTexturePart(const unsigned char* buffer, int x, int y, int w, int h);
|
|
|
|
unsigned int LoadTexture(FBitmap &bmp);
|
2019-09-17 17:03:42 +00:00
|
|
|
unsigned int GetTextureHandle();
|
2019-09-18 18:44:21 +00:00
|
|
|
int GetSampler() { return mSampler; }
|
|
|
|
void SetSampler(int sampler) { mSampler = sampler; }
|
2019-10-19 21:14:36 +00:00
|
|
|
bool isIndexed() const { return internalType == Indexed; }
|
2019-10-06 07:31:36 +00:00
|
|
|
|
|
|
|
friend class FGameTexture;
|
|
|
|
};
|
|
|
|
|
2019-09-17 17:03:42 +00:00
|
|
|
|
|
|
|
#endif
|