raze/source/glbackend/gl_hwtexture.h
Christoph Oelckers bb4a19cf3a - added a few more texture formats to FHardwareTexture.
For brightmaps we do not need full RGBA8 data with mipmaps - RGBA2 without mipmaps is fully sufficient here and will save a lot of video memory.
2019-10-19 23:14:36 +02:00

50 lines
1.2 KiB
C++

#ifndef __GLTEXTURE_H
#define __GLTEXTURE_H
class FBitmap;
class FTexture;
#include "tarray.h"
class FHardwareTexture //: public IHardwareTexture
{
public:
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.
};
private:
int mSampler = 0;
unsigned int glTexID = 0;
int internalType = TrueColor;
bool mipmapped = true;
int mWidth = 0, mHeight = 0;
int colorId = 0;
public:
~FHardwareTexture();
//bool BindOrCreate(FTexture *tex, int texunit, int clampmode, int translation, int flags);
unsigned int CreateTexture(int w, int h, bool type, bool mipmapped) = delete;
unsigned int CreateTexture(int w, int h, int type, bool mipmapped);
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);
unsigned int GetTextureHandle();
int GetSampler() { return mSampler; }
void SetSampler(int sampler) { mSampler = sampler; }
bool isIndexed() const { return internalType == Indexed; }
friend class FGameTexture;
};
#endif