From be41f208c6660a879818321e2904795c7d45fe3e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 31 Jul 2024 20:56:23 +0200 Subject: Add mipmap, texture load from memory --- include/mglpp/graphics/Texture.hpp | 10 ++++++---- include/mglpp/system/MemoryMappedFile.hpp | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/mglpp/graphics/Texture.hpp b/include/mglpp/graphics/Texture.hpp index 906818c..8bd2df6 100644 --- a/include/mglpp/graphics/Texture.hpp +++ b/include/mglpp/graphics/Texture.hpp @@ -12,8 +12,9 @@ namespace mgl { class Texture { public: struct LoadOptions { - bool compressed; - bool pixel_coordinates; + bool compressed = false; + bool pixel_coordinates = false; + bool mipmap = false; /* available since opengl 3.0 */ }; Texture(); @@ -23,8 +24,9 @@ namespace mgl { static Texture reference(mgl_texture ref); - bool load_from_file(const char *filepath, const LoadOptions load_options = {false, false}); - bool load_from_image(Image &image, const LoadOptions load_options = {false, false}); + bool load_from_file(const char *filepath, const LoadOptions load_options = {false, false, false}); + bool load_from_image(Image &image, const LoadOptions load_options = {false, false, false}); + bool load_from_memory(const unsigned char *data, int width, int height, mgl_image_format format, LoadOptions load_options = {false, false, false}); void clear(); vec2i get_size() const; bool is_valid() const; diff --git a/include/mglpp/system/MemoryMappedFile.hpp b/include/mglpp/system/MemoryMappedFile.hpp index 1be23d4..57f3c67 100644 --- a/include/mglpp/system/MemoryMappedFile.hpp +++ b/include/mglpp/system/MemoryMappedFile.hpp @@ -9,8 +9,8 @@ namespace mgl { class MemoryMappedFile { public: struct LoadOptions { - bool readable; - bool writable; + bool readable = true; + bool writable = true; }; MemoryMappedFile(); -- cgit v1.2.3