2020-01-19 07:40:03 +00:00
|
|
|
#pragma once
|
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"
|
2020-05-24 17:12:22 +00:00
|
|
|
#include "hw_ihwtexture.h"
|
2019-10-06 08:19:51 +00:00
|
|
|
|
2020-05-24 17:12:22 +00:00
|
|
|
class FHardwareTexture : public IHardwareTexture
|
2019-09-17 17:03:42 +00:00
|
|
|
{
|
|
|
|
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;
|
2020-01-19 07:40:03 +00:00
|
|
|
unsigned int glDepthID = 0; // only used by camera textures
|
|
|
|
unsigned int glBufferID = 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
|
|
|
|
2020-01-19 07:40:03 +00:00
|
|
|
int GetDepthBuffer(int w, int h);
|
|
|
|
|
2019-09-17 17:03:42 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
~FHardwareTexture();
|
|
|
|
|
2020-05-24 17:12:22 +00:00
|
|
|
// Satisfy the virtual interface - currently this isn't being used.
|
|
|
|
virtual void AllocateBuffer(int w, int h, int texelsize) {}
|
|
|
|
virtual uint8_t* MapBuffer() { return nullptr; }
|
|
|
|
virtual unsigned int CreateTexture(unsigned char* buffer, int w, int h, int texunit, bool mipmap, const char* name) { return 0; }
|
|
|
|
|
2019-09-17 17:03:42 +00:00
|
|
|
//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; }
|
2020-01-19 07:40:03 +00:00
|
|
|
void BindToFrameBuffer(int w, int h);
|
2019-10-06 07:31:36 +00:00
|
|
|
|
|
|
|
friend class FGameTexture;
|
|
|
|
};
|
|
|
|
|
2019-09-17 17:03:42 +00:00
|
|
|
|