You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
/******************************************************************************
|
|
|
|
|
* File - texture.h
|
|
|
|
|
* Author - Joey Pollack
|
|
|
|
|
* Date - 2022/07/14 (y/m/d)
|
|
|
|
|
* Mod Date - 2022/07/14 (y/m/d)
|
|
|
|
|
* Description - OpenGL texture 2D
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef LUNARIUM_TEXTURE_H_
|
|
|
|
|
#define LUNARIUM_TEXTURE_H_
|
|
|
|
|
|
|
|
|
|
#include <core/common_defs.h>
|
|
|
|
|
|
|
|
|
|
namespace lunarium
|
|
|
|
|
{
|
|
|
|
|
enum class TextureFormat
|
|
|
|
|
{
|
|
|
|
|
RGB,
|
|
|
|
|
RGBA,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Texture
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
static Texture* Create(u8* data = nullptr, u32 width = 1, u32 height = 1, TextureFormat format = TextureFormat::RGBA);
|
|
|
|
|
static void Destroy(Texture** ppTex);
|
|
|
|
|
|
|
|
|
|
void Bind(u32 slot = 0) const;
|
|
|
|
|
void Unbind() const;
|
|
|
|
|
|
|
|
|
|
u32 GetGLID() const;
|
|
|
|
|
u64 GetGLID64() const;
|
|
|
|
|
TextureFormat GetFormat() const;
|
|
|
|
|
u32 GetWidth() const;
|
|
|
|
|
u32 GetHeight() const;
|
|
|
|
|
|
|
|
|
|
u8* GetPixels() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
TextureFormat mFormat;
|
|
|
|
|
u32 mWidth;
|
|
|
|
|
u32 mHeight;
|
|
|
|
|
u32 mGLID;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Texture();
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // LUNARIUM_TEXTURE_H_
|