Upd8
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 1m29s

This commit is contained in:
2024-08-04 20:28:08 -04:00
parent 50895153f5
commit 15dcb79479
3 changed files with 58 additions and 34 deletions

View File

@@ -6,14 +6,21 @@
#include <glad/glad.h>
namespace JGL {
enum class TextureFilteringMode {
using namespace ReTexture;
enum class TextureFilteringMode : u8 {
NEAREST = 0, //Fastest for 2D, Sometimes causes graphical issues.
BILINEAR = 1, //Fast and pretty, The best for 2D.
MIPMAP_NEAREST = 2, //Nearest with mipmaps. The fastest for 3D, Sometimes causes graphical issues. Uses more vram.
MIPMAP_BILINEAR = 3, //Bilinear with mipmaps, Fast and pretty.
MIPMAP_TRILINEAR = 4 //The prettiest. Not much slower though.
MIPMAP_BILINEAR = 3, //Bilinear with mipmaps, Fast and pretty. Uses more vram.
MIPMAP_TRILINEAR = 4 //The prettiest. Still decent speed. Uses more vram.
};
enum class TextureWrappingMode : u8 {
REPEAT = 0,
MIRRORED_REPEAT = 1,
CLAMP_TO_EDGE = 2,
CLAMP_TO_BORDER = 3 //Effectively the same as clamp_to_edge
};
class Texture {
@@ -23,16 +30,17 @@ namespace JGL {
ReTexture::TextureFlag texture_flags;
ReTexture::TextureFormat texture_format;
TextureFilteringMode texture_filtering_mode;
void load(ReTexture::Texture* software_texture, const Vector2& size, const ReTexture::TextureFormat& format, TextureFilteringMode filtering_mode);
TextureWrappingMode texture_wrapping_mode;
void load(SoftwareTexture* software_texture, const Vector2& size, const TextureFormat& format, TextureFilteringMode filtering_mode, TextureWrappingMode wrapping_mode);
public:
explicit Texture(const std::string& file, TextureFilteringMode filtering_mode = TextureFilteringMode::BILINEAR);
Texture(const std::string& file, const ReTexture::TextureFlag& flags, TextureFilteringMode filtering_mode = TextureFilteringMode::BILINEAR);
explicit Texture(const std::string& file, TextureFilteringMode filtering_mode = TextureFilteringMode::BILINEAR, TextureWrappingMode wrapping_mode = TextureWrappingMode::CLAMP_TO_EDGE);
Texture(const std::string& file, const TextureFlag& flags, TextureFilteringMode filtering_mode = TextureFilteringMode::BILINEAR, TextureWrappingMode wrapping_mode = TextureWrappingMode::CLAMP_TO_EDGE);
GLuint getTexture();
Vector2 getSize();
TextureFilteringMode getTextureFilteringMode();
ReTexture::TextureFlag getFlags();
ReTexture::TextureFormat getFormat();
void erase();
TextureFilteringMode getFilteringMode();
TextureFlag getFlags();
TextureFormat getFormat();
std::vector<Color4> getPixelData();
};